OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 explicit SyncManagerImpl(const std::string& name); | 59 explicit SyncManagerImpl(const std::string& name); |
60 virtual ~SyncManagerImpl(); | 60 virtual ~SyncManagerImpl(); |
61 | 61 |
62 // SyncManager implementation. | 62 // SyncManager implementation. |
63 virtual void Init( | 63 virtual void Init( |
64 const FilePath& database_location, | 64 const FilePath& database_location, |
65 const WeakHandle<JsEventHandler>& event_handler, | 65 const WeakHandle<JsEventHandler>& event_handler, |
66 const std::string& sync_server_and_path, | 66 const std::string& sync_server_and_path, |
67 int sync_server_port, | 67 int sync_server_port, |
68 bool use_ssl, | 68 bool use_ssl, |
69 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | |
70 scoped_ptr<HttpPostProviderFactory> post_factory, | 69 scoped_ptr<HttpPostProviderFactory> post_factory, |
71 const std::vector<ModelSafeWorker*>& workers, | 70 const std::vector<ModelSafeWorker*>& workers, |
72 ExtensionsActivityMonitor* extensions_activity_monitor, | 71 ExtensionsActivityMonitor* extensions_activity_monitor, |
73 SyncManager::ChangeDelegate* change_delegate, | 72 SyncManager::ChangeDelegate* change_delegate, |
74 const SyncCredentials& credentials, | 73 const SyncCredentials& credentials, |
75 scoped_ptr<Invalidator> invalidator, | 74 scoped_ptr<Invalidator> invalidator, |
76 const std::string& restored_key_for_bootstrapping, | 75 const std::string& restored_key_for_bootstrapping, |
77 const std::string& restored_keystore_key_for_bootstrapping, | 76 const std::string& restored_keystore_key_for_bootstrapping, |
78 scoped_ptr<InternalComponentsFactory> internal_components_factory, | 77 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
79 Encryptor* encryptor, | 78 Encryptor* encryptor, |
(...skipping 22 matching lines...) Expand all Loading... | |
102 const ModelSafeRoutingInfo& new_routing_info, | 101 const ModelSafeRoutingInfo& new_routing_info, |
103 const base::Closure& ready_task, | 102 const base::Closure& ready_task, |
104 const base::Closure& retry_task) OVERRIDE; | 103 const base::Closure& retry_task) OVERRIDE; |
105 virtual void AddObserver(SyncManager::Observer* observer) OVERRIDE; | 104 virtual void AddObserver(SyncManager::Observer* observer) OVERRIDE; |
106 virtual void RemoveObserver(SyncManager::Observer* observer) OVERRIDE; | 105 virtual void RemoveObserver(SyncManager::Observer* observer) OVERRIDE; |
107 virtual SyncStatus GetDetailedStatus() const OVERRIDE; | 106 virtual SyncStatus GetDetailedStatus() const OVERRIDE; |
108 virtual void SaveChanges() OVERRIDE; | 107 virtual void SaveChanges() OVERRIDE; |
109 virtual void StopSyncingForShutdown(const base::Closure& callback) OVERRIDE; | 108 virtual void StopSyncingForShutdown(const base::Closure& callback) OVERRIDE; |
110 virtual void ShutdownOnSyncThread() OVERRIDE; | 109 virtual void ShutdownOnSyncThread() OVERRIDE; |
111 virtual UserShare* GetUserShare() OVERRIDE; | 110 virtual UserShare* GetUserShare() OVERRIDE; |
111 | |
Nicolas Zea
2012/09/13 00:45:55
remove newline
rlarocque
2012/09/14 01:03:07
Done.
| |
112 virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; | 112 virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE; |
113 virtual bool HasUnsyncedItems() OVERRIDE; | 113 virtual bool HasUnsyncedItems() OVERRIDE; |
114 virtual SyncEncryptionHandler* GetEncryptionHandler() OVERRIDE; | 114 virtual SyncEncryptionHandler* GetEncryptionHandler() OVERRIDE; |
115 | 115 |
116 // SyncEncryptionHandler::Observer implementation. | 116 // SyncEncryptionHandler::Observer implementation. |
117 virtual void OnPassphraseRequired( | 117 virtual void OnPassphraseRequired( |
118 PassphraseRequiredReason reason, | 118 PassphraseRequiredReason reason, |
119 const sync_pb::EncryptedData& pending_keys) OVERRIDE; | 119 const sync_pb::EncryptedData& pending_keys) OVERRIDE; |
120 virtual void OnPassphraseAccepted() OVERRIDE; | 120 virtual void OnPassphraseAccepted() OVERRIDE; |
121 virtual void OnBootstrapTokenUpdated( | 121 virtual void OnBootstrapTokenUpdated( |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 // ExtraPasswordChangeRecordData field of |buffer|. Otherwise sets | 239 // ExtraPasswordChangeRecordData field of |buffer|. Otherwise sets |
240 // |buffer|'s specifics field to contain the unencrypted data. | 240 // |buffer|'s specifics field to contain the unencrypted data. |
241 void SetExtraChangeRecordData(int64 id, | 241 void SetExtraChangeRecordData(int64 id, |
242 ModelType type, | 242 ModelType type, |
243 ChangeReorderBuffer* buffer, | 243 ChangeReorderBuffer* buffer, |
244 Cryptographer* cryptographer, | 244 Cryptographer* cryptographer, |
245 const syncable::EntryKernel& original, | 245 const syncable::EntryKernel& original, |
246 bool existed_before, | 246 bool existed_before, |
247 bool exists_now); | 247 bool exists_now); |
248 | 248 |
249 // Internal callback used by GetSessionName. | |
250 // TODO(rlarocque): not currently called from anywhere. This should be | |
251 // hooked up to something once we start preserving device information again. | |
252 void UpdateSessionNameCallback(const std::string& chrome_version, | |
253 const std::string& session_name); | |
254 | |
255 // Called for every notification. This updates the notification statistics | 249 // Called for every notification. This updates the notification statistics |
256 // to be displayed in about:sync. | 250 // to be displayed in about:sync. |
257 void UpdateNotificationInfo( | 251 void UpdateNotificationInfo(const ModelTypeStateMap& type_state_map); |
258 const ModelTypeStateMap& type_state_map); | |
259 | 252 |
260 // Checks for server reachabilty and requests a nudge. | 253 // Checks for server reachabilty and requests a nudge. |
261 void OnIPAddressChangedImpl(); | 254 void OnIPAddressChangedImpl(); |
262 | 255 |
263 // Helper function used only by the constructor. | 256 // Helper function used only by the constructor. |
264 void BindJsMessageHandler( | 257 void BindJsMessageHandler( |
265 const std::string& name, UnboundJsMessageHandler unbound_message_handler); | 258 const std::string& name, UnboundJsMessageHandler unbound_message_handler); |
266 | 259 |
267 // Helper function used by OnNotifications{Enabled,Disabled}(). | 260 // Helper function used by OnNotifications{Enabled,Disabled}(). |
268 void OnNotificationStateChange(NotificationsDisabledReason reason); | 261 void OnNotificationStateChange(NotificationsDisabledReason reason); |
(...skipping 29 matching lines...) Expand all Loading... | |
298 // HandleCalculateChangesChangeEventFromSyncApi(), which can be | 291 // HandleCalculateChangesChangeEventFromSyncApi(), which can be |
299 // called from any thread. Valid only between between calls to | 292 // called from any thread. Valid only between between calls to |
300 // Init() and Shutdown(). | 293 // Init() and Shutdown(). |
301 // | 294 // |
302 // TODO(akalin): Ideally, we wouldn't need to store this; instead, | 295 // TODO(akalin): Ideally, we wouldn't need to store this; instead, |
303 // we'd have another worker class which implements | 296 // we'd have another worker class which implements |
304 // HandleCalculateChangesChangeEventFromSyncApi() and we'd pass it a | 297 // HandleCalculateChangesChangeEventFromSyncApi() and we'd pass it a |
305 // WeakHandle when we construct it. | 298 // WeakHandle when we construct it. |
306 WeakHandle<SyncManagerImpl> weak_handle_this_; | 299 WeakHandle<SyncManagerImpl> weak_handle_this_; |
307 | 300 |
308 // |blocking_task_runner| is a TaskRunner to be used for tasks that | |
309 // may block on disk I/O. | |
310 scoped_refptr<base::TaskRunner> blocking_task_runner_; | |
311 | |
312 // We give a handle to share_ to clients of the API for use when constructing | 301 // We give a handle to share_ to clients of the API for use when constructing |
313 // any transaction type. | 302 // any transaction type. |
314 UserShare share_; | 303 UserShare share_; |
315 | 304 |
316 // This can be called from any thread, but only between calls to | 305 // This can be called from any thread, but only between calls to |
317 // OpenDirectory() and ShutdownOnSyncThread(). | 306 // OpenDirectory() and ShutdownOnSyncThread(). |
318 WeakHandle<SyncManager::ChangeObserver> change_observer_; | 307 WeakHandle<SyncManager::ChangeObserver> change_observer_; |
319 | 308 |
320 ObserverList<SyncManager::Observer> observers_; | 309 ObserverList<SyncManager::Observer> observers_; |
321 | 310 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 // changing passphrases, and in general handles sync-specific interactions | 370 // changing passphrases, and in general handles sync-specific interactions |
382 // with the cryptographer. | 371 // with the cryptographer. |
383 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; | 372 scoped_ptr<SyncEncryptionHandlerImpl> sync_encryption_handler_; |
384 | 373 |
385 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); | 374 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); |
386 }; | 375 }; |
387 | 376 |
388 } // namespace syncer | 377 } // namespace syncer |
389 | 378 |
390 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ | 379 #endif // SYNC_INTERNAL_API_SYNC_MANAGER_H_ |
OLD | NEW |