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

Unified Diff: components/sync/engine_impl/sync_manager_impl.cc

Issue 2494873003: [Sync] Allow sync start without sign-in if the local sync backend is on. (Closed)
Patch Set: Rebased on ToT. Created 4 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
Index: components/sync/engine_impl/sync_manager_impl.cc
diff --git a/components/sync/engine_impl/sync_manager_impl.cc b/components/sync/engine_impl/sync_manager_impl.cc
index 7a3466d019f9677252cc1452e80be7f5d712afa6..9d1dff5a2fd6fe96e9dcbec1c62a85f4c9c5d739 100644
--- a/components/sync/engine_impl/sync_manager_impl.cc
+++ b/components/sync/engine_impl/sync_manager_impl.cc
@@ -223,9 +223,11 @@ void SyncManagerImpl::Init(InitArgs* args) {
CHECK(!initialized_);
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(args->post_factory.get());
- DCHECK(!args->credentials.account_id.empty());
- DCHECK(!args->credentials.sync_token.empty());
- DCHECK(!args->credentials.scope_set.empty());
+ if (!args->enable_local_sync_backend) {
+ DCHECK(!args->credentials.account_id.empty());
+ DCHECK(!args->credentials.sync_token.empty());
+ DCHECK(!args->credentials.scope_set.empty());
+ }
DCHECK(args->cancelation_signal);
DVLOG(1) << "SyncManager starting Init...";
@@ -327,17 +329,22 @@ void SyncManagerImpl::Init(InitArgs* args) {
listeners, &debug_info_event_listener_, model_type_registry_.get(),
args->invalidator_client_id);
scheduler_ = args->engine_components_factory->BuildScheduler(
- name_, cycle_context_.get(), args->cancelation_signal);
+ name_, cycle_context_.get(), args->cancelation_signal,
+ args->enable_local_sync_backend);
scheduler_->Start(SyncScheduler::CONFIGURATION_MODE, base::Time());
initialized_ = true;
- net::NetworkChangeNotifier::AddIPAddressObserver(this);
- net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
- observing_network_connectivity_changes_ = true;
+ if (!args->enable_local_sync_backend) {
+ net::NetworkChangeNotifier::AddIPAddressObserver(this);
+ net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
+ observing_network_connectivity_changes_ = true;
- UpdateCredentials(args->credentials);
+ UpdateCredentials(args->credentials);
+ } else {
+ scheduler_->OnCredentialsUpdated();
+ }
NotifyInitializationSuccess();
}

Powered by Google App Engine
This is Rietveld 408576698