| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/task_runner.h" | 15 #include "base/task_runner.h" |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "sync/internal_api/public/base/model_type.h" | 18 #include "sync/internal_api/public/base/model_type.h" |
| 19 #include "sync/internal_api/public/change_record.h" | 19 #include "sync/internal_api/public/change_record.h" |
| 20 #include "sync/internal_api/public/configure_reason.h" | 20 #include "sync/internal_api/public/configure_reason.h" |
| 21 #include "sync/internal_api/public/engine/model_safe_worker.h" | 21 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 22 #include "sync/internal_api/public/engine/sync_status.h" | 22 #include "sync/internal_api/public/engine/sync_status.h" |
| 23 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" | 23 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" |
| 24 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" | |
| 25 #include "sync/internal_api/public/util/weak_handle.h" | 24 #include "sync/internal_api/public/util/weak_handle.h" |
| 26 #include "sync/protocol/sync_protocol_error.h" | 25 #include "sync/protocol/sync_protocol_error.h" |
| 27 | 26 |
| 28 namespace syncer { | 27 namespace syncer { |
| 29 class Encryptor; | 28 class Encryptor; |
| 30 struct Experiments; | 29 struct Experiments; |
| 31 class ExtensionsActivityMonitor; | 30 class ExtensionsActivityMonitor; |
| 31 class InternalComponentsFactory; |
| 32 class JsBackend; | 32 class JsBackend; |
| 33 class JsEventHandler; | 33 class JsEventHandler; |
| 34 class SyncScheduler; | 34 class SyncScheduler; |
| 35 class UnrecoverableErrorHandler; |
| 35 | 36 |
| 36 namespace sessions { | 37 namespace sessions { |
| 37 class SyncSessionSnapshot; | 38 class SyncSessionSnapshot; |
| 38 } // namespace sessions | 39 } // namespace sessions |
| 39 } // namespace syncer | 40 } // namespace syncer |
| 40 | 41 |
| 41 namespace syncer { | 42 namespace syncer { |
| 42 class SyncNotifier; | 43 class SyncNotifier; |
| 43 } // namespace syncer | 44 } // namespace syncer |
| 44 | 45 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 // Called from within a transaction. | 331 // Called from within a transaction. |
| 331 virtual void OnEncryptionComplete() = 0; | 332 virtual void OnEncryptionComplete() = 0; |
| 332 | 333 |
| 333 virtual void OnActionableError( | 334 virtual void OnActionableError( |
| 334 const syncer::SyncProtocolError& sync_protocol_error) = 0; | 335 const syncer::SyncProtocolError& sync_protocol_error) = 0; |
| 335 | 336 |
| 336 protected: | 337 protected: |
| 337 virtual ~Observer(); | 338 virtual ~Observer(); |
| 338 }; | 339 }; |
| 339 | 340 |
| 340 enum TestingMode { | |
| 341 NON_TEST, | |
| 342 TEST_ON_DISK, | |
| 343 TEST_IN_MEMORY, | |
| 344 }; | |
| 345 | |
| 346 SyncManager(); | 341 SyncManager(); |
| 347 virtual ~SyncManager(); | 342 virtual ~SyncManager(); |
| 348 | 343 |
| 349 // Initialize the sync manager. |database_location| specifies the path of | 344 // Initialize the sync manager. |database_location| specifies the path of |
| 350 // the directory in which to locate a sqlite repository storing the syncer | 345 // the directory in which to locate a sqlite repository storing the syncer |
| 351 // backend state. Initialization will open the database, or create it if it | 346 // backend state. Initialization will open the database, or create it if it |
| 352 // does not already exist. Returns false on failure. | 347 // does not already exist. Returns false on failure. |
| 353 // |event_handler| is the JsEventHandler used to propagate events to | 348 // |event_handler| is the JsEventHandler used to propagate events to |
| 354 // chrome://sync-internals. |event_handler| may be uninitialized. | 349 // chrome://sync-internals. |event_handler| may be uninitialized. |
| 355 // |sync_server_and_path| and |sync_server_port| represent the Chrome sync | 350 // |sync_server_and_path| and |sync_server_port| represent the Chrome sync |
| (...skipping 19 matching lines...) Expand all Loading... |
| 375 bool use_ssl, | 370 bool use_ssl, |
| 376 const scoped_refptr<base::TaskRunner>& blocking_task_runner, | 371 const scoped_refptr<base::TaskRunner>& blocking_task_runner, |
| 377 scoped_ptr<HttpPostProviderFactory> post_factory, | 372 scoped_ptr<HttpPostProviderFactory> post_factory, |
| 378 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, | 373 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, |
| 379 const std::vector<syncer::ModelSafeWorker*>& workers, | 374 const std::vector<syncer::ModelSafeWorker*>& workers, |
| 380 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, | 375 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, |
| 381 ChangeDelegate* change_delegate, | 376 ChangeDelegate* change_delegate, |
| 382 const SyncCredentials& credentials, | 377 const SyncCredentials& credentials, |
| 383 scoped_ptr<syncer::SyncNotifier> sync_notifier, | 378 scoped_ptr<syncer::SyncNotifier> sync_notifier, |
| 384 const std::string& restored_key_for_bootstrapping, | 379 const std::string& restored_key_for_bootstrapping, |
| 385 TestingMode testing_mode, | 380 scoped_ptr<InternalComponentsFactory> internal_components_factory, |
| 386 syncer::Encryptor* encryptor, | 381 syncer::Encryptor* encryptor, |
| 387 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, | 382 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, |
| 388 syncer::ReportUnrecoverableErrorFunction | 383 syncer::ReportUnrecoverableErrorFunction |
| 389 report_unrecoverable_error_function) = 0; | 384 report_unrecoverable_error_function) = 0; |
| 390 | 385 |
| 391 // Throw an unrecoverable error from a transaction (mostly used for | 386 // Throw an unrecoverable error from a transaction (mostly used for |
| 392 // testing). | 387 // testing). |
| 393 virtual void ThrowUnrecoverableError() = 0; | 388 virtual void ThrowUnrecoverableError() = 0; |
| 394 | 389 |
| 395 virtual syncer::ModelTypeSet InitialSyncEndedTypes() = 0; | 390 virtual syncer::ModelTypeSet InitialSyncEndedTypes() = 0; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 virtual bool ReceivedExperiment(syncer::Experiments* experiments) const = 0; | 511 virtual bool ReceivedExperiment(syncer::Experiments* experiments) const = 0; |
| 517 | 512 |
| 518 // Uses a read-only transaction to determine if the directory being synced has | 513 // Uses a read-only transaction to determine if the directory being synced has |
| 519 // any remaining unsynced items. May be called on any thread. | 514 // any remaining unsynced items. May be called on any thread. |
| 520 virtual bool HasUnsyncedItems() const = 0; | 515 virtual bool HasUnsyncedItems() const = 0; |
| 521 }; | 516 }; |
| 522 | 517 |
| 523 } // namespace syncer | 518 } // namespace syncer |
| 524 | 519 |
| 525 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 520 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ |
| OLD | NEW |