Index: components/sync/driver/glue/sync_backend_host_core.h |
diff --git a/components/sync/driver/glue/sync_backend_host_core.h b/components/sync/driver/glue/sync_backend_host_core.h |
index ff914feee088558b10084d0905f604bad6e74d48..fd3563e39389394f41a269adb30ab3dcf7ef68db 100644 |
--- a/components/sync/driver/glue/sync_backend_host_core.h |
+++ b/components/sync/driver/glue/sync_backend_host_core.h |
@@ -23,7 +23,7 @@ |
#include "components/sync/engine/cycle/type_debug_info_observer.h" |
#include "url/gurl.h" |
-namespace syncer { |
+namespace browser_sync { |
class SyncBackendHostImpl; |
@@ -32,46 +32,52 @@ struct DoInitializeOptions { |
DoInitializeOptions( |
base::MessageLoop* sync_loop, |
SyncBackendRegistrar* registrar, |
- const std::vector<scoped_refptr<ModelSafeWorker>>& workers, |
- const scoped_refptr<ExtensionsActivity>& extensions_activity, |
- const WeakHandle<JsEventHandler>& event_handler, |
+ const std::vector<scoped_refptr<syncer::ModelSafeWorker>>& workers, |
+ const scoped_refptr<syncer::ExtensionsActivity>& extensions_activity, |
+ const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, |
const GURL& service_url, |
const std::string& sync_user_agent, |
- std::unique_ptr<HttpPostProviderFactory> http_bridge_factory, |
- const SyncCredentials& credentials, |
+ std::unique_ptr<syncer::HttpPostProviderFactory> http_bridge_factory, |
+ const syncer::SyncCredentials& credentials, |
const std::string& invalidator_client_id, |
- std::unique_ptr<SyncManagerFactory> sync_manager_factory, |
+ std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory, |
bool delete_sync_data_folder, |
const std::string& restored_key_for_bootstrapping, |
const std::string& restored_keystore_key_for_bootstrapping, |
- std::unique_ptr<InternalComponentsFactory> internal_components_factory, |
- const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, |
+ std::unique_ptr<syncer::InternalComponentsFactory> |
+ internal_components_factory, |
+ const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>& |
+ unrecoverable_error_handler, |
const base::Closure& report_unrecoverable_error_function, |
- std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state, |
- const std::map<ModelType, int64_t>& invalidation_versions); |
+ std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState> |
+ saved_nigori_state, |
+ const std::map<syncer::ModelType, int64_t>& invalidation_versions); |
~DoInitializeOptions(); |
base::MessageLoop* sync_loop; |
SyncBackendRegistrar* registrar; |
- std::vector<scoped_refptr<ModelSafeWorker>> workers; |
- scoped_refptr<ExtensionsActivity> extensions_activity; |
- WeakHandle<JsEventHandler> event_handler; |
+ std::vector<scoped_refptr<syncer::ModelSafeWorker>> workers; |
+ scoped_refptr<syncer::ExtensionsActivity> extensions_activity; |
+ syncer::WeakHandle<syncer::JsEventHandler> event_handler; |
GURL service_url; |
std::string sync_user_agent; |
// Overridden by tests. |
- std::unique_ptr<HttpPostProviderFactory> http_bridge_factory; |
- SyncCredentials credentials; |
+ std::unique_ptr<syncer::HttpPostProviderFactory> http_bridge_factory; |
+ syncer::SyncCredentials credentials; |
const std::string invalidator_client_id; |
- std::unique_ptr<SyncManagerFactory> sync_manager_factory; |
+ std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory; |
std::string lsid; |
bool delete_sync_data_folder; |
std::string restored_key_for_bootstrapping; |
std::string restored_keystore_key_for_bootstrapping; |
- std::unique_ptr<InternalComponentsFactory> internal_components_factory; |
- const WeakHandle<UnrecoverableErrorHandler> unrecoverable_error_handler; |
+ std::unique_ptr<syncer::InternalComponentsFactory> |
+ internal_components_factory; |
+ const syncer::WeakHandle<syncer::UnrecoverableErrorHandler> |
+ unrecoverable_error_handler; |
base::Closure report_unrecoverable_error_function; |
- std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state; |
- const std::map<ModelType, int64_t> invalidation_versions; |
+ std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState> |
+ saved_nigori_state; |
+ const std::map<syncer::ModelType, int64_t> invalidation_versions; |
}; |
// Helper struct to handle currying params to |
@@ -80,17 +86,17 @@ struct DoConfigureSyncerTypes { |
DoConfigureSyncerTypes(); |
DoConfigureSyncerTypes(const DoConfigureSyncerTypes& other); |
~DoConfigureSyncerTypes(); |
- ModelTypeSet to_download; |
- ModelTypeSet to_purge; |
- ModelTypeSet to_journal; |
- ModelTypeSet to_unapply; |
+ syncer::ModelTypeSet to_download; |
+ syncer::ModelTypeSet to_purge; |
+ syncer::ModelTypeSet to_journal; |
+ syncer::ModelTypeSet to_unapply; |
}; |
class SyncBackendHostCore |
: public base::RefCountedThreadSafe<SyncBackendHostCore>, |
- public SyncEncryptionHandler::Observer, |
- public SyncManager::Observer, |
- public TypeDebugInfoObserver { |
+ public syncer::SyncEncryptionHandler::Observer, |
+ public syncer::SyncManager::Observer, |
+ public syncer::TypeDebugInfoObserver { |
public: |
SyncBackendHostCore(const std::string& name, |
const base::FilePath& sync_data_folder_path, |
@@ -100,47 +106,49 @@ class SyncBackendHostCore |
// SyncManager::Observer implementation. The Core just acts like an air |
// traffic controller here, forwarding incoming messages to appropriate |
// landing threads. |
- void OnSyncCycleCompleted(const SyncCycleSnapshot& snapshot) override; |
+ void OnSyncCycleCompleted(const syncer::SyncCycleSnapshot& snapshot) override; |
void OnInitializationComplete( |
- const WeakHandle<JsBackend>& js_backend, |
- const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, |
+ const syncer::WeakHandle<syncer::JsBackend>& js_backend, |
+ const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
+ debug_info_listener, |
bool success, |
- ModelTypeSet restored_types) override; |
- void OnConnectionStatusChange(ConnectionStatus status) override; |
- void OnActionableError(const SyncProtocolError& sync_error) override; |
- void OnMigrationRequested(ModelTypeSet types) override; |
- void OnProtocolEvent(const ProtocolEvent& event) override; |
+ syncer::ModelTypeSet restored_types) override; |
+ void OnConnectionStatusChange(syncer::ConnectionStatus status) override; |
+ void OnActionableError(const syncer::SyncProtocolError& sync_error) override; |
+ void OnMigrationRequested(syncer::ModelTypeSet types) override; |
+ void OnProtocolEvent(const syncer::ProtocolEvent& event) override; |
// SyncEncryptionHandler::Observer implementation. |
void OnPassphraseRequired( |
- PassphraseRequiredReason reason, |
+ syncer::PassphraseRequiredReason reason, |
const sync_pb::EncryptedData& pending_keys) override; |
void OnPassphraseAccepted() override; |
void OnBootstrapTokenUpdated(const std::string& bootstrap_token, |
- BootstrapTokenType type) override; |
- void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, |
+ syncer::BootstrapTokenType type) override; |
+ void OnEncryptedTypesChanged(syncer::ModelTypeSet encrypted_types, |
bool encrypt_everything) override; |
void OnEncryptionComplete() override; |
- void OnCryptographerStateChanged(Cryptographer* cryptographer) override; |
- void OnPassphraseTypeChanged(PassphraseType type, |
+ void OnCryptographerStateChanged( |
+ syncer::Cryptographer* cryptographer) override; |
+ void OnPassphraseTypeChanged(syncer::PassphraseType type, |
base::Time passphrase_time) override; |
void OnLocalSetPassphraseEncryption( |
- const SyncEncryptionHandler::NigoriState& nigori_state) override; |
+ const syncer::SyncEncryptionHandler::NigoriState& nigori_state) override; |
// TypeDebugInfoObserver implementation |
- void OnCommitCountersUpdated(ModelType type, |
- const CommitCounters& counters) override; |
- void OnUpdateCountersUpdated(ModelType type, |
- const UpdateCounters& counters) override; |
- void OnStatusCountersUpdated(ModelType type, |
- const StatusCounters& counters) override; |
+ void OnCommitCountersUpdated(syncer::ModelType type, |
+ const syncer::CommitCounters& counters) override; |
+ void OnUpdateCountersUpdated(syncer::ModelType type, |
+ const syncer::UpdateCounters& counters) override; |
+ void OnStatusCountersUpdated(syncer::ModelType type, |
+ const syncer::StatusCounters& counters) override; |
// Forwards an invalidation state change to the sync manager. |
- void DoOnInvalidatorStateChange(InvalidatorState state); |
+ void DoOnInvalidatorStateChange(syncer::InvalidatorState state); |
// Forwards an invalidation to the sync manager. |
void DoOnIncomingInvalidation( |
- const ObjectIdInvalidationMap& invalidation_map); |
+ const syncer::ObjectIdInvalidationMap& invalidation_map); |
// Note: |
// |
@@ -155,11 +163,11 @@ class SyncBackendHostCore |
// Called to perform credential update on behalf of |
// SyncBackendHost::UpdateCredentials. |
- void DoUpdateCredentials(const SyncCredentials& credentials); |
+ void DoUpdateCredentials(const syncer::SyncCredentials& credentials); |
// Called to tell the syncapi to start syncing (generally after |
// initialization and authentication). |
- void DoStartSyncing(const ModelSafeRoutingInfo& routing_info, |
+ void DoStartSyncing(const syncer::ModelSafeRoutingInfo& routing_info, |
base::Time last_poll_time); |
// Called to set the passphrase for encryption. |
@@ -174,7 +182,7 @@ class SyncBackendHostCore |
void DoEnableEncryptEverything(); |
// Ask the syncer to check for updates for the specified types. |
- void DoRefreshTypes(ModelTypeSet types); |
+ void DoRefreshTypes(syncer::ModelTypeSet types); |
// Invoked if we failed to download the necessary control types at startup. |
// Invokes SyncBackendHost::HandleControlTypesDownloadRetry. |
@@ -190,26 +198,28 @@ class SyncBackendHostCore |
// 2) Post DoShutdown() to sync loop to clean up backend state, save |
// directory and destroy sync manager. |
void ShutdownOnUIThread(); |
- void DoShutdown(ShutdownReason reason); |
- void DoDestroySyncManager(ShutdownReason reason); |
+ void DoShutdown(syncer::ShutdownReason reason); |
+ void DoDestroySyncManager(syncer::ShutdownReason reason); |
// Configuration methods that must execute on sync loop. |
void DoConfigureSyncer( |
- ConfigureReason reason, |
+ syncer::ConfigureReason reason, |
const DoConfigureSyncerTypes& config_types, |
- const ModelSafeRoutingInfo routing_info, |
- const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, |
+ const syncer::ModelSafeRoutingInfo routing_info, |
+ const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& |
+ ready_task, |
const base::Closure& retry_callback); |
void DoFinishConfigureDataTypes( |
- ModelTypeSet types_to_config, |
- const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task); |
+ syncer::ModelTypeSet types_to_config, |
+ const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>& |
+ ready_task); |
void DoRetryConfiguration(const base::Closure& retry_callback); |
// Set the base request context to use when making HTTP calls. |
// This method will add a reference to the context to persist it |
// on the IO thread. Must be removed from IO thread. |
- SyncManager* sync_manager() { return sync_manager_.get(); } |
+ syncer::SyncManager* sync_manager() { return sync_manager_.get(); } |
void SendBufferedProtocolEventsAndEnableForwarding(); |
void DisableProtocolEventForwarding(); |
@@ -229,7 +239,7 @@ class SyncBackendHostCore |
// We expose this member because it's required in the construction of the |
// HttpBridgeFactory. |
- CancelationSignal* GetRequestContextCancelationSignal() { |
+ syncer::CancelationSignal* GetRequestContextCancelationSignal() { |
return &release_request_context_signal_; |
} |
@@ -239,7 +249,7 @@ class SyncBackendHostCore |
void SaveChanges(); |
void DoClearServerData( |
- const SyncManager::ClearServerDataCallback& frontend_callback); |
+ const syncer::SyncManager::ClearServerDataCallback& frontend_callback); |
// Notify the syncer that the cookie jar has changed. |
void DoOnCookieJarChanged(bool account_mismatch, bool empty_jar); |
@@ -264,7 +274,7 @@ class SyncBackendHostCore |
const base::FilePath sync_data_folder_path_; |
// Our parent SyncBackendHost. |
- WeakHandle<SyncBackendHostImpl> host_; |
+ syncer::WeakHandle<SyncBackendHostImpl> host_; |
// The loop where all the sync backend operations happen. |
// Non-NULL only between calls to DoInitialize() and ~Core(). |
@@ -278,24 +288,24 @@ class SyncBackendHostCore |
std::unique_ptr<base::RepeatingTimer> save_changes_timer_; |
// Our encryptor, which uses Chrome's encryption functions. |
- SystemEncryptor encryptor_; |
+ sync_driver::SystemEncryptor encryptor_; |
// The top-level syncapi entry point. Lives on the sync thread. |
- std::unique_ptr<SyncManager> sync_manager_; |
+ std::unique_ptr<syncer::SyncManager> sync_manager_; |
// Temporary holder of sync manager's initialization results. Set by |
// OnInitializeComplete, and consumed when we pass it via OnBackendInitialized |
// in the final state of HandleInitializationSuccessOnFrontendLoop. |
- WeakHandle<JsBackend> js_backend_; |
- WeakHandle<DataTypeDebugInfoListener> debug_info_listener_; |
+ syncer::WeakHandle<syncer::JsBackend> js_backend_; |
+ syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; |
// These signals allow us to send requests to shut down the HttpBridgeFactory |
// and ServerConnectionManager without having to wait for those classes to |
// finish initializing first. |
// |
// See comments in SyncBackendHostCore::ShutdownOnUIThread() for more details. |
- CancelationSignal release_request_context_signal_; |
- CancelationSignal stop_syncing_signal_; |
+ syncer::CancelationSignal release_request_context_signal_; |
+ syncer::CancelationSignal stop_syncing_signal_; |
// Matches the value of SyncPref's IsFirstSetupComplete() flag at init time. |
// Should not be used for anything except for UMAs and logging. |
@@ -311,13 +321,13 @@ class SyncBackendHostCore |
// received invalidation version for each type. |
// This allows dropping any invalidations with versions older than those |
// most recently received for that data type. |
- std::map<ModelType, int64_t> last_invalidation_versions_; |
+ std::map<syncer::ModelType, int64_t> last_invalidation_versions_; |
base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); |
}; |
-} // namespace syncer |
+} // namespace browser_sync |
#endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ |