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

Side by Side Diff: components/browser_sync/profile_sync_service.cc

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Fix tools and iOS. Created 4 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/browser_sync/profile_sync_service.h" 5 #include "components/browser_sync/profile_sync_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <map> 10 #include <map>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #include "components/version_info/version_info_values.h" 93 #include "components/version_info/version_info_values.h"
94 #include "net/cookies/cookie_monster.h" 94 #include "net/cookies/cookie_monster.h"
95 #include "net/url_request/url_request_context_getter.h" 95 #include "net/url_request/url_request_context_getter.h"
96 #include "ui/base/l10n/l10n_util.h" 96 #include "ui/base/l10n/l10n_util.h"
97 #include "ui/base/l10n/time_format.h" 97 #include "ui/base/l10n/time_format.h"
98 98
99 #if defined(OS_ANDROID) 99 #if defined(OS_ANDROID)
100 #include "components/sync/core/read_transaction.h" 100 #include "components/sync/core/read_transaction.h"
101 #endif 101 #endif
102 102
103 using sync_driver::ChangeProcessor;
104 using sync_driver::DataTypeController;
105 using sync_driver::DataTypeManager;
106 using sync_driver::DataTypeStatusTable;
107 using sync_driver::DeviceInfoSyncService;
108 using sync_driver_v2::DeviceInfoService;
109 using sync_sessions::SessionsSyncManager; 103 using sync_sessions::SessionsSyncManager;
110 using syncer::ModelType; 104 using syncer::BackendMigrator;
111 using syncer::ModelTypeSet; 105 using syncer::ChangeProcessor;
106 using syncer::DataTypeController;
107 using syncer::DataTypeManager;
108 using syncer::DataTypeStatusTable;
109 using syncer::DeviceInfoService;
110 using syncer::DeviceInfoSyncService;
112 using syncer::JsBackend; 111 using syncer::JsBackend;
113 using syncer::JsController; 112 using syncer::JsController;
114 using syncer::JsEventDetails; 113 using syncer::JsEventDetails;
115 using syncer::JsEventHandler; 114 using syncer::JsEventHandler;
116 using syncer::ModelSafeRoutingInfo; 115 using syncer::ModelSafeRoutingInfo;
116 using syncer::ModelType;
117 using syncer::ModelTypeSet;
118 using syncer::ModelTypeStore;
119 using syncer::ProtocolEventObserver;
120 using syncer::SharedModelTypeProcessor;
121 using syncer::SyncBackendHost;
117 using syncer::SyncCredentials; 122 using syncer::SyncCredentials;
118 using syncer::SyncProtocolError; 123 using syncer::SyncProtocolError;
119 using syncer::WeakHandle; 124 using syncer::WeakHandle;
120 using syncer_v2::ModelTypeStore;
121 using syncer_v2::SharedModelTypeProcessor;
122 125
123 namespace browser_sync { 126 namespace browser_sync {
124 127
125 typedef GoogleServiceAuthError AuthError; 128 typedef GoogleServiceAuthError AuthError;
126 129
127 const char kSyncUnrecoverableErrorHistogram[] = "Sync.UnrecoverableErrors"; 130 const char kSyncUnrecoverableErrorHistogram[] = "Sync.UnrecoverableErrors";
128 131
129 const net::BackoffEntry::Policy kRequestAccessTokenBackoffPolicy = { 132 const net::BackoffEntry::Policy kRequestAccessTokenBackoffPolicy = {
130 // Number of initial errors (in sequence) to ignore before applying 133 // Number of initial errors (in sequence) to ignore before applying
131 // exponential back-off rules. 134 // exponential back-off rules.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 file_thread(std::move(other.file_thread)), 200 file_thread(std::move(other.file_thread)),
198 blocking_pool(other.blocking_pool) {} 201 blocking_pool(other.blocking_pool) {}
199 202
200 ProfileSyncService::ProfileSyncService(InitParams init_params) 203 ProfileSyncService::ProfileSyncService(InitParams init_params)
201 : OAuth2TokenService::Consumer("sync"), 204 : OAuth2TokenService::Consumer("sync"),
202 last_auth_error_(AuthError::AuthErrorNone()), 205 last_auth_error_(AuthError::AuthErrorNone()),
203 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED), 206 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED),
204 sync_client_(std::move(init_params.sync_client)), 207 sync_client_(std::move(init_params.sync_client)),
205 sync_prefs_(sync_client_->GetPrefService()), 208 sync_prefs_(sync_client_->GetPrefService()),
206 sync_service_url_( 209 sync_service_url_(
207 GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(), 210 syncer::GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(),
208 init_params.channel)), 211 init_params.channel)),
209 network_time_update_callback_( 212 network_time_update_callback_(
210 std::move(init_params.network_time_update_callback)), 213 std::move(init_params.network_time_update_callback)),
211 base_directory_(init_params.base_directory), 214 base_directory_(init_params.base_directory),
212 url_request_context_(init_params.url_request_context), 215 url_request_context_(init_params.url_request_context),
213 debug_identifier_(std::move(init_params.debug_identifier)), 216 debug_identifier_(std::move(init_params.debug_identifier)),
214 channel_(init_params.channel), 217 channel_(init_params.channel),
215 db_thread_(init_params.db_thread), 218 db_thread_(init_params.db_thread),
216 file_thread_(init_params.file_thread), 219 file_thread_(init_params.file_thread),
217 blocking_pool_(init_params.blocking_pool), 220 blocking_pool_(init_params.blocking_pool),
218 is_first_time_sync_configure_(false), 221 is_first_time_sync_configure_(false),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 267
265 bool ProfileSyncService::CanSyncStart() const { 268 bool ProfileSyncService::CanSyncStart() const {
266 return IsSyncAllowed() && IsSyncRequested() && IsSignedIn(); 269 return IsSyncAllowed() && IsSyncRequested() && IsSignedIn();
267 } 270 }
268 271
269 void ProfileSyncService::Initialize() { 272 void ProfileSyncService::Initialize() {
270 sync_client_->Initialize(); 273 sync_client_->Initialize();
271 274
272 // We don't pass StartupController an Unretained reference to future-proof 275 // We don't pass StartupController an Unretained reference to future-proof
273 // against the controller impl changing to post tasks. 276 // against the controller impl changing to post tasks.
274 startup_controller_.reset(new StartupController( 277 startup_controller_.reset(new syncer::StartupController(
275 &sync_prefs_, 278 &sync_prefs_,
276 base::Bind(&ProfileSyncService::CanBackendStart, base::Unretained(this)), 279 base::Bind(&ProfileSyncService::CanBackendStart, base::Unretained(this)),
277 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, 280 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents,
278 weak_factory_.GetWeakPtr()))); 281 weak_factory_.GetWeakPtr())));
279 std::unique_ptr<sync_sessions::LocalSessionEventRouter> router( 282 std::unique_ptr<sync_sessions::LocalSessionEventRouter> router(
280 sync_client_->GetSyncSessionsClient()->GetLocalSessionEventRouter()); 283 sync_client_->GetSyncSessionsClient()->GetLocalSessionEventRouter());
281 local_device_ = sync_client_->GetSyncApiComponentFactory() 284 local_device_ = sync_client_->GetSyncApiComponentFactory()
282 ->CreateLocalDeviceInfoProvider(); 285 ->CreateLocalDeviceInfoProvider();
283 sync_stopped_reporter_.reset(new SyncStoppedReporter( 286 sync_stopped_reporter_.reset(new syncer::SyncStoppedReporter(
284 sync_service_url_, local_device_->GetSyncUserAgent(), 287 sync_service_url_, local_device_->GetSyncUserAgent(),
285 url_request_context_, SyncStoppedReporter::ResultCallback())); 288 url_request_context_, syncer::SyncStoppedReporter::ResultCallback()));
286 sessions_sync_manager_.reset(new SessionsSyncManager( 289 sessions_sync_manager_.reset(new SessionsSyncManager(
287 sync_client_->GetSyncSessionsClient(), &sync_prefs_, local_device_.get(), 290 sync_client_->GetSyncSessionsClient(), &sync_prefs_, local_device_.get(),
288 std::move(router), 291 std::move(router),
289 base::Bind(&ProfileSyncService::NotifyForeignSessionUpdated, 292 base::Bind(&ProfileSyncService::NotifyForeignSessionUpdated,
290 sync_enabled_weak_factory_.GetWeakPtr()), 293 sync_enabled_weak_factory_.GetWeakPtr()),
291 base::Bind(&ProfileSyncService::TriggerRefresh, 294 base::Bind(&ProfileSyncService::TriggerRefresh,
292 sync_enabled_weak_factory_.GetWeakPtr(), 295 sync_enabled_weak_factory_.GetWeakPtr(),
293 syncer::ModelTypeSet(syncer::SESSIONS)))); 296 syncer::ModelTypeSet(syncer::SESSIONS))));
294 297
295 if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) { 298 if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) {
296 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( 299 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner(
297 blocking_pool_->GetSequencedTaskRunnerWithShutdownBehavior( 300 blocking_pool_->GetSequencedTaskRunnerWithShutdownBehavior(
298 blocking_pool_->GetSequenceToken(), 301 blocking_pool_->GetSequenceToken(),
299 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 302 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
300 // TODO(skym): Stop creating leveldb files when signed out. 303 // TODO(skym): Stop creating leveldb files when signed out.
301 // TODO(skym): Verify using AsUTF8Unsafe is okay here. Should work as long 304 // TODO(skym): Verify using AsUTF8Unsafe is okay here. Should work as long
302 // as the Local State file is guaranteed to be UTF-8. 305 // as the Local State file is guaranteed to be UTF-8.
303 device_info_service_.reset(new DeviceInfoService( 306 device_info_service_.reset(new DeviceInfoService(
304 local_device_.get(), 307 local_device_.get(),
305 base::Bind(&ModelTypeStore::CreateStore, syncer::DEVICE_INFO, 308 base::Bind(&ModelTypeStore::CreateStore, syncer::DEVICE_INFO,
306 directory_path_.Append(base::FilePath(kLevelDBFolderName)) 309 directory_path_.Append(base::FilePath(kLevelDBFolderName))
307 .AsUTF8Unsafe(), 310 .AsUTF8Unsafe(),
308 blocking_task_runner), 311 blocking_task_runner),
309 base::Bind(&SharedModelTypeProcessor::CreateAsChangeProcessor))); 312 base::Bind(&SharedModelTypeProcessor::CreateAsChangeProcessor)));
310 } else { 313 } else {
311 device_info_sync_service_.reset( 314 device_info_sync_service_.reset(
312 new DeviceInfoSyncService(local_device_.get())); 315 new DeviceInfoSyncService(local_device_.get()));
313 } 316 }
314 317
315 sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod 318 syncer::SyncApiComponentFactory::RegisterDataTypesMethod
316 register_platform_types_callback = 319 register_platform_types_callback =
317 sync_client_->GetRegisterPlatformTypesCallback(); 320 sync_client_->GetRegisterPlatformTypesCallback();
318 sync_client_->GetSyncApiComponentFactory()->RegisterDataTypes( 321 sync_client_->GetSyncApiComponentFactory()->RegisterDataTypes(
319 this, register_platform_types_callback); 322 this, register_platform_types_callback);
320 323
321 if (gaia_cookie_manager_service_) 324 if (gaia_cookie_manager_service_)
322 gaia_cookie_manager_service_->AddObserver(this); 325 gaia_cookie_manager_service_->AddObserver(this);
323 326
324 // We clear this here (vs Shutdown) because we want to remember that an error 327 // We clear this here (vs Shutdown) because we want to remember that an error
325 // happened on shutdown so we can display details (message, location) about it 328 // happened on shutdown so we can display details (message, location) about it
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 std::string bootstrap_token = sync_prefs_.GetEncryptionBootstrapToken(); 370 std::string bootstrap_token = sync_prefs_.GetEncryptionBootstrapToken();
368 if (bootstrap_token.empty()) { 371 if (bootstrap_token.empty()) {
369 sync_prefs_.SetEncryptionBootstrapToken( 372 sync_prefs_.SetEncryptionBootstrapToken(
370 sync_prefs_.GetSpareBootstrapToken()); 373 sync_prefs_.GetSpareBootstrapToken());
371 } 374 }
372 #endif 375 #endif
373 376
374 #if !defined(OS_ANDROID) 377 #if !defined(OS_ANDROID)
375 DCHECK(sync_error_controller_ == NULL) 378 DCHECK(sync_error_controller_ == NULL)
376 << "Initialize() called more than once."; 379 << "Initialize() called more than once.";
377 sync_error_controller_.reset(new SyncErrorController(this)); 380 sync_error_controller_.reset(new syncer::SyncErrorController(this));
378 AddObserver(sync_error_controller_.get()); 381 AddObserver(sync_error_controller_.get());
379 #endif 382 #endif
380 383
381 memory_pressure_listener_.reset(new base::MemoryPressureListener( 384 memory_pressure_listener_.reset(new base::MemoryPressureListener(
382 base::Bind(&ProfileSyncService::OnMemoryPressure, 385 base::Bind(&ProfileSyncService::OnMemoryPressure,
383 sync_enabled_weak_factory_.GetWeakPtr()))); 386 sync_enabled_weak_factory_.GetWeakPtr())));
384 startup_controller_->Reset(GetRegisteredDataTypes()); 387 startup_controller_->Reset(GetRegisteredDataTypes());
385 388
386 // Auto-start means means the first time the profile starts up, sync should 389 // Auto-start means means the first time the profile starts up, sync should
387 // start up immediately. 390 // start up immediately.
(...skipping 25 matching lines...) Expand all
413 signin()->AddObserver(this); 416 signin()->AddObserver(this);
414 } 417 }
415 418
416 void ProfileSyncService::UnregisterAuthNotifications() { 419 void ProfileSyncService::UnregisterAuthNotifications() {
417 if (signin()) 420 if (signin())
418 signin()->RemoveObserver(this); 421 signin()->RemoveObserver(this);
419 oauth2_token_service_->RemoveObserver(this); 422 oauth2_token_service_->RemoveObserver(this);
420 } 423 }
421 424
422 void ProfileSyncService::RegisterDataTypeController( 425 void ProfileSyncService::RegisterDataTypeController(
423 std::unique_ptr<sync_driver::DataTypeController> data_type_controller) { 426 std::unique_ptr<syncer::DataTypeController> data_type_controller) {
424 DCHECK_EQ(data_type_controllers_.count(data_type_controller->type()), 0U); 427 DCHECK_EQ(data_type_controllers_.count(data_type_controller->type()), 0U);
425 data_type_controllers_[data_type_controller->type()] = 428 data_type_controllers_[data_type_controller->type()] =
426 std::move(data_type_controller); 429 std::move(data_type_controller);
427 } 430 }
428 431
429 bool ProfileSyncService::IsDataTypeControllerRunning( 432 bool ProfileSyncService::IsDataTypeControllerRunning(
430 syncer::ModelType type) const { 433 syncer::ModelType type) const {
431 DataTypeController::TypeMap::const_iterator iter = 434 DataTypeController::TypeMap::const_iterator iter =
432 data_type_controllers_.find(type); 435 data_type_controllers_.find(type);
433 if (iter == data_type_controllers_.end()) { 436 if (iter == data_type_controllers_.end()) {
434 return false; 437 return false;
435 } 438 }
436 return iter->second->state() == DataTypeController::RUNNING; 439 return iter->second->state() == DataTypeController::RUNNING;
437 } 440 }
438 441
439 sync_sessions::OpenTabsUIDelegate* ProfileSyncService::GetOpenTabsUIDelegate() { 442 sync_sessions::OpenTabsUIDelegate* ProfileSyncService::GetOpenTabsUIDelegate() {
440 if (!IsDataTypeControllerRunning(syncer::SESSIONS)) 443 if (!IsDataTypeControllerRunning(syncer::SESSIONS))
441 return NULL; 444 return NULL;
442 return sessions_sync_manager_.get(); 445 return sessions_sync_manager_.get();
443 } 446 }
444 447
445 sync_sessions::FaviconCache* ProfileSyncService::GetFaviconCache() { 448 sync_sessions::FaviconCache* ProfileSyncService::GetFaviconCache() {
446 return sessions_sync_manager_->GetFaviconCache(); 449 return sessions_sync_manager_->GetFaviconCache();
447 } 450 }
448 451
449 sync_driver::DeviceInfoTracker* ProfileSyncService::GetDeviceInfoTracker() 452 syncer::DeviceInfoTracker* ProfileSyncService::GetDeviceInfoTracker() const {
450 const {
451 // One of the two should always be non-null after initialization is done. 453 // One of the two should always be non-null after initialization is done.
452 if (device_info_service_) { 454 if (device_info_service_) {
453 return device_info_service_.get(); 455 return device_info_service_.get();
454 } else { 456 } else {
455 return device_info_sync_service_.get(); 457 return device_info_sync_service_.get();
456 } 458 }
457 } 459 }
458 460
459 sync_driver::LocalDeviceInfoProvider* 461 syncer::LocalDeviceInfoProvider*
460 ProfileSyncService::GetLocalDeviceInfoProvider() const { 462 ProfileSyncService::GetLocalDeviceInfoProvider() const {
461 return local_device_.get(); 463 return local_device_.get();
462 } 464 }
463 465
464 void ProfileSyncService::GetDataTypeControllerStates( 466 void ProfileSyncService::GetDataTypeControllerStates(
465 DataTypeController::StateMap* state_map) const { 467 DataTypeController::StateMap* state_map) const {
466 for (DataTypeController::TypeMap::const_iterator iter = 468 for (DataTypeController::TypeMap::const_iterator iter =
467 data_type_controllers_.begin(); 469 data_type_controllers_.begin();
468 iter != data_type_controllers_.end(); ++iter) 470 iter != data_type_controllers_.end(); ++iter)
469 (*state_map)[iter->first] = iter->second.get()->state(); 471 (*state_map)[iter->first] = iter->second.get()->state();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 base::Unretained(network_resources_.get()), 519 base::Unretained(network_resources_.get()),
518 url_request_context_, network_time_update_callback_); 520 url_request_context_, network_time_update_callback_);
519 521
520 backend_->Initialize( 522 backend_->Initialize(
521 this, std::move(sync_thread_), db_thread_, file_thread_, 523 this, std::move(sync_thread_), db_thread_, file_thread_,
522 GetJsEventHandler(), sync_service_url_, local_device_->GetSyncUserAgent(), 524 GetJsEventHandler(), sync_service_url_, local_device_->GetSyncUserAgent(),
523 credentials, delete_stale_data, 525 credentials, delete_stale_data,
524 std::unique_ptr<syncer::SyncManagerFactory>( 526 std::unique_ptr<syncer::SyncManagerFactory>(
525 new syncer::SyncManagerFactory()), 527 new syncer::SyncManagerFactory()),
526 MakeWeakHandle(sync_enabled_weak_factory_.GetWeakPtr()), 528 MakeWeakHandle(sync_enabled_weak_factory_.GetWeakPtr()),
527 base::Bind(ChromeReportUnrecoverableError, channel_), 529 base::Bind(syncer::ChromeReportUnrecoverableError, channel_),
528 http_post_provider_factory_getter, std::move(saved_nigori_state_)); 530 http_post_provider_factory_getter, std::move(saved_nigori_state_));
529 } 531 }
530 532
531 bool ProfileSyncService::IsEncryptedDatatypeEnabled() const { 533 bool ProfileSyncService::IsEncryptedDatatypeEnabled() const {
532 if (encryption_pending()) 534 if (encryption_pending())
533 return true; 535 return true;
534 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes(); 536 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes();
535 const syncer::ModelTypeSet encrypted_types = GetEncryptedDataTypes(); 537 const syncer::ModelTypeSet encrypted_types = GetEncryptedDataTypes();
536 DCHECK(encrypted_types.Has(syncer::PASSWORDS)); 538 DCHECK(encrypted_types.Has(syncer::PASSWORDS));
537 return !Intersection(preferred_types, encrypted_types).Empty(); 539 return !Intersection(preferred_types, encrypted_types).Empty();
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 if (IsBackendInitialized()) { 835 if (IsBackendInitialized()) {
834 ReconfigureDatatypeManager(); 836 ReconfigureDatatypeManager();
835 } 837 }
836 } 838 }
837 839
838 void ProfileSyncService::UpdateLastSyncedTime() { 840 void ProfileSyncService::UpdateLastSyncedTime() {
839 sync_prefs_.SetLastSyncedTime(base::Time::Now()); 841 sync_prefs_.SetLastSyncedTime(base::Time::Now());
840 } 842 }
841 843
842 void ProfileSyncService::NotifyObservers() { 844 void ProfileSyncService::NotifyObservers() {
843 FOR_EACH_OBSERVER(sync_driver::SyncServiceObserver, observers_, 845 FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_, OnStateChanged());
844 OnStateChanged());
845 } 846 }
846 847
847 void ProfileSyncService::NotifySyncCycleCompleted() { 848 void ProfileSyncService::NotifySyncCycleCompleted() {
848 FOR_EACH_OBSERVER(sync_driver::SyncServiceObserver, observers_, 849 FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_,
849 OnSyncCycleCompleted()); 850 OnSyncCycleCompleted());
850 } 851 }
851 852
852 void ProfileSyncService::NotifyForeignSessionUpdated() { 853 void ProfileSyncService::NotifyForeignSessionUpdated() {
853 FOR_EACH_OBSERVER(sync_driver::SyncServiceObserver, observers_, 854 FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_,
854 OnForeignSessionUpdated()); 855 OnForeignSessionUpdated());
855 } 856 }
856 857
857 void ProfileSyncService::ClearStaleErrors() { 858 void ProfileSyncService::ClearStaleErrors() {
858 ClearUnrecoverableError(); 859 ClearUnrecoverableError();
859 last_actionable_error_ = SyncProtocolError(); 860 last_actionable_error_ = SyncProtocolError();
860 // Clear the data type errors as well. 861 // Clear the data type errors as well.
861 if (data_type_manager_.get()) 862 if (data_type_manager_.get())
862 data_type_manager_->ResetDataTypeErrors(); 863 data_type_manager_->ResetDataTypeErrors();
863 } 864 }
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 if (is_first_time_sync_configure_) { 1331 if (is_first_time_sync_configure_) {
1331 UMA_HISTOGRAM_LONG_TIMES("Sync.ServiceInitialConfigureTime", delta); 1332 UMA_HISTOGRAM_LONG_TIMES("Sync.ServiceInitialConfigureTime", delta);
1332 } else { 1333 } else {
1333 UMA_HISTOGRAM_LONG_TIMES("Sync.ServiceSubsequentConfigureTime", delta); 1334 UMA_HISTOGRAM_LONG_TIMES("Sync.ServiceSubsequentConfigureTime", delta);
1334 } 1335 }
1335 } 1336 }
1336 sync_configure_start_time_ = base::Time(); 1337 sync_configure_start_time_ = base::Time();
1337 } 1338 }
1338 1339
1339 // Notify listeners that configuration is done. 1340 // Notify listeners that configuration is done.
1340 FOR_EACH_OBSERVER(sync_driver::SyncServiceObserver, observers_, 1341 FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_,
1341 OnSyncConfigurationCompleted()); 1342 OnSyncConfigurationCompleted());
1342 1343
1343 DVLOG(1) << "PSS OnConfigureDone called with status: " << configure_status_; 1344 DVLOG(1) << "PSS OnConfigureDone called with status: " << configure_status_;
1344 // The possible status values: 1345 // The possible status values:
1345 // ABORT - Configuration was aborted. This is not an error, if 1346 // ABORT - Configuration was aborted. This is not an error, if
1346 // initiated by user. 1347 // initiated by user.
1347 // OK - Some or all types succeeded. 1348 // OK - Some or all types succeeded.
1348 // Everything else is an UnrecoverableError. So treat it as such. 1349 // Everything else is an UnrecoverableError. So treat it as such.
1349 1350
1350 // First handle the abort case. 1351 // First handle the abort case.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 } 1477 }
1477 1478
1478 bool ProfileSyncService::CanConfigureDataTypes() const { 1479 bool ProfileSyncService::CanConfigureDataTypes() const {
1479 return IsFirstSetupComplete() && !IsSetupInProgress(); 1480 return IsFirstSetupComplete() && !IsSetupInProgress();
1480 } 1481 }
1481 1482
1482 bool ProfileSyncService::IsFirstSetupInProgress() const { 1483 bool ProfileSyncService::IsFirstSetupInProgress() const {
1483 return !IsFirstSetupComplete() && startup_controller_->IsSetupInProgress(); 1484 return !IsFirstSetupComplete() && startup_controller_->IsSetupInProgress();
1484 } 1485 }
1485 1486
1486 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> 1487 std::unique_ptr<syncer::SyncSetupInProgressHandle>
1487 ProfileSyncService::GetSetupInProgressHandle() { 1488 ProfileSyncService::GetSetupInProgressHandle() {
1488 if (++outstanding_setup_in_progress_handles_ == 1) { 1489 if (++outstanding_setup_in_progress_handles_ == 1) {
1489 DCHECK(!startup_controller_->IsSetupInProgress()); 1490 DCHECK(!startup_controller_->IsSetupInProgress());
1490 startup_controller_->SetSetupInProgress(true); 1491 startup_controller_->SetSetupInProgress(true);
1491 1492
1492 NotifyObservers(); 1493 NotifyObservers();
1493 } 1494 }
1494 1495
1495 return std::unique_ptr<sync_driver::SyncSetupInProgressHandle>( 1496 return std::unique_ptr<syncer::SyncSetupInProgressHandle>(
1496 new sync_driver::SyncSetupInProgressHandle( 1497 new syncer::SyncSetupInProgressHandle(
1497 base::Bind(&ProfileSyncService::OnSetupInProgressHandleDestroyed, 1498 base::Bind(&ProfileSyncService::OnSetupInProgressHandleDestroyed,
1498 weak_factory_.GetWeakPtr()))); 1499 weak_factory_.GetWeakPtr())));
1499 } 1500 }
1500 1501
1501 bool ProfileSyncService::IsSyncAllowed() const { 1502 bool ProfileSyncService::IsSyncAllowed() const {
1502 return IsSyncAllowedByFlag() && !IsManaged() && IsSyncAllowedByPlatform(); 1503 return IsSyncAllowedByFlag() && !IsManaged() && IsSyncAllowedByPlatform();
1503 } 1504 }
1504 1505
1505 bool ProfileSyncService::IsSyncActive() const { 1506 bool ProfileSyncService::IsSyncActive() const {
1506 return backend_initialized_ && data_type_manager_ && 1507 return backend_initialized_ && data_type_manager_ &&
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 bool sync_everything, 1575 bool sync_everything,
1575 const syncer::ModelTypeSet chosen_types) const { 1576 const syncer::ModelTypeSet chosen_types) const {
1576 if (!IsFirstSetupComplete() || 1577 if (!IsFirstSetupComplete() ||
1577 sync_everything != sync_prefs_.HasKeepEverythingSynced()) { 1578 sync_everything != sync_prefs_.HasKeepEverythingSynced()) {
1578 UMA_HISTOGRAM_BOOLEAN("Sync.SyncEverything", sync_everything); 1579 UMA_HISTOGRAM_BOOLEAN("Sync.SyncEverything", sync_everything);
1579 } 1580 }
1580 1581
1581 // Only log the data types that are shown in the sync settings ui. 1582 // Only log the data types that are shown in the sync settings ui.
1582 // Note: the order of these types must match the ordering of 1583 // Note: the order of these types must match the ordering of
1583 // the respective types in ModelType 1584 // the respective types in ModelType
1584 const sync_driver::user_selectable_type::UserSelectableSyncType 1585 const syncer::user_selectable_type::UserSelectableSyncType
1585 user_selectable_types[] = { 1586 user_selectable_types[] = {
1586 sync_driver::user_selectable_type::BOOKMARKS, 1587 syncer::user_selectable_type::BOOKMARKS,
1587 sync_driver::user_selectable_type::PREFERENCES, 1588 syncer::user_selectable_type::PREFERENCES,
1588 sync_driver::user_selectable_type::PASSWORDS, 1589 syncer::user_selectable_type::PASSWORDS,
1589 sync_driver::user_selectable_type::AUTOFILL, 1590 syncer::user_selectable_type::AUTOFILL,
1590 sync_driver::user_selectable_type::THEMES, 1591 syncer::user_selectable_type::THEMES,
1591 sync_driver::user_selectable_type::TYPED_URLS, 1592 syncer::user_selectable_type::TYPED_URLS,
1592 sync_driver::user_selectable_type::EXTENSIONS, 1593 syncer::user_selectable_type::EXTENSIONS,
1593 sync_driver::user_selectable_type::APPS, 1594 syncer::user_selectable_type::APPS,
1594 sync_driver::user_selectable_type::PROXY_TABS, 1595 syncer::user_selectable_type::PROXY_TABS,
1595 }; 1596 };
1596 1597
1597 static_assert(39 == syncer::MODEL_TYPE_COUNT, 1598 static_assert(39 == syncer::MODEL_TYPE_COUNT,
1598 "custom config histogram must be updated"); 1599 "custom config histogram must be updated");
1599 1600
1600 if (!sync_everything) { 1601 if (!sync_everything) {
1601 const syncer::ModelTypeSet current_types = GetPreferredDataTypes(); 1602 const syncer::ModelTypeSet current_types = GetPreferredDataTypes();
1602 1603
1603 syncer::ModelTypeSet type_set = syncer::UserSelectableTypes(); 1604 syncer::ModelTypeSet type_set = syncer::UserSelectableTypes();
1604 syncer::ModelTypeSet::Iterator it = type_set.First(); 1605 syncer::ModelTypeSet::Iterator it = type_set.First();
1605 1606
1606 DCHECK_EQ(arraysize(user_selectable_types), type_set.Size()); 1607 DCHECK_EQ(arraysize(user_selectable_types), type_set.Size());
1607 1608
1608 for (size_t i = 0; i < arraysize(user_selectable_types) && it.Good(); 1609 for (size_t i = 0; i < arraysize(user_selectable_types) && it.Good();
1609 ++i, it.Inc()) { 1610 ++i, it.Inc()) {
1610 const syncer::ModelType type = it.Get(); 1611 const syncer::ModelType type = it.Get();
1611 if (chosen_types.Has(type) && 1612 if (chosen_types.Has(type) &&
1612 (!IsFirstSetupComplete() || !current_types.Has(type))) { 1613 (!IsFirstSetupComplete() || !current_types.Has(type))) {
1613 // Selected type has changed - log it. 1614 // Selected type has changed - log it.
1614 UMA_HISTOGRAM_ENUMERATION( 1615 UMA_HISTOGRAM_ENUMERATION(
1615 "Sync.CustomSync", user_selectable_types[i], 1616 "Sync.CustomSync", user_selectable_types[i],
1616 sync_driver::user_selectable_type::SELECTABLE_DATATYPE_COUNT + 1); 1617 syncer::user_selectable_type::SELECTABLE_DATATYPE_COUNT + 1);
1617 } 1618 }
1618 } 1619 }
1619 } 1620 }
1620 } 1621 }
1621 1622
1622 #if defined(OS_CHROMEOS) 1623 #if defined(OS_CHROMEOS)
1623 void ProfileSyncService::RefreshSpareBootstrapToken( 1624 void ProfileSyncService::RefreshSpareBootstrapToken(
1624 const std::string& passphrase) { 1625 const std::string& passphrase) {
1625 sync_driver::SystemEncryptor encryptor; 1626 syncer::SystemEncryptor encryptor;
1626 syncer::Cryptographer temp_cryptographer(&encryptor); 1627 syncer::Cryptographer temp_cryptographer(&encryptor);
1627 // The first 2 params (hostname and username) doesn't have any effect here. 1628 // The first 2 params (hostname and username) doesn't have any effect here.
1628 syncer::KeyParams key_params = {"localhost", "dummy", passphrase}; 1629 syncer::KeyParams key_params = {"localhost", "dummy", passphrase};
1629 1630
1630 std::string bootstrap_token; 1631 std::string bootstrap_token;
1631 if (!temp_cryptographer.AddKey(key_params)) { 1632 if (!temp_cryptographer.AddKey(key_params)) {
1632 NOTREACHED() << "Failed to add key to cryptographer."; 1633 NOTREACHED() << "Failed to add key to cryptographer.";
1633 } 1634 }
1634 temp_cryptographer.GetBootstrapToken(&bootstrap_token); 1635 temp_cryptographer.GetBootstrapToken(&bootstrap_token);
1635 sync_prefs_.SetSpareBootstrapToken(bootstrap_token); 1636 sync_prefs_.SetSpareBootstrapToken(bootstrap_token);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 1668
1668 syncer::ModelTypeSet ProfileSyncService::GetActiveDataTypes() const { 1669 syncer::ModelTypeSet ProfileSyncService::GetActiveDataTypes() const {
1669 if (!IsSyncActive() || !ConfigurationDone()) 1670 if (!IsSyncActive() || !ConfigurationDone())
1670 return syncer::ModelTypeSet(); 1671 return syncer::ModelTypeSet();
1671 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes(); 1672 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes();
1672 const syncer::ModelTypeSet failed_types = 1673 const syncer::ModelTypeSet failed_types =
1673 data_type_status_table_.GetFailedTypes(); 1674 data_type_status_table_.GetFailedTypes();
1674 return Difference(preferred_types, failed_types); 1675 return Difference(preferred_types, failed_types);
1675 } 1676 }
1676 1677
1677 sync_driver::SyncClient* ProfileSyncService::GetSyncClient() const { 1678 syncer::SyncClient* ProfileSyncService::GetSyncClient() const {
1678 return sync_client_.get(); 1679 return sync_client_.get();
1679 } 1680 }
1680 1681
1681 syncer::ModelTypeSet ProfileSyncService::GetPreferredDataTypes() const { 1682 syncer::ModelTypeSet ProfileSyncService::GetPreferredDataTypes() const {
1682 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); 1683 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes();
1683 const syncer::ModelTypeSet preferred_types = 1684 const syncer::ModelTypeSet preferred_types =
1684 Union(sync_prefs_.GetPreferredDataTypes(registered_types), 1685 Union(sync_prefs_.GetPreferredDataTypes(registered_types),
1685 syncer::ControlTypes()); 1686 syncer::ControlTypes());
1686 const syncer::ModelTypeSet enforced_types = 1687 const syncer::ModelTypeSet enforced_types =
1687 Intersection(GetDataTypesFromPreferenceProviders(), registered_types); 1688 Intersection(GetDataTypesFromPreferenceProviders(), registered_types);
(...skipping 20 matching lines...) Expand all
1708 } 1709 }
1709 1710
1710 bool ProfileSyncService::IsUsingSecondaryPassphrase() const { 1711 bool ProfileSyncService::IsUsingSecondaryPassphrase() const {
1711 syncer::PassphraseType passphrase_type = GetPassphraseType(); 1712 syncer::PassphraseType passphrase_type = GetPassphraseType();
1712 return passphrase_type == 1713 return passphrase_type ==
1713 syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE || 1714 syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE ||
1714 passphrase_type == syncer::PassphraseType::CUSTOM_PASSPHRASE; 1715 passphrase_type == syncer::PassphraseType::CUSTOM_PASSPHRASE;
1715 } 1716 }
1716 1717
1717 std::string ProfileSyncService::GetCustomPassphraseKey() const { 1718 std::string ProfileSyncService::GetCustomPassphraseKey() const {
1718 sync_driver::SystemEncryptor encryptor; 1719 syncer::SystemEncryptor encryptor;
1719 syncer::Cryptographer cryptographer(&encryptor); 1720 syncer::Cryptographer cryptographer(&encryptor);
1720 cryptographer.Bootstrap(sync_prefs_.GetEncryptionBootstrapToken()); 1721 cryptographer.Bootstrap(sync_prefs_.GetEncryptionBootstrapToken());
1721 return cryptographer.GetDefaultNigoriKeyData(); 1722 return cryptographer.GetDefaultNigoriKeyData();
1722 } 1723 }
1723 1724
1724 syncer::PassphraseType ProfileSyncService::GetPassphraseType() const { 1725 syncer::PassphraseType ProfileSyncService::GetPassphraseType() const {
1725 return backend_->GetPassphraseType(); 1726 return backend_->GetPassphraseType();
1726 } 1727 }
1727 1728
1728 base::Time ProfileSyncService::GetExplicitPassphraseTime() const { 1729 base::Time ProfileSyncService::GetExplicitPassphraseTime() const {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 cookie_jar_mismatch = false; 2098 cookie_jar_mismatch = false;
2098 break; 2099 break;
2099 } 2100 }
2100 } 2101 }
2101 2102
2102 DVLOG(1) << "Cookie jar mismatch: " << cookie_jar_mismatch; 2103 DVLOG(1) << "Cookie jar mismatch: " << cookie_jar_mismatch;
2103 DVLOG(1) << "Cookie jar empty: " << cookie_jar_empty; 2104 DVLOG(1) << "Cookie jar empty: " << cookie_jar_empty;
2104 backend_->OnCookieJarChanged(cookie_jar_mismatch, cookie_jar_empty); 2105 backend_->OnCookieJarChanged(cookie_jar_mismatch, cookie_jar_empty);
2105 } 2106 }
2106 2107
2107 void ProfileSyncService::AddObserver( 2108 void ProfileSyncService::AddObserver(syncer::SyncServiceObserver* observer) {
2108 sync_driver::SyncServiceObserver* observer) {
2109 observers_.AddObserver(observer); 2109 observers_.AddObserver(observer);
2110 } 2110 }
2111 2111
2112 void ProfileSyncService::RemoveObserver( 2112 void ProfileSyncService::RemoveObserver(syncer::SyncServiceObserver* observer) {
2113 sync_driver::SyncServiceObserver* observer) {
2114 observers_.RemoveObserver(observer); 2113 observers_.RemoveObserver(observer);
2115 } 2114 }
2116 2115
2117 void ProfileSyncService::AddProtocolEventObserver( 2116 void ProfileSyncService::AddProtocolEventObserver(
2118 ProtocolEventObserver* observer) { 2117 ProtocolEventObserver* observer) {
2119 protocol_event_observers_.AddObserver(observer); 2118 protocol_event_observers_.AddObserver(observer);
2120 if (HasSyncingBackend()) { 2119 if (HasSyncingBackend()) {
2121 backend_->RequestBufferedProtocolEventsAndEnableForwarding(); 2120 backend_->RequestBufferedProtocolEventsAndEnableForwarding();
2122 } 2121 }
2123 } 2122 }
(...skipping 19 matching lines...) Expand all
2143 void ProfileSyncService::RemoveTypeDebugInfoObserver( 2142 void ProfileSyncService::RemoveTypeDebugInfoObserver(
2144 syncer::TypeDebugInfoObserver* type_debug_info_observer) { 2143 syncer::TypeDebugInfoObserver* type_debug_info_observer) {
2145 type_debug_info_observers_.RemoveObserver(type_debug_info_observer); 2144 type_debug_info_observers_.RemoveObserver(type_debug_info_observer);
2146 if (!type_debug_info_observers_.might_have_observers() && 2145 if (!type_debug_info_observers_.might_have_observers() &&
2147 backend_initialized_) { 2146 backend_initialized_) {
2148 backend_->DisableDirectoryTypeDebugInfoForwarding(); 2147 backend_->DisableDirectoryTypeDebugInfoForwarding();
2149 } 2148 }
2150 } 2149 }
2151 2150
2152 void ProfileSyncService::AddPreferenceProvider( 2151 void ProfileSyncService::AddPreferenceProvider(
2153 SyncTypePreferenceProvider* provider) { 2152 syncer::SyncTypePreferenceProvider* provider) {
2154 DCHECK(!HasPreferenceProvider(provider)) 2153 DCHECK(!HasPreferenceProvider(provider))
2155 << "Providers may only be added once!"; 2154 << "Providers may only be added once!";
2156 preference_providers_.insert(provider); 2155 preference_providers_.insert(provider);
2157 } 2156 }
2158 2157
2159 void ProfileSyncService::RemovePreferenceProvider( 2158 void ProfileSyncService::RemovePreferenceProvider(
2160 SyncTypePreferenceProvider* provider) { 2159 syncer::SyncTypePreferenceProvider* provider) {
2161 DCHECK(HasPreferenceProvider(provider)) 2160 DCHECK(HasPreferenceProvider(provider))
2162 << "Only providers that have been added before can be removed!"; 2161 << "Only providers that have been added before can be removed!";
2163 preference_providers_.erase(provider); 2162 preference_providers_.erase(provider);
2164 } 2163 }
2165 2164
2166 bool ProfileSyncService::HasPreferenceProvider( 2165 bool ProfileSyncService::HasPreferenceProvider(
2167 SyncTypePreferenceProvider* provider) const { 2166 syncer::SyncTypePreferenceProvider* provider) const {
2168 return preference_providers_.count(provider) > 0; 2167 return preference_providers_.count(provider) > 0;
2169 } 2168 }
2170 2169
2171 namespace { 2170 namespace {
2172 2171
2173 class GetAllNodesRequestHelper 2172 class GetAllNodesRequestHelper
2174 : public base::RefCountedThreadSafe<GetAllNodesRequestHelper> { 2173 : public base::RefCountedThreadSafe<GetAllNodesRequestHelper> {
2175 public: 2174 public:
2176 GetAllNodesRequestHelper( 2175 GetAllNodesRequestHelper(
2177 syncer::ModelTypeSet requested_types, 2176 syncer::ModelTypeSet requested_types,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2245 } 2244 }
2246 2245
2247 for (ModelTypeSet::Iterator it = all_types.First(); it.Good(); it.Inc()) { 2246 for (ModelTypeSet::Iterator it = all_types.First(); it.Good(); it.Inc()) {
2248 const auto& dtc_iter = data_type_controllers_.find(it.Get()); 2247 const auto& dtc_iter = data_type_controllers_.find(it.Get());
2249 if (dtc_iter != data_type_controllers_.end()) { 2248 if (dtc_iter != data_type_controllers_.end()) {
2250 dtc_iter->second->GetAllNodes(base::Bind( 2249 dtc_iter->second->GetAllNodes(base::Bind(
2251 &GetAllNodesRequestHelper::OnReceivedNodesForType, helper)); 2250 &GetAllNodesRequestHelper::OnReceivedNodesForType, helper));
2252 } else { 2251 } else {
2253 // Control Types 2252 // Control Types
2254 helper->OnReceivedNodesForType( 2253 helper->OnReceivedNodesForType(
2255 it.Get(), sync_driver::DirectoryDataTypeController:: 2254 it.Get(),
2256 GetAllNodesForTypeFromDirectory( 2255 syncer::DirectoryDataTypeController::GetAllNodesForTypeFromDirectory(
2257 it.Get(), GetUserShare()->directory.get())); 2256 it.Get(), GetUserShare()->directory.get()));
2258 } 2257 }
2259 } 2258 }
2260 } 2259 }
2261 2260
2262 bool ProfileSyncService::HasObserver( 2261 bool ProfileSyncService::HasObserver(
2263 const sync_driver::SyncServiceObserver* observer) const { 2262 const syncer::SyncServiceObserver* observer) const {
2264 return observers_.HasObserver(observer); 2263 return observers_.HasObserver(observer);
2265 } 2264 }
2266 2265
2267 base::WeakPtr<syncer::JsController> ProfileSyncService::GetJsController() { 2266 base::WeakPtr<syncer::JsController> ProfileSyncService::GetJsController() {
2268 return sync_js_controller_.AsWeakPtr(); 2267 return sync_js_controller_.AsWeakPtr();
2269 } 2268 }
2270 2269
2271 void ProfileSyncService::SyncEvent(SyncEventCodes code) { 2270 void ProfileSyncService::SyncEvent(SyncEventCodes code) {
2272 UMA_HISTOGRAM_ENUMERATION("Sync.EventCodes", code, MAX_SYNC_EVENT_CODE); 2271 UMA_HISTOGRAM_ENUMERATION("Sync.EventCodes", code, MAX_SYNC_EVENT_CODE);
2273 } 2272 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2329 << "Unrecoverable error."; 2328 << "Unrecoverable error.";
2330 } else { 2329 } else {
2331 DVLOG(0) << "ConfigureDataTypeManager not invoked because backend is not " 2330 DVLOG(0) << "ConfigureDataTypeManager not invoked because backend is not "
2332 << "initialized"; 2331 << "initialized";
2333 } 2332 }
2334 } 2333 }
2335 2334
2336 syncer::ModelTypeSet ProfileSyncService::GetDataTypesFromPreferenceProviders() 2335 syncer::ModelTypeSet ProfileSyncService::GetDataTypesFromPreferenceProviders()
2337 const { 2336 const {
2338 syncer::ModelTypeSet types; 2337 syncer::ModelTypeSet types;
2339 for (std::set<SyncTypePreferenceProvider*>::const_iterator it = 2338 for (std::set<syncer::SyncTypePreferenceProvider*>::const_iterator it =
2340 preference_providers_.begin(); 2339 preference_providers_.begin();
2341 it != preference_providers_.end(); ++it) { 2340 it != preference_providers_.end(); ++it) {
2342 types.PutAll((*it)->GetPreferredDataTypes()); 2341 types.PutAll((*it)->GetPreferredDataTypes());
2343 } 2342 }
2344 return types; 2343 return types;
2345 } 2344 }
2346 2345
2347 const DataTypeStatusTable& ProfileSyncService::data_type_status_table() const { 2346 const DataTypeStatusTable& ProfileSyncService::data_type_status_table() const {
2348 return data_type_status_table_; 2347 return data_type_status_table_;
2349 } 2348 }
(...skipping 21 matching lines...) Expand all
2371 } 2370 }
2372 2371
2373 syncer::SyncableService* ProfileSyncService::GetSessionsSyncableService() { 2372 syncer::SyncableService* ProfileSyncService::GetSessionsSyncableService() {
2374 return sessions_sync_manager_.get(); 2373 return sessions_sync_manager_.get();
2375 } 2374 }
2376 2375
2377 syncer::SyncableService* ProfileSyncService::GetDeviceInfoSyncableService() { 2376 syncer::SyncableService* ProfileSyncService::GetDeviceInfoSyncableService() {
2378 return device_info_sync_service_.get(); 2377 return device_info_sync_service_.get();
2379 } 2378 }
2380 2379
2381 syncer_v2::ModelTypeService* ProfileSyncService::GetDeviceInfoService() { 2380 syncer::ModelTypeService* ProfileSyncService::GetDeviceInfoService() {
2382 return device_info_service_.get(); 2381 return device_info_service_.get();
2383 } 2382 }
2384 2383
2385 sync_driver::SyncService::SyncTokenStatus 2384 syncer::SyncService::SyncTokenStatus ProfileSyncService::GetSyncTokenStatus()
2386 ProfileSyncService::GetSyncTokenStatus() const { 2385 const {
2387 SyncTokenStatus status; 2386 SyncTokenStatus status;
2388 status.connection_status_update_time = connection_status_update_time_; 2387 status.connection_status_update_time = connection_status_update_time_;
2389 status.connection_status = connection_status_; 2388 status.connection_status = connection_status_;
2390 status.token_request_time = token_request_time_; 2389 status.token_request_time = token_request_time_;
2391 status.token_receive_time = token_receive_time_; 2390 status.token_receive_time = token_receive_time_;
2392 status.last_get_token_error = last_get_token_error_; 2391 status.last_get_token_error = last_get_token_error_;
2393 if (request_access_token_retry_timer_.IsRunning()) 2392 if (request_access_token_retry_timer_.IsRunning())
2394 status.next_token_request_time = next_token_request_time_; 2393 status.next_token_request_time = next_token_request_time_;
2395 return status; 2394 return status;
2396 } 2395 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 2503
2505 DCHECK(startup_controller_->IsSetupInProgress()); 2504 DCHECK(startup_controller_->IsSetupInProgress());
2506 startup_controller_->SetSetupInProgress(false); 2505 startup_controller_->SetSetupInProgress(false);
2507 2506
2508 if (IsBackendInitialized()) 2507 if (IsBackendInitialized())
2509 ReconfigureDatatypeManager(); 2508 ReconfigureDatatypeManager();
2510 NotifyObservers(); 2509 NotifyObservers();
2511 } 2510 }
2512 2511
2513 } // namespace browser_sync 2512 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698