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

branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
equal deleted inserted replaced
-1:000000000000 0:5f00e289c27f
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 package org.mozilla.gecko.background.announcements;
6
7 import java.util.List;
8 import java.util.Locale;
9
10 public interface AnnouncementsFetchDelegate {
11 /**
12 * @return the timestamp of the last fetch in milliseconds.
13 */
14 public long getLastFetch();
15
16 /**
17 * @return the Date header string of the last response, or null if not present.
18 */
19 public String getLastDate();
20
21 /**
22 * @return the current system locale (e.g., en_us).
23 */
24 public Locale getLocale();
25
26 /**
27 * @return the User-Agent header to use for the request.
28 */
29 public String getUserAgent();
30
31 /**
32 * @return the server URL to interrogate, including path.
33 */
34 public String getServiceURL();
35
36 /*
37 * Callback methods.
38 * Note that we provide both a local fetch time and a server date here.
39 * This is so we can track how long we've waited (local), and supply the
40 * date back to the server for If-Modified-Since.
41 */
42 public void onNoNewAnnouncements(long localFetchTime, String serverDate);
43 public void onNewAnnouncements(List<Announcement> snippets, long localFetchTime, String serverDate);
44 public void onLocalError(Exception e);
45 public void onRemoteError(Exception e);
46 public void onRemoteFailure(int status);
47 public void onBackoff(int retryAfterInSeconds);
48 }

mercurial