OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_FRONTEND_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_FRONTEND_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "sync/internal_api/public/base/model_type.h" |
| 10 #include "sync/internal_api/public/sync_encryption_handler.h" |
| 11 #include "sync/internal_api/public/sync_manager.h" |
| 12 #include "sync/internal_api/public/util/weak_handle.h" |
| 13 #include "sync/protocol/sync_protocol_error.h" |
| 14 |
| 15 namespace syncer { |
| 16 class DataTypeDebugInfoListener; |
| 17 class JsBackend; |
| 18 } // namespace syncer |
| 19 |
| 20 namespace sync_pb { |
| 21 class EncryptedData; |
| 22 } // namespace sync_pb |
| 23 |
| 24 namespace browser_sync { |
| 25 |
| 26 // SyncFrontend is the interface used by SyncBackendHost to communicate with |
| 27 // the entity that created it and, presumably, is interested in sync-related |
| 28 // activity. |
| 29 // NOTE: All methods will be invoked by a SyncBackendHost on the same thread |
| 30 // used to create that SyncBackendHost. |
| 31 class SyncFrontend { |
| 32 public: |
| 33 SyncFrontend(); |
| 34 virtual ~SyncFrontend(); |
| 35 |
| 36 // The backend has completed initialization and it is now ready to |
| 37 // accept and process changes. If success is false, initialization |
| 38 // wasn't able to be completed and should be retried. |
| 39 // |
| 40 // |js_backend| is what about:sync interacts with; it's different |
| 41 // from the 'Backend' in 'OnBackendInitialized' (unfortunately). It |
| 42 // is initialized only if |success| is true. |
| 43 virtual void OnBackendInitialized( |
| 44 const syncer::WeakHandle<syncer::JsBackend>& js_backend, |
| 45 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
| 46 debug_info_listener, |
| 47 bool success) = 0; |
| 48 |
| 49 // The backend queried the server recently and received some updates. |
| 50 virtual void OnSyncCycleCompleted() = 0; |
| 51 |
| 52 // Configure ran into some kind of error. But it is scheduled to be |
| 53 // retried. |
| 54 virtual void OnSyncConfigureRetry() = 0; |
| 55 |
| 56 // The status of the connection to the sync server has changed. |
| 57 virtual void OnConnectionStatusChange( |
| 58 syncer::ConnectionStatus status) = 0; |
| 59 |
| 60 // We are no longer permitted to communicate with the server. Sync should |
| 61 // be disabled and state cleaned up at once. |
| 62 virtual void OnStopSyncingPermanently() = 0; |
| 63 |
| 64 // The syncer requires a passphrase to decrypt sensitive updates. This is |
| 65 // called when the first sensitive data type is setup by the user and anytime |
| 66 // the passphrase is changed by another synced client. |reason| denotes why |
| 67 // the passphrase was required. |pending_keys| is a copy of the |
| 68 // cryptographer's pending keys to be passed on to the frontend in order to |
| 69 // be cached. |
| 70 virtual void OnPassphraseRequired( |
| 71 syncer::PassphraseRequiredReason reason, |
| 72 const sync_pb::EncryptedData& pending_keys) = 0; |
| 73 |
| 74 // Called when the passphrase provided by the user is |
| 75 // accepted. After this is called, updates to sensitive nodes are |
| 76 // encrypted using the accepted passphrase. |
| 77 virtual void OnPassphraseAccepted() = 0; |
| 78 |
| 79 // Called when the set of encrypted types or the encrypt everything |
| 80 // flag has been changed. Note that encryption isn't complete until |
| 81 // the OnEncryptionComplete() notification has been sent (see |
| 82 // below). |
| 83 // |
| 84 // |encrypted_types| will always be a superset of |
| 85 // syncer::Cryptographer::SensitiveTypes(). If |encrypt_everything| is |
| 86 // true, |encrypted_types| will be the set of all known types. |
| 87 // |
| 88 // Until this function is called, observers can assume that the set |
| 89 // of encrypted types is syncer::Cryptographer::SensitiveTypes() and that |
| 90 // the encrypt everything flag is false. |
| 91 virtual void OnEncryptedTypesChanged( |
| 92 syncer::ModelTypeSet encrypted_types, |
| 93 bool encrypt_everything) = 0; |
| 94 |
| 95 // Called after we finish encrypting the current set of encrypted |
| 96 // types. |
| 97 virtual void OnEncryptionComplete() = 0; |
| 98 |
| 99 // Called to perform migration of |types|. |
| 100 virtual void OnMigrationNeededForTypes(syncer::ModelTypeSet types) = 0; |
| 101 |
| 102 // Inform the Frontend that new datatypes are available for registration. |
| 103 virtual void OnExperimentsChanged( |
| 104 const syncer::Experiments& experiments) = 0; |
| 105 |
| 106 // Called when the sync cycle returns there is an user actionable error. |
| 107 virtual void OnActionableError(const syncer::SyncProtocolError& error) = 0; |
| 108 }; |
| 109 |
| 110 } // namespace browser_sync |
| 111 |
| 112 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_FRONTEND_H_ |
OLD | NEW |