1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/sync/delegates/BaseGlobalSessionCallback.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,42 @@ 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.sync.delegates; 1.9 + 1.10 +import java.net.URI; 1.11 + 1.12 +import org.mozilla.gecko.sync.GlobalSession; 1.13 +import org.mozilla.gecko.sync.stage.GlobalSyncStage.Stage; 1.14 + 1.15 +public interface BaseGlobalSessionCallback { 1.16 + /** 1.17 + * Request that no further syncs occur within the next `backoff` milliseconds. 1.18 + * @param backoff a duration in milliseconds. 1.19 + */ 1.20 + void requestBackoff(long backoff); 1.21 + 1.22 + /** 1.23 + * Called on a 401 HTTP response. 1.24 + */ 1.25 + void informUnauthorizedResponse(GlobalSession globalSession, URI oldClusterURL); 1.26 + 1.27 + 1.28 + /** 1.29 + * Called when an HTTP failure indicates that a software upgrade is required. 1.30 + */ 1.31 + void informUpgradeRequiredResponse(GlobalSession session); 1.32 + 1.33 + void handleAborted(GlobalSession globalSession, String reason); 1.34 + void handleError(GlobalSession globalSession, Exception ex); 1.35 + void handleSuccess(GlobalSession globalSession); 1.36 + void handleStageCompleted(Stage currentState, GlobalSession globalSession); 1.37 + 1.38 + /** 1.39 + * Called when a {@link GlobalSession} wants to know if it should continue 1.40 + * to make storage requests. 1.41 + * 1.42 + * @return false if the session should make no further requests. 1.43 + */ 1.44 + boolean shouldBackOffStorage(); 1.45 +}