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

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

Issue 395013002: Pass signin_scoped_device_id to DeviceInfoSpecifics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Revers chrome_signin_client Created 6 years, 5 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_core.h" 5 #include "chrome/browser/sync/glue/sync_backend_host_core.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/sync/glue/device_info.h" 9 #include "chrome/browser/sync/glue/device_info.h"
10 #include "chrome/browser/sync/glue/invalidation_adapter.h" 10 #include "chrome/browser/sync/glue/invalidation_adapter.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 scoped_ptr<syncer::HttpPostProviderFactory> http_bridge_factory, 63 scoped_ptr<syncer::HttpPostProviderFactory> http_bridge_factory,
64 const syncer::SyncCredentials& credentials, 64 const syncer::SyncCredentials& credentials,
65 const std::string& invalidator_client_id, 65 const std::string& invalidator_client_id,
66 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory, 66 scoped_ptr<syncer::SyncManagerFactory> sync_manager_factory,
67 bool delete_sync_data_folder, 67 bool delete_sync_data_folder,
68 const std::string& restored_key_for_bootstrapping, 68 const std::string& restored_key_for_bootstrapping,
69 const std::string& restored_keystore_key_for_bootstrapping, 69 const std::string& restored_keystore_key_for_bootstrapping,
70 scoped_ptr<syncer::InternalComponentsFactory> internal_components_factory, 70 scoped_ptr<syncer::InternalComponentsFactory> internal_components_factory,
71 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler, 71 scoped_ptr<syncer::UnrecoverableErrorHandler> unrecoverable_error_handler,
72 syncer::ReportUnrecoverableErrorFunction 72 syncer::ReportUnrecoverableErrorFunction
73 report_unrecoverable_error_function) 73 report_unrecoverable_error_function,
74 const std::string& signin_scoped_device_id)
74 : sync_loop(sync_loop), 75 : sync_loop(sync_loop),
75 registrar(registrar), 76 registrar(registrar),
76 routing_info(routing_info), 77 routing_info(routing_info),
77 workers(workers), 78 workers(workers),
78 extensions_activity(extensions_activity), 79 extensions_activity(extensions_activity),
79 event_handler(event_handler), 80 event_handler(event_handler),
80 service_url(service_url), 81 service_url(service_url),
81 http_bridge_factory(http_bridge_factory.Pass()), 82 http_bridge_factory(http_bridge_factory.Pass()),
82 credentials(credentials), 83 credentials(credentials),
83 invalidator_client_id(invalidator_client_id), 84 invalidator_client_id(invalidator_client_id),
84 sync_manager_factory(sync_manager_factory.Pass()), 85 sync_manager_factory(sync_manager_factory.Pass()),
85 delete_sync_data_folder(delete_sync_data_folder), 86 delete_sync_data_folder(delete_sync_data_folder),
86 restored_key_for_bootstrapping(restored_key_for_bootstrapping), 87 restored_key_for_bootstrapping(restored_key_for_bootstrapping),
87 restored_keystore_key_for_bootstrapping( 88 restored_keystore_key_for_bootstrapping(
88 restored_keystore_key_for_bootstrapping), 89 restored_keystore_key_for_bootstrapping),
89 internal_components_factory(internal_components_factory.Pass()), 90 internal_components_factory(internal_components_factory.Pass()),
90 unrecoverable_error_handler(unrecoverable_error_handler.Pass()), 91 unrecoverable_error_handler(unrecoverable_error_handler.Pass()),
91 report_unrecoverable_error_function( 92 report_unrecoverable_error_function(report_unrecoverable_error_function),
92 report_unrecoverable_error_function) { 93 signin_scoped_device_id(signin_scoped_device_id) {
93 } 94 }
94 95
95 DoInitializeOptions::~DoInitializeOptions() {} 96 DoInitializeOptions::~DoInitializeOptions() {}
96 97
97 DoConfigureSyncerTypes::DoConfigureSyncerTypes() {} 98 DoConfigureSyncerTypes::DoConfigureSyncerTypes() {}
98 99
99 DoConfigureSyncerTypes::~DoConfigureSyncerTypes() {} 100 DoConfigureSyncerTypes::~DoConfigureSyncerTypes() {}
100 101
101 SyncBackendHostCore::SyncBackendHostCore( 102 SyncBackendHostCore::SyncBackendHostCore(
102 const std::string& name, 103 const std::string& name,
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 396 }
396 } 397 }
397 } 398 }
398 399
399 void SyncBackendHostCore::DoInitialize( 400 void SyncBackendHostCore::DoInitialize(
400 scoped_ptr<DoInitializeOptions> options) { 401 scoped_ptr<DoInitializeOptions> options) {
401 DCHECK(!sync_loop_); 402 DCHECK(!sync_loop_);
402 sync_loop_ = options->sync_loop; 403 sync_loop_ = options->sync_loop;
403 DCHECK(sync_loop_); 404 DCHECK(sync_loop_);
404 405
406 signin_scoped_device_id_ = options->signin_scoped_device_id;
407
405 // Finish initializing the HttpBridgeFactory. We do this here because 408 // Finish initializing the HttpBridgeFactory. We do this here because
406 // building the user agent may block on some platforms. 409 // building the user agent may block on some platforms.
407 chrome::VersionInfo version_info; 410 chrome::VersionInfo version_info;
408 options->http_bridge_factory->Init( 411 options->http_bridge_factory->Init(
409 DeviceInfo::MakeUserAgentForSyncApi(version_info)); 412 DeviceInfo::MakeUserAgentForSyncApi(version_info));
410 413
411 // Blow away the partial or corrupt sync data folder before doing any more 414 // Blow away the partial or corrupt sync data folder before doing any more
412 // initialization, if necessary. 415 // initialization, if necessary.
413 if (options->delete_sync_data_folder) { 416 if (options->delete_sync_data_folder) {
414 DeleteSyncDataFolder(); 417 DeleteSyncDataFolder();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 &SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop); 502 &SyncBackendHostImpl::HandleInitializationFailureOnFrontendLoop);
500 return; 503 return;
501 } 504 }
502 505
503 // Initialize device info. This is asynchronous on some platforms, so we 506 // Initialize device info. This is asynchronous on some platforms, so we
504 // provide a callback for when it finishes. 507 // provide a callback for when it finishes.
505 synced_device_tracker_.reset( 508 synced_device_tracker_.reset(
506 new SyncedDeviceTracker(sync_manager_->GetUserShare(), 509 new SyncedDeviceTracker(sync_manager_->GetUserShare(),
507 sync_manager_->cache_guid())); 510 sync_manager_->cache_guid()));
508 synced_device_tracker_->InitLocalDeviceInfo( 511 synced_device_tracker_->InitLocalDeviceInfo(
512 signin_scoped_device_id_,
509 base::Bind(&SyncBackendHostCore::DoFinishInitialProcessControlTypes, 513 base::Bind(&SyncBackendHostCore::DoFinishInitialProcessControlTypes,
510 weak_ptr_factory_.GetWeakPtr())); 514 weak_ptr_factory_.GetWeakPtr()));
511 } 515 }
512 516
513 void SyncBackendHostCore::DoFinishInitialProcessControlTypes() { 517 void SyncBackendHostCore::DoFinishInitialProcessControlTypes() {
514 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 518 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
515 519
516 registrar_->ActivateDataType(syncer::DEVICE_INFO, 520 registrar_->ActivateDataType(syncer::DEVICE_INFO,
517 syncer::GROUP_PASSIVE, 521 syncer::GROUP_PASSIVE,
518 synced_device_tracker_.get(), 522 synced_device_tracker_.get(),
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 this, &SyncBackendHostCore::SaveChanges); 745 this, &SyncBackendHostCore::SaveChanges);
742 } 746 }
743 747
744 void SyncBackendHostCore::SaveChanges() { 748 void SyncBackendHostCore::SaveChanges() {
745 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 749 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
746 sync_manager_->SaveChanges(); 750 sync_manager_->SaveChanges();
747 } 751 }
748 752
749 } // namespace browser_sync 753 } // namespace browser_sync
750 754
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_core.h ('k') | chrome/browser/sync/glue/sync_backend_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698