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_PUBLIC_SYNC_MANAGER_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 278 |
279 // Initialize the sync manager. |database_location| specifies the path of | 279 // Initialize the sync manager. |database_location| specifies the path of |
280 // the directory in which to locate a sqlite repository storing the syncer | 280 // the directory in which to locate a sqlite repository storing the syncer |
281 // backend state. Initialization will open the database, or create it if it | 281 // backend state. Initialization will open the database, or create it if it |
282 // does not already exist. Returns false on failure. | 282 // does not already exist. Returns false on failure. |
283 // |event_handler| is the JsEventHandler used to propagate events to | 283 // |event_handler| is the JsEventHandler used to propagate events to |
284 // chrome://sync-internals. |event_handler| may be uninitialized. | 284 // chrome://sync-internals. |event_handler| may be uninitialized. |
285 // |sync_server_and_path| and |sync_server_port| represent the Chrome sync | 285 // |sync_server_and_path| and |sync_server_port| represent the Chrome sync |
286 // server to use, and |use_ssl| specifies whether to communicate securely; | 286 // server to use, and |use_ssl| specifies whether to communicate securely; |
287 // the default is false. | 287 // the default is false. |
288 // |blocking_task_runner| is a TaskRunner to be used for tasks that | |
289 // may block on disk I/O. | |
290 // |post_factory| will be owned internally and used to create | 288 // |post_factory| will be owned internally and used to create |
291 // instances of an HttpPostProvider. | 289 // instances of an HttpPostProvider. |
292 // |model_safe_worker| ownership is given to the SyncManager. | 290 // |model_safe_worker| ownership is given to the SyncManager. |
293 // |user_agent| is a 7-bit ASCII string suitable for use as the User-Agent | 291 // |user_agent| is a 7-bit ASCII string suitable for use as the User-Agent |
294 // HTTP header. Used internally when collecting stats to classify clients. | 292 // HTTP header. Used internally when collecting stats to classify clients. |
295 // |invalidator| is owned and used to listen for invalidations. | 293 // |invalidator| is owned and used to listen for invalidations. |
296 // |restored_key_for_bootstrapping| is the key used to boostrap the | 294 // |restored_key_for_bootstrapping| is the key used to boostrap the |
297 // cryptographer | 295 // cryptographer |
298 // |keystore_encryption_enabled| determines whether we enable the keystore | 296 // |keystore_encryption_enabled| determines whether we enable the keystore |
299 // encryption functionality in the cryptographer/nigori. | 297 // encryption functionality in the cryptographer/nigori. |
300 // |report_unrecoverable_error_function| may be NULL. | 298 // |report_unrecoverable_error_function| may be NULL. |
301 // | 299 // |
302 // TODO(akalin): Replace the |post_factory| parameter with a | 300 // TODO(akalin): Replace the |post_factory| parameter with a |
303 // URLFetcher parameter. | 301 // URLFetcher parameter. |
304 virtual void Init( | 302 virtual void Init( |
305 const FilePath& database_location, | 303 const FilePath& database_location, |
306 const WeakHandle<JsEventHandler>& event_handler, | 304 const WeakHandle<JsEventHandler>& event_handler, |
307 const std::string& sync_server_and_path, | 305 const std::string& sync_server_and_path, |
308 int sync_server_port, | 306 int sync_server_port, |
309 bool use_ssl, | 307 bool use_ssl, |
310 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | |
311 scoped_ptr<HttpPostProviderFactory> post_factory, | 308 scoped_ptr<HttpPostProviderFactory> post_factory, |
312 const std::vector<ModelSafeWorker*>& workers, | 309 const std::vector<ModelSafeWorker*>& workers, |
313 ExtensionsActivityMonitor* extensions_activity_monitor, | 310 ExtensionsActivityMonitor* extensions_activity_monitor, |
314 ChangeDelegate* change_delegate, | 311 ChangeDelegate* change_delegate, |
315 const SyncCredentials& credentials, | 312 const SyncCredentials& credentials, |
316 scoped_ptr<Invalidator> invalidator, | 313 scoped_ptr<Invalidator> invalidator, |
317 const std::string& restored_key_for_bootstrapping, | 314 const std::string& restored_key_for_bootstrapping, |
318 const std::string& restored_keystore_key_for_bootstrapping, | 315 const std::string& restored_keystore_key_for_bootstrapping, |
319 scoped_ptr<InternalComponentsFactory> internal_components_factory, | 316 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
320 Encryptor* encryptor, | 317 Encryptor* encryptor, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 // this was created on, which is the sync loop), as sync is effectively | 399 // this was created on, which is the sync loop), as sync is effectively |
403 // stopped. | 400 // stopped. |
404 virtual void StopSyncingForShutdown(const base::Closure& callback) = 0; | 401 virtual void StopSyncingForShutdown(const base::Closure& callback) = 0; |
405 | 402 |
406 // Issue a final SaveChanges, and close sqlite handles. | 403 // Issue a final SaveChanges, and close sqlite handles. |
407 virtual void ShutdownOnSyncThread() = 0; | 404 virtual void ShutdownOnSyncThread() = 0; |
408 | 405 |
409 // May be called from any thread. | 406 // May be called from any thread. |
410 virtual UserShare* GetUserShare() = 0; | 407 virtual UserShare* GetUserShare() = 0; |
411 | 408 |
| 409 // Returns the cache_guid of the currently open database. |
| 410 // Requires that the SyncManager be initialized. |
| 411 virtual const std::string cache_guid() = 0; |
| 412 |
412 // Reads the nigori node to determine if any experimental features should | 413 // Reads the nigori node to determine if any experimental features should |
413 // be enabled. | 414 // be enabled. |
414 // Note: opens a transaction. May be called on any thread. | 415 // Note: opens a transaction. May be called on any thread. |
415 virtual bool ReceivedExperiment(Experiments* experiments) = 0; | 416 virtual bool ReceivedExperiment(Experiments* experiments) = 0; |
416 | 417 |
417 // Uses a read-only transaction to determine if the directory being synced has | 418 // Uses a read-only transaction to determine if the directory being synced has |
418 // any remaining unsynced items. May be called on any thread. | 419 // any remaining unsynced items. May be called on any thread. |
419 virtual bool HasUnsyncedItems() = 0; | 420 virtual bool HasUnsyncedItems() = 0; |
420 | 421 |
421 // Returns the SyncManager's encryption handler. | 422 // Returns the SyncManager's encryption handler. |
422 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; | 423 virtual SyncEncryptionHandler* GetEncryptionHandler() = 0; |
423 }; | 424 }; |
424 | 425 |
425 } // namespace syncer | 426 } // namespace syncer |
426 | 427 |
427 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 428 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ |
OLD | NEW |