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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host_impl.cc

Issue 566623003: Refactor syncable DEVICE_INFO type from ChangeProcessor to SyncableService - part 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More CR feedback addressed in DeviceInfoSyncService. Created 6 years, 3 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 CommandLine* cl = CommandLine::ForCurrentProcess(); 128 CommandLine* cl = CommandLine::ForCurrentProcess();
129 if (cl->HasSwitch(switches::kSyncShortInitialRetryOverride)) { 129 if (cl->HasSwitch(switches::kSyncShortInitialRetryOverride)) {
130 factory_switches.backoff_override = 130 factory_switches.backoff_override =
131 InternalComponentsFactory::BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE; 131 InternalComponentsFactory::BACKOFF_SHORT_INITIAL_RETRY_OVERRIDE;
132 } 132 }
133 if (cl->HasSwitch(switches::kSyncEnableGetUpdateAvoidance)) { 133 if (cl->HasSwitch(switches::kSyncEnableGetUpdateAvoidance)) {
134 factory_switches.pre_commit_updates_policy = 134 factory_switches.pre_commit_updates_policy =
135 InternalComponentsFactory::FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE; 135 InternalComponentsFactory::FORCE_ENABLE_PRE_COMMIT_UPDATE_AVOIDANCE;
136 } 136 }
137 137
138 SigninClient* signin_client =
139 ChromeSigninClientFactory::GetForProfile(profile_);
140 DCHECK(signin_client);
141 std::string signin_scoped_device_id =
142 signin_client->GetSigninScopedDeviceId();
143
144 scoped_ptr<DoInitializeOptions> init_opts(new DoInitializeOptions( 138 scoped_ptr<DoInitializeOptions> init_opts(new DoInitializeOptions(
145 registrar_->sync_thread()->message_loop(), 139 registrar_->sync_thread()->message_loop(),
146 registrar_.get(), 140 registrar_.get(),
147 routing_info, 141 routing_info,
148 workers, 142 workers,
149 extensions_activity_monitor_.GetExtensionsActivity(), 143 extensions_activity_monitor_.GetExtensionsActivity(),
150 event_handler, 144 event_handler,
151 sync_service_url, 145 sync_service_url,
152 network_resources->GetHttpPostProviderFactory( 146 network_resources->GetHttpPostProviderFactory(
153 make_scoped_refptr(profile_->GetRequestContext()), 147 make_scoped_refptr(profile_->GetRequestContext()),
154 base::Bind(&UpdateNetworkTime), 148 base::Bind(&UpdateNetworkTime),
155 core_->GetRequestContextCancelationSignal()), 149 core_->GetRequestContextCancelationSignal()),
156 credentials, 150 credentials,
157 invalidator_ ? invalidator_->GetInvalidatorClientId() : "", 151 invalidator_ ? invalidator_->GetInvalidatorClientId() : "",
158 sync_manager_factory.Pass(), 152 sync_manager_factory.Pass(),
159 delete_sync_data_folder, 153 delete_sync_data_folder,
160 sync_prefs_->GetEncryptionBootstrapToken(), 154 sync_prefs_->GetEncryptionBootstrapToken(),
161 sync_prefs_->GetKeystoreEncryptionBootstrapToken(), 155 sync_prefs_->GetKeystoreEncryptionBootstrapToken(),
162 scoped_ptr<InternalComponentsFactory>( 156 scoped_ptr<InternalComponentsFactory>(
163 new syncer::InternalComponentsFactoryImpl(factory_switches)).Pass(), 157 new syncer::InternalComponentsFactoryImpl(factory_switches)).Pass(),
164 unrecoverable_error_handler.Pass(), 158 unrecoverable_error_handler.Pass(),
165 report_unrecoverable_error_function, 159 report_unrecoverable_error_function));
166 signin_scoped_device_id));
167 InitCore(init_opts.Pass()); 160 InitCore(init_opts.Pass());
168 } 161 }
169 162
170 void SyncBackendHostImpl::UpdateCredentials( 163 void SyncBackendHostImpl::UpdateCredentials(
171 const syncer::SyncCredentials& credentials) { 164 const syncer::SyncCredentials& credentials) {
172 DCHECK(registrar_->sync_thread()->IsRunning()); 165 DCHECK(registrar_->sync_thread()->IsRunning());
173 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE, 166 registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
174 base::Bind(&SyncBackendHostCore::DoUpdateCredentials, 167 base::Bind(&SyncBackendHostCore::DoUpdateCredentials,
175 core_.get(), 168 core_.get(),
176 credentials)); 169 credentials));
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 void SyncBackendHostImpl::GetModelSafeRoutingInfo( 500 void SyncBackendHostImpl::GetModelSafeRoutingInfo(
508 syncer::ModelSafeRoutingInfo* out) const { 501 syncer::ModelSafeRoutingInfo* out) const {
509 if (initialized()) { 502 if (initialized()) {
510 CHECK(registrar_.get()); 503 CHECK(registrar_.get());
511 registrar_->GetModelSafeRoutingInfo(out); 504 registrar_->GetModelSafeRoutingInfo(out);
512 } else { 505 } else {
513 NOTREACHED(); 506 NOTREACHED();
514 } 507 }
515 } 508 }
516 509
517 SyncedDeviceTracker* SyncBackendHostImpl::GetSyncedDeviceTracker() const {
518 if (!initialized())
519 return NULL;
520 return core_->synced_device_tracker();
521 }
522
523 void SyncBackendHostImpl::RequestBufferedProtocolEventsAndEnableForwarding() { 510 void SyncBackendHostImpl::RequestBufferedProtocolEventsAndEnableForwarding() {
524 registrar_->sync_thread()->message_loop()->PostTask( 511 registrar_->sync_thread()->message_loop()->PostTask(
525 FROM_HERE, 512 FROM_HERE,
526 base::Bind( 513 base::Bind(
527 &SyncBackendHostCore::SendBufferedProtocolEventsAndEnableForwarding, 514 &SyncBackendHostCore::SendBufferedProtocolEventsAndEnableForwarding,
528 core_)); 515 core_));
529 } 516 }
530 517
531 void SyncBackendHostImpl::DisableProtocolEventForwarding() { 518 void SyncBackendHostImpl::DisableProtocolEventForwarding() {
532 registrar_->sync_thread()->message_loop()->PostTask( 519 registrar_->sync_thread()->message_loop()->PostTask(
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 871
885 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() { 872 base::MessageLoop* SyncBackendHostImpl::GetSyncLoopForTesting() {
886 return registrar_->sync_thread()->message_loop(); 873 return registrar_->sync_thread()->message_loop();
887 } 874 }
888 875
889 } // namespace browser_sync 876 } // namespace browser_sync
890 877
891 #undef SDVLOG 878 #undef SDVLOG
892 879
893 #undef SLOG 880 #undef SLOG
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_impl.h ('k') | chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698