mobile/android/base/background/announcements/AnnouncementsFetchDelegate.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/background/announcements/AnnouncementsFetchDelegate.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +package org.mozilla.gecko.background.announcements;
     1.9 +
    1.10 +import java.util.List;
    1.11 +import java.util.Locale;
    1.12 +
    1.13 +public interface AnnouncementsFetchDelegate {
    1.14 +  /**
    1.15 +   * @return the timestamp of the last fetch in milliseconds.
    1.16 +   */
    1.17 +  public long getLastFetch();
    1.18 +
    1.19 +  /**
    1.20 +   * @return the Date header string of the last response, or null if not present.
    1.21 +   */
    1.22 +  public String getLastDate();
    1.23 +
    1.24 +  /**
    1.25 +   * @return the current system locale (e.g., en_us).
    1.26 +   */
    1.27 +  public Locale getLocale();
    1.28 +
    1.29 +  /**
    1.30 +   * @return the User-Agent header to use for the request.
    1.31 +   */
    1.32 +  public String getUserAgent();
    1.33 +
    1.34 +  /**
    1.35 +   * @return the server URL to interrogate, including path.
    1.36 +   */
    1.37 +  public String getServiceURL();
    1.38 +
    1.39 +  /*
    1.40 +   * Callback methods.
    1.41 +   * Note that we provide both a local fetch time and a server date here.
    1.42 +   * This is so we can track how long we've waited (local), and supply the
    1.43 +   * date back to the server for If-Modified-Since.
    1.44 +   */
    1.45 +  public void onNoNewAnnouncements(long localFetchTime, String serverDate);
    1.46 +  public void onNewAnnouncements(List<Announcement> snippets, long localFetchTime, String serverDate);
    1.47 +  public void onLocalError(Exception e);
    1.48 +  public void onRemoteError(Exception e);
    1.49 +  public void onRemoteFailure(int status);
    1.50 +  public void onBackoff(int retryAfterInSeconds);
    1.51 +}
    1.52 \ No newline at end of file

mercurial