Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2367)

Unified Diff: components/browser_sync/browser/profile_sync_service.cc

Issue 1451023005: Revert of [Sync] Componentize ProfileSyncComponentsFactoryImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/browser_sync/browser/profile_sync_service.h ('k') | components/sync_driver/fake_sync_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/browser_sync/browser/profile_sync_service.cc
diff --git a/components/browser_sync/browser/profile_sync_service.cc b/components/browser_sync/browser/profile_sync_service.cc
index 9adcba94c1fce13b15c559d6ade4464a3d1a0eb5..f24df73a3587d31b1fa39bfd0641858035982980 100644
--- a/components/browser_sync/browser/profile_sync_service.cc
+++ b/components/browser_sync/browser/profile_sync_service.cc
@@ -211,7 +211,6 @@
connection_status_(syncer::CONNECTION_NOT_ATTEMPTED),
last_get_token_error_(GoogleServiceAuthError::AuthErrorNone()),
network_resources_(new syncer::HttpBridgeNetworkResources),
- start_behavior_(start_behavior),
backend_mode_(IDLE),
need_backup_(false),
backup_finished_(false),
@@ -221,49 +220,23 @@
startup_controller_weak_factory_(this) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(sync_client_);
- std::string last_version = sync_prefs_.GetLastRunVersion();
- std::string current_version = PRODUCT_VERSION;
- sync_prefs_.SetLastRunVersion(current_version);
-
- // Check for a major version change. Note that the versions have format
- // MAJOR.MINOR.BUILD.PATCH.
- if (last_version.substr(0, last_version.find('.')) !=
- current_version.substr(0, current_version.find('.'))) {
- passphrase_prompt_triggered_by_version_ = true;
- }
-}
-
-ProfileSyncService::~ProfileSyncService() {
- sync_prefs_.RemoveSyncPrefObserver(this);
- // Shutdown() should have been called before destruction.
- CHECK(!backend_initialized_);
-}
-
-bool ProfileSyncService::CanSyncStart() const {
- return IsSyncAllowed() && IsSyncRequested() && IsSignedIn();
-}
-
-bool ProfileSyncService::IsOAuthRefreshTokenAvailable() {
- if (!oauth2_token_service_)
- return false;
-
- return oauth2_token_service_->RefreshTokenIsAvailable(
- signin_->GetAccountIdToUse());
-}
-
-void ProfileSyncService::Initialize() {
- sync_client_->Initialize(this);
-
startup_controller_.reset(new browser_sync::StartupController(
- start_behavior_, oauth2_token_service_, &sync_prefs_, signin_.get(),
+ start_behavior,
+ oauth2_token_service,
+ &sync_prefs_,
+ signin_.get(),
base::Bind(&ProfileSyncService::StartUpSlowBackendComponents,
- startup_controller_weak_factory_.GetWeakPtr(), SYNC)));
+ startup_controller_weak_factory_.GetWeakPtr(),
+ SYNC)));
backup_rollback_controller_.reset(new sync_driver::BackupRollbackController(
- &sync_prefs_, signin_.get(),
+ &sync_prefs_,
+ signin_.get(),
base::Bind(&ProfileSyncService::StartUpSlowBackendComponents,
- startup_controller_weak_factory_.GetWeakPtr(), BACKUP),
+ startup_controller_weak_factory_.GetWeakPtr(),
+ BACKUP),
base::Bind(&ProfileSyncService::StartUpSlowBackendComponents,
- startup_controller_weak_factory_.GetWeakPtr(), ROLLBACK)));
+ startup_controller_weak_factory_.GetWeakPtr(),
+ ROLLBACK)));
scoped_ptr<browser_sync::LocalSessionEventRouter> router(
sync_client_->GetSyncSessionsClient()->GetLocalSessionEventRouter());
local_device_ = sync_client_->GetSyncApiComponentFactory()
@@ -283,11 +256,38 @@
device_info_sync_service_.reset(
new DeviceInfoSyncService(local_device_.get()));
- sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod
- register_platform_types_callback =
- sync_client_->GetRegisterPlatformTypesCallback();
- sync_client_->GetSyncApiComponentFactory()->RegisterDataTypes(
- register_platform_types_callback);
+ std::string last_version = sync_prefs_.GetLastRunVersion();
+ std::string current_version = PRODUCT_VERSION;
+ sync_prefs_.SetLastRunVersion(current_version);
+
+ // Check for a major version change. Note that the versions have format
+ // MAJOR.MINOR.BUILD.PATCH.
+ if (last_version.substr(0, last_version.find('.')) !=
+ current_version.substr(0, current_version.find('.'))) {
+ passphrase_prompt_triggered_by_version_ = true;
+ }
+}
+
+ProfileSyncService::~ProfileSyncService() {
+ sync_prefs_.RemoveSyncPrefObserver(this);
+ // Shutdown() should have been called before destruction.
+ CHECK(!backend_initialized_);
+}
+
+bool ProfileSyncService::CanSyncStart() const {
+ return IsSyncAllowed() && IsSyncRequested() && IsSignedIn();
+}
+
+bool ProfileSyncService::IsOAuthRefreshTokenAvailable() {
+ if (!oauth2_token_service_)
+ return false;
+
+ return oauth2_token_service_->RefreshTokenIsAvailable(
+ signin_->GetAccountIdToUse());
+}
+
+void ProfileSyncService::Initialize() {
+ sync_client_->Initialize(this);
// We clear this here (vs Shutdown) because we want to remember that an error
// happened on shutdown so we can display details (message, location) about it
@@ -672,8 +672,8 @@
backend_.reset(
sync_client_->GetSyncApiComponentFactory()->CreateSyncBackendHost(
- debug_identifier_, invalidator, sync_prefs_.AsWeakPtr(),
- directory_path_));
+ debug_identifier_, sync_client_.get(), invalidator,
+ sync_prefs_.AsWeakPtr(), directory_path_));
// Initialize the backend. Every time we start up a new SyncBackendHost,
// we'll want to start from a fresh SyncDB, so delete any old one that might
« no previous file with comments | « components/browser_sync/browser/profile_sync_service.h ('k') | components/sync_driver/fake_sync_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698