| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_HOST_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_HOST_H_ |
| 6 #define COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_HOST_H_ | 6 #define COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "components/sync/base/model_type.h" | 10 #include "components/sync/base/model_type.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 struct UpdateCounters; | 27 struct UpdateCounters; |
| 28 | 28 |
| 29 // SyncEngineHost is the interface used by SyncEngine to communicate with the | 29 // SyncEngineHost is the interface used by SyncEngine to communicate with the |
| 30 // entity that created it. It's essentially an observer interface except the | 30 // entity that created it. It's essentially an observer interface except the |
| 31 // SyncEngine always has exactly one. | 31 // SyncEngine always has exactly one. |
| 32 class SyncEngineHost { | 32 class SyncEngineHost { |
| 33 public: | 33 public: |
| 34 SyncEngineHost(); | 34 SyncEngineHost(); |
| 35 virtual ~SyncEngineHost(); | 35 virtual ~SyncEngineHost(); |
| 36 | 36 |
| 37 // The backend has completed initialization and it is now ready to | 37 // The engine has completed initialization and it is now ready to accept and |
| 38 // accept and process changes. If success is false, initialization | 38 // process changes. If success is false, initialization wasn't able to be |
| 39 // wasn't able to be completed and should be retried. | 39 // completed and should be retried. |
| 40 // | 40 // |
| 41 // |js_backend| is what about:sync interacts with; it's different | 41 // |js_backend| is what about:sync interacts with. It is initialized only if |
| 42 // from the 'Backend' in 'OnBackendInitialized' (unfortunately). It | 42 // |success| is true. |
| 43 // is initialized only if |success| is true. | 43 virtual void OnEngineInitialized( |
| 44 virtual void OnBackendInitialized( | |
| 45 const WeakHandle<JsBackend>& js_backend, | 44 const WeakHandle<JsBackend>& js_backend, |
| 46 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, | 45 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, |
| 47 const std::string& cache_guid, | 46 const std::string& cache_guid, |
| 48 bool success) = 0; | 47 bool success) = 0; |
| 49 | 48 |
| 50 // The backend queried the server recently and received some updates. | 49 // The engine queried the server recently and received some updates. |
| 51 virtual void OnSyncCycleCompleted() = 0; | 50 virtual void OnSyncCycleCompleted() = 0; |
| 52 | 51 |
| 53 // Informs the host of some network event. These notifications are disabled by | 52 // Informs the host of some network event. These notifications are disabled by |
| 54 // default and must be enabled through an explicit request to the SyncEngine. | 53 // default and must be enabled through an explicit request to the SyncEngine. |
| 55 // | 54 // |
| 56 // It's disabled by default to avoid copying data across threads when no one | 55 // It's disabled by default to avoid copying data across threads when no one |
| 57 // is listening for it. | 56 // is listening for it. |
| 58 virtual void OnProtocolEvent(const ProtocolEvent& event) = 0; | 57 virtual void OnProtocolEvent(const ProtocolEvent& event) = 0; |
| 59 | 58 |
| 60 // Called when we receive an updated commit counter for a directory type. | 59 // Called when we receive an updated commit counter for a directory type. |
| 61 // | 60 // |
| 62 // Disabled by default. Enable by calling | 61 // Disabled by default. Enable by calling |
| 63 // EnableDirectoryTypeDebugInfoForwarding() on the backend. | 62 // EnableDirectoryTypeDebugInfoForwarding() on the engine. |
| 64 virtual void OnDirectoryTypeCommitCounterUpdated( | 63 virtual void OnDirectoryTypeCommitCounterUpdated( |
| 65 ModelType type, | 64 ModelType type, |
| 66 const CommitCounters& counters) = 0; | 65 const CommitCounters& counters) = 0; |
| 67 | 66 |
| 68 // Called when we receive an updated update counter for a directory type. | 67 // Called when we receive an updated update counter for a directory type. |
| 69 // | 68 // |
| 70 // Disabled by default. Enable by calling | 69 // Disabled by default. Enable by calling |
| 71 // EnableDirectoryTypeDebugInfoForwarding() on the backend. | 70 // EnableDirectoryTypeDebugInfoForwarding() on the engine. |
| 72 virtual void OnDirectoryTypeUpdateCounterUpdated( | 71 virtual void OnDirectoryTypeUpdateCounterUpdated( |
| 73 ModelType type, | 72 ModelType type, |
| 74 const UpdateCounters& counters) = 0; | 73 const UpdateCounters& counters) = 0; |
| 75 | 74 |
| 76 // Called when we receive an updated status counter for a datatype. | 75 // Called when we receive an updated status counter for a datatype. |
| 77 // | 76 // |
| 78 // Disabled by default. Enable by calling | 77 // Disabled by default. Enable by calling |
| 79 // EnableDirectoryTypeDebugInfoForwarding() on the backend. | 78 // EnableDirectoryTypeDebugInfoForwarding() on the engine. |
| 80 virtual void OnDatatypeStatusCounterUpdated( | 79 virtual void OnDatatypeStatusCounterUpdated( |
| 81 ModelType type, | 80 ModelType type, |
| 82 const StatusCounters& counters) = 0; | 81 const StatusCounters& counters) = 0; |
| 83 | 82 |
| 84 // The status of the connection to the sync server has changed. | 83 // The status of the connection to the sync server has changed. |
| 85 virtual void OnConnectionStatusChange(ConnectionStatus status) = 0; | 84 virtual void OnConnectionStatusChange(ConnectionStatus status) = 0; |
| 86 | 85 |
| 87 // The syncer requires a passphrase to decrypt sensitive updates. This is | 86 // The syncer requires a passphrase to decrypt sensitive updates. This is |
| 88 // called when the first sensitive data type is setup by the user and anytime | 87 // called when the first sensitive data type is setup by the user and anytime |
| 89 // the passphrase is changed by another synced client. |reason| denotes why | 88 // the passphrase is changed by another synced client. |reason| denotes why |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Called when new datatypes are available for registration. | 123 // Called when new datatypes are available for registration. |
| 125 virtual void OnExperimentsChanged(const Experiments& experiments) = 0; | 124 virtual void OnExperimentsChanged(const Experiments& experiments) = 0; |
| 126 | 125 |
| 127 // Called when the sync cycle returns there is an user actionable error. | 126 // Called when the sync cycle returns there is an user actionable error. |
| 128 virtual void OnActionableError(const SyncProtocolError& error) = 0; | 127 virtual void OnActionableError(const SyncProtocolError& error) = 0; |
| 129 | 128 |
| 130 // Called when the user of this device enables passphrase encryption. | 129 // Called when the user of this device enables passphrase encryption. |
| 131 // | 130 // |
| 132 // |nigori_state| contains the new (post custom passphrase) encryption keys | 131 // |nigori_state| contains the new (post custom passphrase) encryption keys |
| 133 // and can be used to restore SyncEncryptionHandler's state across sync | 132 // and can be used to restore SyncEncryptionHandler's state across sync |
| 134 // backend instances. See also SyncEncryptionHandlerImpl::RestoreNigori. | 133 // engine instances. See also SyncEncryptionHandlerImpl::RestoreNigori. |
| 135 virtual void OnLocalSetPassphraseEncryption( | 134 virtual void OnLocalSetPassphraseEncryption( |
| 136 const SyncEncryptionHandler::NigoriState& nigori_state) = 0; | 135 const SyncEncryptionHandler::NigoriState& nigori_state) = 0; |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 } // namespace syncer | 138 } // namespace syncer |
| 140 | 139 |
| 141 #endif // COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_HOST_H_ | 140 #endif // COMPONENTS_SYNC_ENGINE_SYNC_ENGINE_HOST_H_ |
| OLD | NEW |