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

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: Merge pref changes from https://codereview.chromium.org/2528163002/. Created 4 years 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 a41eb56c52c8aca3b7b0b6fd361542b1d83c51ff..933c1d98cca89eebbf982613156012ea9e68893c 100644
--- a/components/sync/engine_impl/sync_manager_impl.cc
+++ b/components/sync/engine_impl/sync_manager_impl.cc
@@ -227,9 +227,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...";
@@ -331,17 +333,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