michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.background.announcements; michael@0: michael@0: import java.util.List; michael@0: import java.util.Locale; michael@0: michael@0: public interface AnnouncementsFetchDelegate { michael@0: /** michael@0: * @return the timestamp of the last fetch in milliseconds. michael@0: */ michael@0: public long getLastFetch(); michael@0: michael@0: /** michael@0: * @return the Date header string of the last response, or null if not present. michael@0: */ michael@0: public String getLastDate(); michael@0: michael@0: /** michael@0: * @return the current system locale (e.g., en_us). michael@0: */ michael@0: public Locale getLocale(); michael@0: michael@0: /** michael@0: * @return the User-Agent header to use for the request. michael@0: */ michael@0: public String getUserAgent(); michael@0: michael@0: /** michael@0: * @return the server URL to interrogate, including path. michael@0: */ michael@0: public String getServiceURL(); michael@0: michael@0: /* michael@0: * Callback methods. michael@0: * Note that we provide both a local fetch time and a server date here. michael@0: * This is so we can track how long we've waited (local), and supply the michael@0: * date back to the server for If-Modified-Since. michael@0: */ michael@0: public void onNoNewAnnouncements(long localFetchTime, String serverDate); michael@0: public void onNewAnnouncements(List snippets, long localFetchTime, String serverDate); michael@0: public void onLocalError(Exception e); michael@0: public void onRemoteError(Exception e); michael@0: public void onRemoteFailure(int status); michael@0: public void onBackoff(int retryAfterInSeconds); michael@0: }