OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 5 #ifndef SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
6 #define SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 6 #define SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 public net::NetworkChangeNotifier::ConnectionTypeObserver, | 58 public net::NetworkChangeNotifier::ConnectionTypeObserver, |
59 public JsBackend, | 59 public JsBackend, |
60 public SyncEngineEventListener, | 60 public SyncEngineEventListener, |
61 public ServerConnectionEventListener, | 61 public ServerConnectionEventListener, |
62 public syncable::DirectoryChangeDelegate, | 62 public syncable::DirectoryChangeDelegate, |
63 public SyncEncryptionHandler::Observer, | 63 public SyncEncryptionHandler::Observer, |
64 public NudgeHandler { | 64 public NudgeHandler { |
65 public: | 65 public: |
66 // Create an uninitialized SyncManager. Callers must Init() before using. | 66 // Create an uninitialized SyncManager. Callers must Init() before using. |
67 explicit SyncManagerImpl(const std::string& name); | 67 explicit SyncManagerImpl(const std::string& name); |
68 virtual ~SyncManagerImpl(); | 68 ~SyncManagerImpl() override; |
69 | 69 |
70 // SyncManager implementation. | 70 // SyncManager implementation. |
71 virtual void Init(InitArgs* args) override; | 71 void Init(InitArgs* args) override; |
72 virtual ModelTypeSet InitialSyncEndedTypes() override; | 72 ModelTypeSet InitialSyncEndedTypes() override; |
73 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( | 73 ModelTypeSet GetTypesWithEmptyProgressMarkerToken( |
74 ModelTypeSet types) override; | 74 ModelTypeSet types) override; |
75 virtual bool PurgePartiallySyncedTypes() override; | 75 bool PurgePartiallySyncedTypes() override; |
76 virtual void UpdateCredentials(const SyncCredentials& credentials) override; | 76 void UpdateCredentials(const SyncCredentials& credentials) override; |
77 virtual void StartSyncingNormally( | 77 void StartSyncingNormally(const ModelSafeRoutingInfo& routing_info) override; |
78 const ModelSafeRoutingInfo& routing_info) override; | 78 void ConfigureSyncer(ConfigureReason reason, |
79 virtual void ConfigureSyncer( | 79 ModelTypeSet to_download, |
80 ConfigureReason reason, | 80 ModelTypeSet to_purge, |
81 ModelTypeSet to_download, | 81 ModelTypeSet to_journal, |
82 ModelTypeSet to_purge, | 82 ModelTypeSet to_unapply, |
83 ModelTypeSet to_journal, | 83 const ModelSafeRoutingInfo& new_routing_info, |
84 ModelTypeSet to_unapply, | 84 const base::Closure& ready_task, |
85 const ModelSafeRoutingInfo& new_routing_info, | 85 const base::Closure& retry_task) override; |
86 const base::Closure& ready_task, | 86 void SetInvalidatorEnabled(bool invalidator_enabled) override; |
87 const base::Closure& retry_task) override; | 87 void OnIncomingInvalidation( |
88 virtual void SetInvalidatorEnabled(bool invalidator_enabled) override; | |
89 virtual void OnIncomingInvalidation( | |
90 syncer::ModelType type, | 88 syncer::ModelType type, |
91 scoped_ptr<InvalidationInterface> invalidation) override; | 89 scoped_ptr<InvalidationInterface> invalidation) override; |
92 virtual void AddObserver(SyncManager::Observer* observer) override; | 90 void AddObserver(SyncManager::Observer* observer) override; |
93 virtual void RemoveObserver(SyncManager::Observer* observer) override; | 91 void RemoveObserver(SyncManager::Observer* observer) override; |
94 virtual SyncStatus GetDetailedStatus() const override; | 92 SyncStatus GetDetailedStatus() const override; |
95 virtual void SaveChanges() override; | 93 void SaveChanges() override; |
96 virtual void ShutdownOnSyncThread(ShutdownReason reason) override; | 94 void ShutdownOnSyncThread(ShutdownReason reason) override; |
97 virtual UserShare* GetUserShare() override; | 95 UserShare* GetUserShare() override; |
98 virtual syncer::SyncContextProxy* GetSyncContextProxy() override; | 96 syncer::SyncContextProxy* GetSyncContextProxy() override; |
99 virtual const std::string cache_guid() override; | 97 const std::string cache_guid() override; |
100 virtual bool ReceivedExperiment(Experiments* experiments) override; | 98 bool ReceivedExperiment(Experiments* experiments) override; |
101 virtual bool HasUnsyncedItems() override; | 99 bool HasUnsyncedItems() override; |
102 virtual SyncEncryptionHandler* GetEncryptionHandler() override; | 100 SyncEncryptionHandler* GetEncryptionHandler() override; |
103 virtual ScopedVector<syncer::ProtocolEvent> | 101 ScopedVector<syncer::ProtocolEvent> GetBufferedProtocolEvents() override; |
104 GetBufferedProtocolEvents() override; | 102 scoped_ptr<base::ListValue> GetAllNodesForType( |
105 virtual scoped_ptr<base::ListValue> GetAllNodesForType( | |
106 syncer::ModelType type) override; | 103 syncer::ModelType type) override; |
107 virtual void RegisterDirectoryTypeDebugInfoObserver( | 104 void RegisterDirectoryTypeDebugInfoObserver( |
108 syncer::TypeDebugInfoObserver* observer) override; | 105 syncer::TypeDebugInfoObserver* observer) override; |
109 virtual void UnregisterDirectoryTypeDebugInfoObserver( | 106 void UnregisterDirectoryTypeDebugInfoObserver( |
110 syncer::TypeDebugInfoObserver* observer) override; | 107 syncer::TypeDebugInfoObserver* observer) override; |
111 virtual bool HasDirectoryTypeDebugInfoObserver( | 108 bool HasDirectoryTypeDebugInfoObserver( |
112 syncer::TypeDebugInfoObserver* observer) override; | 109 syncer::TypeDebugInfoObserver* observer) override; |
113 virtual void RequestEmitDebugInfo() override; | 110 void RequestEmitDebugInfo() override; |
114 | 111 |
115 // SyncEncryptionHandler::Observer implementation. | 112 // SyncEncryptionHandler::Observer implementation. |
116 virtual void OnPassphraseRequired( | 113 void OnPassphraseRequired( |
117 PassphraseRequiredReason reason, | 114 PassphraseRequiredReason reason, |
118 const sync_pb::EncryptedData& pending_keys) override; | 115 const sync_pb::EncryptedData& pending_keys) override; |
119 virtual void OnPassphraseAccepted() override; | 116 void OnPassphraseAccepted() override; |
120 virtual void OnBootstrapTokenUpdated( | 117 void OnBootstrapTokenUpdated(const std::string& bootstrap_token, |
121 const std::string& bootstrap_token, | 118 BootstrapTokenType type) override; |
122 BootstrapTokenType type) override; | 119 void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, |
123 virtual void OnEncryptedTypesChanged( | 120 bool encrypt_everything) override; |
124 ModelTypeSet encrypted_types, | 121 void OnEncryptionComplete() override; |
125 bool encrypt_everything) override; | 122 void OnCryptographerStateChanged(Cryptographer* cryptographer) override; |
126 virtual void OnEncryptionComplete() override; | 123 void OnPassphraseTypeChanged(PassphraseType type, |
127 virtual void OnCryptographerStateChanged( | 124 base::Time explicit_passphrase_time) override; |
128 Cryptographer* cryptographer) override; | |
129 virtual void OnPassphraseTypeChanged( | |
130 PassphraseType type, | |
131 base::Time explicit_passphrase_time) override; | |
132 | 125 |
133 // SyncEngineEventListener implementation. | 126 // SyncEngineEventListener implementation. |
134 virtual void OnSyncCycleEvent(const SyncCycleEvent& event) override; | 127 void OnSyncCycleEvent(const SyncCycleEvent& event) override; |
135 virtual void OnActionableError(const SyncProtocolError& error) override; | 128 void OnActionableError(const SyncProtocolError& error) override; |
136 virtual void OnRetryTimeChanged(base::Time retry_time) override; | 129 void OnRetryTimeChanged(base::Time retry_time) override; |
137 virtual void OnThrottledTypesChanged(ModelTypeSet throttled_types) override; | 130 void OnThrottledTypesChanged(ModelTypeSet throttled_types) override; |
138 virtual void OnMigrationRequested(ModelTypeSet types) override; | 131 void OnMigrationRequested(ModelTypeSet types) override; |
139 virtual void OnProtocolEvent(const ProtocolEvent& event) override; | 132 void OnProtocolEvent(const ProtocolEvent& event) override; |
140 | 133 |
141 // ServerConnectionEventListener implementation. | 134 // ServerConnectionEventListener implementation. |
142 virtual void OnServerConnectionEvent( | 135 void OnServerConnectionEvent(const ServerConnectionEvent& event) override; |
143 const ServerConnectionEvent& event) override; | |
144 | 136 |
145 // JsBackend implementation. | 137 // JsBackend implementation. |
146 virtual void SetJsEventHandler( | 138 void SetJsEventHandler( |
147 const WeakHandle<JsEventHandler>& event_handler) override; | 139 const WeakHandle<JsEventHandler>& event_handler) override; |
148 | 140 |
149 // DirectoryChangeDelegate implementation. | 141 // DirectoryChangeDelegate implementation. |
150 // This listener is called upon completion of a syncable transaction, and | 142 // This listener is called upon completion of a syncable transaction, and |
151 // builds the list of sync-engine initiated changes that will be forwarded to | 143 // builds the list of sync-engine initiated changes that will be forwarded to |
152 // the SyncManager's Observers. | 144 // the SyncManager's Observers. |
153 virtual void HandleTransactionCompleteChangeEvent( | 145 void HandleTransactionCompleteChangeEvent( |
154 ModelTypeSet models_with_changes) override; | 146 ModelTypeSet models_with_changes) override; |
155 virtual ModelTypeSet HandleTransactionEndingChangeEvent( | 147 ModelTypeSet HandleTransactionEndingChangeEvent( |
156 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 148 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
157 syncable::BaseTransaction* trans) override; | 149 syncable::BaseTransaction* trans) override; |
158 virtual void HandleCalculateChangesChangeEventFromSyncApi( | 150 void HandleCalculateChangesChangeEventFromSyncApi( |
159 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 151 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
160 syncable::BaseTransaction* trans, | 152 syncable::BaseTransaction* trans, |
161 std::vector<int64>* entries_changed) override; | 153 std::vector<int64>* entries_changed) override; |
162 virtual void HandleCalculateChangesChangeEventFromSyncer( | 154 void HandleCalculateChangesChangeEventFromSyncer( |
163 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, | 155 const syncable::ImmutableWriteTransactionInfo& write_transaction_info, |
164 syncable::BaseTransaction* trans, | 156 syncable::BaseTransaction* trans, |
165 std::vector<int64>* entries_changed) override; | 157 std::vector<int64>* entries_changed) override; |
166 | 158 |
167 // Handle explicit requests to fetch updates for the given types. | 159 // Handle explicit requests to fetch updates for the given types. |
168 virtual void RefreshTypes(ModelTypeSet types) override; | 160 void RefreshTypes(ModelTypeSet types) override; |
169 | 161 |
170 // These OnYYYChanged() methods are only called by our NetworkChangeNotifier. | 162 // These OnYYYChanged() methods are only called by our NetworkChangeNotifier. |
171 // Called when IP address of primary interface changes. | 163 // Called when IP address of primary interface changes. |
172 virtual void OnIPAddressChanged() override; | 164 void OnIPAddressChanged() override; |
173 // Called when the connection type of the system has changed. | 165 // Called when the connection type of the system has changed. |
174 virtual void OnConnectionTypeChanged( | 166 void OnConnectionTypeChanged( |
175 net::NetworkChangeNotifier::ConnectionType) override; | 167 net::NetworkChangeNotifier::ConnectionType) override; |
176 | 168 |
177 // NudgeHandler implementation. | 169 // NudgeHandler implementation. |
178 virtual void NudgeForInitialDownload(syncer::ModelType type) override; | 170 void NudgeForInitialDownload(syncer::ModelType type) override; |
179 virtual void NudgeForCommit(syncer::ModelType type) override; | 171 void NudgeForCommit(syncer::ModelType type) override; |
180 virtual void NudgeForRefresh(syncer::ModelType type) override; | 172 void NudgeForRefresh(syncer::ModelType type) override; |
181 | 173 |
182 const SyncScheduler* scheduler() const; | 174 const SyncScheduler* scheduler() const; |
183 | 175 |
184 bool GetHasInvalidAuthTokenForTest() const; | 176 bool GetHasInvalidAuthTokenForTest() const; |
185 | 177 |
186 protected: | 178 protected: |
187 // Helper functions. Virtual for testing. | 179 // Helper functions. Virtual for testing. |
188 virtual void NotifyInitializationSuccess(); | 180 virtual void NotifyInitializationSuccess(); |
189 virtual void NotifyInitializationFailure(); | 181 virtual void NotifyInitializationFailure(); |
190 | 182 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; | 337 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; |
346 | 338 |
347 base::WeakPtrFactory<SyncManagerImpl> weak_ptr_factory_; | 339 base::WeakPtrFactory<SyncManagerImpl> weak_ptr_factory_; |
348 | 340 |
349 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); | 341 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); |
350 }; | 342 }; |
351 | 343 |
352 } // namespace syncer | 344 } // namespace syncer |
353 | 345 |
354 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 346 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
OLD | NEW |