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

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

Issue 2388163002: [Sync] Move //components/sync to the syncer namespace, take 2. (Closed)
Patch Set: Rebase. 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #include "components/version_info/version_info_values.h" 80 #include "components/version_info/version_info_values.h"
81 #include "net/cookies/cookie_monster.h" 81 #include "net/cookies/cookie_monster.h"
82 #include "net/url_request/url_request_context_getter.h" 82 #include "net/url_request/url_request_context_getter.h"
83 #include "ui/base/l10n/l10n_util.h" 83 #include "ui/base/l10n/l10n_util.h"
84 #include "ui/base/l10n/time_format.h" 84 #include "ui/base/l10n/time_format.h"
85 85
86 #if defined(OS_ANDROID) 86 #if defined(OS_ANDROID)
87 #include "components/sync/core/read_transaction.h" 87 #include "components/sync/core/read_transaction.h"
88 #endif 88 #endif
89 89
90 using sync_driver::ChangeProcessor;
91 using sync_driver::DataTypeController;
92 using sync_driver::DataTypeManager;
93 using sync_driver::DataTypeStatusTable;
94 using sync_driver::DeviceInfoSyncService;
95 using sync_driver_v2::DeviceInfoService;
96 using sync_sessions::SessionsSyncManager; 90 using sync_sessions::SessionsSyncManager;
97 using syncer::ModelType; 91 using syncer::BackendMigrator;
98 using syncer::ModelTypeSet; 92 using syncer::ChangeProcessor;
93 using syncer::DataTypeController;
94 using syncer::DataTypeManager;
95 using syncer::DataTypeStatusTable;
96 using syncer::DeviceInfoService;
97 using syncer::DeviceInfoSyncService;
99 using syncer::JsBackend; 98 using syncer::JsBackend;
100 using syncer::JsController; 99 using syncer::JsController;
101 using syncer::JsEventDetails; 100 using syncer::JsEventDetails;
102 using syncer::JsEventHandler; 101 using syncer::JsEventHandler;
103 using syncer::ModelSafeRoutingInfo; 102 using syncer::ModelSafeRoutingInfo;
103 using syncer::ModelType;
104 using syncer::ModelTypeSet;
105 using syncer::ModelTypeStore;
106 using syncer::ProtocolEventObserver;
107 using syncer::SharedModelTypeProcessor;
108 using syncer::SyncBackendHost;
104 using syncer::SyncCredentials; 109 using syncer::SyncCredentials;
105 using syncer::SyncProtocolError; 110 using syncer::SyncProtocolError;
106 using syncer::WeakHandle; 111 using syncer::WeakHandle;
107 using syncer_v2::ModelTypeStore;
108 using syncer_v2::SharedModelTypeProcessor;
109 112
110 namespace browser_sync { 113 namespace browser_sync {
111 114
112 typedef GoogleServiceAuthError AuthError; 115 typedef GoogleServiceAuthError AuthError;
113 116
114 const char kSyncUnrecoverableErrorHistogram[] = "Sync.UnrecoverableErrors"; 117 const char kSyncUnrecoverableErrorHistogram[] = "Sync.UnrecoverableErrors";
115 118
116 const net::BackoffEntry::Policy kRequestAccessTokenBackoffPolicy = { 119 const net::BackoffEntry::Policy kRequestAccessTokenBackoffPolicy = {
117 // Number of initial errors (in sequence) to ignore before applying 120 // Number of initial errors (in sequence) to ignore before applying
118 // exponential back-off rules. 121 // exponential back-off rules.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 file_thread(std::move(other.file_thread)), 187 file_thread(std::move(other.file_thread)),
185 blocking_pool(other.blocking_pool) {} 188 blocking_pool(other.blocking_pool) {}
186 189
187 ProfileSyncService::ProfileSyncService(InitParams init_params) 190 ProfileSyncService::ProfileSyncService(InitParams init_params)
188 : OAuth2TokenService::Consumer("sync"), 191 : OAuth2TokenService::Consumer("sync"),
189 last_auth_error_(AuthError::AuthErrorNone()), 192 last_auth_error_(AuthError::AuthErrorNone()),
190 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED), 193 passphrase_required_reason_(syncer::REASON_PASSPHRASE_NOT_REQUIRED),
191 sync_client_(std::move(init_params.sync_client)), 194 sync_client_(std::move(init_params.sync_client)),
192 sync_prefs_(sync_client_->GetPrefService()), 195 sync_prefs_(sync_client_->GetPrefService()),
193 sync_service_url_( 196 sync_service_url_(
194 GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(), 197 syncer::GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(),
195 init_params.channel)), 198 init_params.channel)),
196 network_time_update_callback_( 199 network_time_update_callback_(
197 std::move(init_params.network_time_update_callback)), 200 std::move(init_params.network_time_update_callback)),
198 base_directory_(init_params.base_directory), 201 base_directory_(init_params.base_directory),
199 url_request_context_(init_params.url_request_context), 202 url_request_context_(init_params.url_request_context),
200 debug_identifier_(std::move(init_params.debug_identifier)), 203 debug_identifier_(std::move(init_params.debug_identifier)),
201 channel_(init_params.channel), 204 channel_(init_params.channel),
202 db_thread_(init_params.db_thread), 205 db_thread_(init_params.db_thread),
203 file_thread_(init_params.file_thread), 206 file_thread_(init_params.file_thread),
204 blocking_pool_(init_params.blocking_pool), 207 blocking_pool_(init_params.blocking_pool),
205 is_first_time_sync_configure_(false), 208 is_first_time_sync_configure_(false),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 254
252 bool ProfileSyncService::CanSyncStart() const { 255 bool ProfileSyncService::CanSyncStart() const {
253 return IsSyncAllowed() && IsSyncRequested() && IsSignedIn(); 256 return IsSyncAllowed() && IsSyncRequested() && IsSignedIn();
254 } 257 }
255 258
256 void ProfileSyncService::Initialize() { 259 void ProfileSyncService::Initialize() {
257 sync_client_->Initialize(); 260 sync_client_->Initialize();
258 261
259 // We don't pass StartupController an Unretained reference to future-proof 262 // We don't pass StartupController an Unretained reference to future-proof
260 // against the controller impl changing to post tasks. 263 // against the controller impl changing to post tasks.
261 startup_controller_.reset(new StartupController( 264 startup_controller_.reset(new syncer::StartupController(
262 &sync_prefs_, 265 &sync_prefs_,
263 base::Bind(&ProfileSyncService::CanBackendStart, base::Unretained(this)), 266 base::Bind(&ProfileSyncService::CanBackendStart, base::Unretained(this)),
264 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, 267 base::Bind(&ProfileSyncService::StartUpSlowBackendComponents,
265 weak_factory_.GetWeakPtr()))); 268 weak_factory_.GetWeakPtr())));
266 std::unique_ptr<sync_sessions::LocalSessionEventRouter> router( 269 std::unique_ptr<sync_sessions::LocalSessionEventRouter> router(
267 sync_client_->GetSyncSessionsClient()->GetLocalSessionEventRouter()); 270 sync_client_->GetSyncSessionsClient()->GetLocalSessionEventRouter());
268 local_device_ = sync_client_->GetSyncApiComponentFactory() 271 local_device_ = sync_client_->GetSyncApiComponentFactory()
269 ->CreateLocalDeviceInfoProvider(); 272 ->CreateLocalDeviceInfoProvider();
270 sync_stopped_reporter_.reset(new SyncStoppedReporter( 273 sync_stopped_reporter_.reset(new syncer::SyncStoppedReporter(
271 sync_service_url_, local_device_->GetSyncUserAgent(), 274 sync_service_url_, local_device_->GetSyncUserAgent(),
272 url_request_context_, SyncStoppedReporter::ResultCallback())); 275 url_request_context_, syncer::SyncStoppedReporter::ResultCallback()));
273 sessions_sync_manager_.reset(new SessionsSyncManager( 276 sessions_sync_manager_.reset(new SessionsSyncManager(
274 sync_client_->GetSyncSessionsClient(), &sync_prefs_, local_device_.get(), 277 sync_client_->GetSyncSessionsClient(), &sync_prefs_, local_device_.get(),
275 std::move(router), 278 std::move(router),
276 base::Bind(&ProfileSyncService::NotifyForeignSessionUpdated, 279 base::Bind(&ProfileSyncService::NotifyForeignSessionUpdated,
277 sync_enabled_weak_factory_.GetWeakPtr()), 280 sync_enabled_weak_factory_.GetWeakPtr()),
278 base::Bind(&ProfileSyncService::TriggerRefresh, 281 base::Bind(&ProfileSyncService::TriggerRefresh,
279 sync_enabled_weak_factory_.GetWeakPtr(), 282 sync_enabled_weak_factory_.GetWeakPtr(),
280 syncer::ModelTypeSet(syncer::SESSIONS)))); 283 syncer::ModelTypeSet(syncer::SESSIONS))));
281 284
282 if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) { 285 if (base::FeatureList::IsEnabled(switches::kSyncUSSDeviceInfo)) {
283 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( 286 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner(
284 blocking_pool_->GetSequencedTaskRunnerWithShutdownBehavior( 287 blocking_pool_->GetSequencedTaskRunnerWithShutdownBehavior(
285 blocking_pool_->GetSequenceToken(), 288 blocking_pool_->GetSequenceToken(),
286 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 289 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
287 // TODO(skym): Stop creating leveldb files when signed out. 290 // TODO(skym): Stop creating leveldb files when signed out.
288 // TODO(skym): Verify using AsUTF8Unsafe is okay here. Should work as long 291 // TODO(skym): Verify using AsUTF8Unsafe is okay here. Should work as long
289 // as the Local State file is guaranteed to be UTF-8. 292 // as the Local State file is guaranteed to be UTF-8.
290 device_info_service_.reset(new DeviceInfoService( 293 device_info_service_.reset(new DeviceInfoService(
291 local_device_.get(), 294 local_device_.get(),
292 base::Bind(&ModelTypeStore::CreateStore, syncer::DEVICE_INFO, 295 base::Bind(&ModelTypeStore::CreateStore, syncer::DEVICE_INFO,
293 directory_path_.Append(base::FilePath(kLevelDBFolderName)) 296 directory_path_.Append(base::FilePath(kLevelDBFolderName))
294 .AsUTF8Unsafe(), 297 .AsUTF8Unsafe(),
295 blocking_task_runner), 298 blocking_task_runner),
296 base::Bind(&SharedModelTypeProcessor::CreateAsChangeProcessor))); 299 base::Bind(&SharedModelTypeProcessor::CreateAsChangeProcessor)));
297 } else { 300 } else {
298 device_info_sync_service_.reset( 301 device_info_sync_service_.reset(
299 new DeviceInfoSyncService(local_device_.get())); 302 new DeviceInfoSyncService(local_device_.get()));
300 } 303 }
301 304
302 sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod 305 syncer::SyncApiComponentFactory::RegisterDataTypesMethod
303 register_platform_types_callback = 306 register_platform_types_callback =
304 sync_client_->GetRegisterPlatformTypesCallback(); 307 sync_client_->GetRegisterPlatformTypesCallback();
305 sync_client_->GetSyncApiComponentFactory()->RegisterDataTypes( 308 sync_client_->GetSyncApiComponentFactory()->RegisterDataTypes(
306 this, register_platform_types_callback); 309 this, register_platform_types_callback);
307 310
308 if (gaia_cookie_manager_service_) 311 if (gaia_cookie_manager_service_)
309 gaia_cookie_manager_service_->AddObserver(this); 312 gaia_cookie_manager_service_->AddObserver(this);
310 313
311 // We clear this here (vs Shutdown) because we want to remember that an error 314 // We clear this here (vs Shutdown) because we want to remember that an error
312 // happened on shutdown so we can display details (message, location) about it 315 // happened on shutdown so we can display details (message, location) about it
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 std::string bootstrap_token = sync_prefs_.GetEncryptionBootstrapToken(); 357 std::string bootstrap_token = sync_prefs_.GetEncryptionBootstrapToken();
355 if (bootstrap_token.empty()) { 358 if (bootstrap_token.empty()) {
356 sync_prefs_.SetEncryptionBootstrapToken( 359 sync_prefs_.SetEncryptionBootstrapToken(
357 sync_prefs_.GetSpareBootstrapToken()); 360 sync_prefs_.GetSpareBootstrapToken());
358 } 361 }
359 #endif 362 #endif
360 363
361 #if !defined(OS_ANDROID) 364 #if !defined(OS_ANDROID)
362 DCHECK(sync_error_controller_ == NULL) 365 DCHECK(sync_error_controller_ == NULL)
363 << "Initialize() called more than once."; 366 << "Initialize() called more than once.";
364 sync_error_controller_.reset(new SyncErrorController(this)); 367 sync_error_controller_.reset(new syncer::SyncErrorController(this));
365 AddObserver(sync_error_controller_.get()); 368 AddObserver(sync_error_controller_.get());
366 #endif 369 #endif
367 370
368 memory_pressure_listener_.reset(new base::MemoryPressureListener( 371 memory_pressure_listener_.reset(new base::MemoryPressureListener(
369 base::Bind(&ProfileSyncService::OnMemoryPressure, 372 base::Bind(&ProfileSyncService::OnMemoryPressure,
370 sync_enabled_weak_factory_.GetWeakPtr()))); 373 sync_enabled_weak_factory_.GetWeakPtr())));
371 startup_controller_->Reset(GetRegisteredDataTypes()); 374 startup_controller_->Reset(GetRegisteredDataTypes());
372 375
373 // Auto-start means means the first time the profile starts up, sync should 376 // Auto-start means means the first time the profile starts up, sync should
374 // start up immediately. 377 // start up immediately.
(...skipping 25 matching lines...) Expand all
400 signin()->AddObserver(this); 403 signin()->AddObserver(this);
401 } 404 }
402 405
403 void ProfileSyncService::UnregisterAuthNotifications() { 406 void ProfileSyncService::UnregisterAuthNotifications() {
404 if (signin()) 407 if (signin())
405 signin()->RemoveObserver(this); 408 signin()->RemoveObserver(this);
406 oauth2_token_service_->RemoveObserver(this); 409 oauth2_token_service_->RemoveObserver(this);
407 } 410 }
408 411
409 void ProfileSyncService::RegisterDataTypeController( 412 void ProfileSyncService::RegisterDataTypeController(
410 std::unique_ptr<sync_driver::DataTypeController> data_type_controller) { 413 std::unique_ptr<syncer::DataTypeController> data_type_controller) {
411 DCHECK_EQ(data_type_controllers_.count(data_type_controller->type()), 0U); 414 DCHECK_EQ(data_type_controllers_.count(data_type_controller->type()), 0U);
412 data_type_controllers_[data_type_controller->type()] = 415 data_type_controllers_[data_type_controller->type()] =
413 std::move(data_type_controller); 416 std::move(data_type_controller);
414 } 417 }
415 418
416 bool ProfileSyncService::IsDataTypeControllerRunning( 419 bool ProfileSyncService::IsDataTypeControllerRunning(
417 syncer::ModelType type) const { 420 syncer::ModelType type) const {
418 DataTypeController::TypeMap::const_iterator iter = 421 DataTypeController::TypeMap::const_iterator iter =
419 data_type_controllers_.find(type); 422 data_type_controllers_.find(type);
420 if (iter == data_type_controllers_.end()) { 423 if (iter == data_type_controllers_.end()) {
421 return false; 424 return false;
422 } 425 }
423 return iter->second->state() == DataTypeController::RUNNING; 426 return iter->second->state() == DataTypeController::RUNNING;
424 } 427 }
425 428
426 sync_sessions::OpenTabsUIDelegate* ProfileSyncService::GetOpenTabsUIDelegate() { 429 sync_sessions::OpenTabsUIDelegate* ProfileSyncService::GetOpenTabsUIDelegate() {
427 if (!IsDataTypeControllerRunning(syncer::SESSIONS)) 430 if (!IsDataTypeControllerRunning(syncer::SESSIONS))
428 return NULL; 431 return NULL;
429 return sessions_sync_manager_.get(); 432 return sessions_sync_manager_.get();
430 } 433 }
431 434
432 sync_sessions::FaviconCache* ProfileSyncService::GetFaviconCache() { 435 sync_sessions::FaviconCache* ProfileSyncService::GetFaviconCache() {
433 return sessions_sync_manager_->GetFaviconCache(); 436 return sessions_sync_manager_->GetFaviconCache();
434 } 437 }
435 438
436 sync_driver::DeviceInfoTracker* ProfileSyncService::GetDeviceInfoTracker() 439 syncer::DeviceInfoTracker* ProfileSyncService::GetDeviceInfoTracker() const {
437 const {
438 // One of the two should always be non-null after initialization is done. 440 // One of the two should always be non-null after initialization is done.
439 if (device_info_service_) { 441 if (device_info_service_) {
440 return device_info_service_.get(); 442 return device_info_service_.get();
441 } else { 443 } else {
442 return device_info_sync_service_.get(); 444 return device_info_sync_service_.get();
443 } 445 }
444 } 446 }
445 447
446 sync_driver::LocalDeviceInfoProvider* 448 syncer::LocalDeviceInfoProvider*
447 ProfileSyncService::GetLocalDeviceInfoProvider() const { 449 ProfileSyncService::GetLocalDeviceInfoProvider() const {
448 return local_device_.get(); 450 return local_device_.get();
449 } 451 }
450 452
451 void ProfileSyncService::GetDataTypeControllerStates( 453 void ProfileSyncService::GetDataTypeControllerStates(
452 DataTypeController::StateMap* state_map) const { 454 DataTypeController::StateMap* state_map) const {
453 for (DataTypeController::TypeMap::const_iterator iter = 455 for (DataTypeController::TypeMap::const_iterator iter =
454 data_type_controllers_.begin(); 456 data_type_controllers_.begin();
455 iter != data_type_controllers_.end(); ++iter) 457 iter != data_type_controllers_.end(); ++iter)
456 (*state_map)[iter->first] = iter->second.get()->state(); 458 (*state_map)[iter->first] = iter->second.get()->state();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 base::Unretained(network_resources_.get()), 506 base::Unretained(network_resources_.get()),
505 url_request_context_, network_time_update_callback_); 507 url_request_context_, network_time_update_callback_);
506 508
507 backend_->Initialize( 509 backend_->Initialize(
508 this, std::move(sync_thread_), db_thread_, file_thread_, 510 this, std::move(sync_thread_), db_thread_, file_thread_,
509 GetJsEventHandler(), sync_service_url_, local_device_->GetSyncUserAgent(), 511 GetJsEventHandler(), sync_service_url_, local_device_->GetSyncUserAgent(),
510 credentials, delete_stale_data, 512 credentials, delete_stale_data,
511 std::unique_ptr<syncer::SyncManagerFactory>( 513 std::unique_ptr<syncer::SyncManagerFactory>(
512 new syncer::SyncManagerFactory()), 514 new syncer::SyncManagerFactory()),
513 MakeWeakHandle(sync_enabled_weak_factory_.GetWeakPtr()), 515 MakeWeakHandle(sync_enabled_weak_factory_.GetWeakPtr()),
514 base::Bind(ChromeReportUnrecoverableError, channel_), 516 base::Bind(syncer::ChromeReportUnrecoverableError, channel_),
515 http_post_provider_factory_getter, std::move(saved_nigori_state_)); 517 http_post_provider_factory_getter, std::move(saved_nigori_state_));
516 } 518 }
517 519
518 bool ProfileSyncService::IsEncryptedDatatypeEnabled() const { 520 bool ProfileSyncService::IsEncryptedDatatypeEnabled() const {
519 if (encryption_pending()) 521 if (encryption_pending())
520 return true; 522 return true;
521 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes(); 523 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes();
522 const syncer::ModelTypeSet encrypted_types = GetEncryptedDataTypes(); 524 const syncer::ModelTypeSet encrypted_types = GetEncryptedDataTypes();
523 DCHECK(encrypted_types.Has(syncer::PASSWORDS)); 525 DCHECK(encrypted_types.Has(syncer::PASSWORDS));
524 return !Intersection(preferred_types, encrypted_types).Empty(); 526 return !Intersection(preferred_types, encrypted_types).Empty();
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 if (IsBackendInitialized()) { 822 if (IsBackendInitialized()) {
821 ReconfigureDatatypeManager(); 823 ReconfigureDatatypeManager();
822 } 824 }
823 } 825 }
824 826
825 void ProfileSyncService::UpdateLastSyncedTime() { 827 void ProfileSyncService::UpdateLastSyncedTime() {
826 sync_prefs_.SetLastSyncedTime(base::Time::Now()); 828 sync_prefs_.SetLastSyncedTime(base::Time::Now());
827 } 829 }
828 830
829 void ProfileSyncService::NotifyObservers() { 831 void ProfileSyncService::NotifyObservers() {
830 FOR_EACH_OBSERVER(sync_driver::SyncServiceObserver, observers_, 832 FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_, OnStateChanged());
831 OnStateChanged());
832 } 833 }
833 834
834 void ProfileSyncService::NotifySyncCycleCompleted() { 835 void ProfileSyncService::NotifySyncCycleCompleted() {
835 FOR_EACH_OBSERVER(sync_driver::SyncServiceObserver, observers_, 836 FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_,
836 OnSyncCycleCompleted()); 837 OnSyncCycleCompleted());
837 } 838 }
838 839
839 void ProfileSyncService::NotifyForeignSessionUpdated() { 840 void ProfileSyncService::NotifyForeignSessionUpdated() {
840 FOR_EACH_OBSERVER(sync_driver::SyncServiceObserver, observers_, 841 FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_,
841 OnForeignSessionUpdated()); 842 OnForeignSessionUpdated());
842 } 843 }
843 844
844 void ProfileSyncService::ClearStaleErrors() { 845 void ProfileSyncService::ClearStaleErrors() {
845 ClearUnrecoverableError(); 846 ClearUnrecoverableError();
846 last_actionable_error_ = SyncProtocolError(); 847 last_actionable_error_ = SyncProtocolError();
847 // Clear the data type errors as well. 848 // Clear the data type errors as well.
848 if (data_type_manager_.get()) 849 if (data_type_manager_.get())
849 data_type_manager_->ResetDataTypeErrors(); 850 data_type_manager_->ResetDataTypeErrors();
850 } 851 }
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 if (is_first_time_sync_configure_) { 1318 if (is_first_time_sync_configure_) {
1318 UMA_HISTOGRAM_LONG_TIMES("Sync.ServiceInitialConfigureTime", delta); 1319 UMA_HISTOGRAM_LONG_TIMES("Sync.ServiceInitialConfigureTime", delta);
1319 } else { 1320 } else {
1320 UMA_HISTOGRAM_LONG_TIMES("Sync.ServiceSubsequentConfigureTime", delta); 1321 UMA_HISTOGRAM_LONG_TIMES("Sync.ServiceSubsequentConfigureTime", delta);
1321 } 1322 }
1322 } 1323 }
1323 sync_configure_start_time_ = base::Time(); 1324 sync_configure_start_time_ = base::Time();
1324 } 1325 }
1325 1326
1326 // Notify listeners that configuration is done. 1327 // Notify listeners that configuration is done.
1327 FOR_EACH_OBSERVER(sync_driver::SyncServiceObserver, observers_, 1328 FOR_EACH_OBSERVER(syncer::SyncServiceObserver, observers_,
1328 OnSyncConfigurationCompleted()); 1329 OnSyncConfigurationCompleted());
1329 1330
1330 DVLOG(1) << "PSS OnConfigureDone called with status: " << configure_status_; 1331 DVLOG(1) << "PSS OnConfigureDone called with status: " << configure_status_;
1331 // The possible status values: 1332 // The possible status values:
1332 // ABORT - Configuration was aborted. This is not an error, if 1333 // ABORT - Configuration was aborted. This is not an error, if
1333 // initiated by user. 1334 // initiated by user.
1334 // OK - Some or all types succeeded. 1335 // OK - Some or all types succeeded.
1335 // Everything else is an UnrecoverableError. So treat it as such. 1336 // Everything else is an UnrecoverableError. So treat it as such.
1336 1337
1337 // First handle the abort case. 1338 // First handle the abort case.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 } 1464 }
1464 1465
1465 bool ProfileSyncService::CanConfigureDataTypes() const { 1466 bool ProfileSyncService::CanConfigureDataTypes() const {
1466 return IsFirstSetupComplete() && !IsSetupInProgress(); 1467 return IsFirstSetupComplete() && !IsSetupInProgress();
1467 } 1468 }
1468 1469
1469 bool ProfileSyncService::IsFirstSetupInProgress() const { 1470 bool ProfileSyncService::IsFirstSetupInProgress() const {
1470 return !IsFirstSetupComplete() && startup_controller_->IsSetupInProgress(); 1471 return !IsFirstSetupComplete() && startup_controller_->IsSetupInProgress();
1471 } 1472 }
1472 1473
1473 std::unique_ptr<sync_driver::SyncSetupInProgressHandle> 1474 std::unique_ptr<syncer::SyncSetupInProgressHandle>
1474 ProfileSyncService::GetSetupInProgressHandle() { 1475 ProfileSyncService::GetSetupInProgressHandle() {
1475 if (++outstanding_setup_in_progress_handles_ == 1) { 1476 if (++outstanding_setup_in_progress_handles_ == 1) {
1476 DCHECK(!startup_controller_->IsSetupInProgress()); 1477 DCHECK(!startup_controller_->IsSetupInProgress());
1477 startup_controller_->SetSetupInProgress(true); 1478 startup_controller_->SetSetupInProgress(true);
1478 1479
1479 NotifyObservers(); 1480 NotifyObservers();
1480 } 1481 }
1481 1482
1482 return std::unique_ptr<sync_driver::SyncSetupInProgressHandle>( 1483 return std::unique_ptr<syncer::SyncSetupInProgressHandle>(
1483 new sync_driver::SyncSetupInProgressHandle( 1484 new syncer::SyncSetupInProgressHandle(
1484 base::Bind(&ProfileSyncService::OnSetupInProgressHandleDestroyed, 1485 base::Bind(&ProfileSyncService::OnSetupInProgressHandleDestroyed,
1485 weak_factory_.GetWeakPtr()))); 1486 weak_factory_.GetWeakPtr())));
1486 } 1487 }
1487 1488
1488 bool ProfileSyncService::IsSyncAllowed() const { 1489 bool ProfileSyncService::IsSyncAllowed() const {
1489 return IsSyncAllowedByFlag() && !IsManaged() && IsSyncAllowedByPlatform(); 1490 return IsSyncAllowedByFlag() && !IsManaged() && IsSyncAllowedByPlatform();
1490 } 1491 }
1491 1492
1492 bool ProfileSyncService::IsSyncActive() const { 1493 bool ProfileSyncService::IsSyncActive() const {
1493 return backend_initialized_ && data_type_manager_ && 1494 return backend_initialized_ && data_type_manager_ &&
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 bool sync_everything, 1562 bool sync_everything,
1562 const syncer::ModelTypeSet chosen_types) const { 1563 const syncer::ModelTypeSet chosen_types) const {
1563 if (!IsFirstSetupComplete() || 1564 if (!IsFirstSetupComplete() ||
1564 sync_everything != sync_prefs_.HasKeepEverythingSynced()) { 1565 sync_everything != sync_prefs_.HasKeepEverythingSynced()) {
1565 UMA_HISTOGRAM_BOOLEAN("Sync.SyncEverything", sync_everything); 1566 UMA_HISTOGRAM_BOOLEAN("Sync.SyncEverything", sync_everything);
1566 } 1567 }
1567 1568
1568 // Only log the data types that are shown in the sync settings ui. 1569 // Only log the data types that are shown in the sync settings ui.
1569 // Note: the order of these types must match the ordering of 1570 // Note: the order of these types must match the ordering of
1570 // the respective types in ModelType 1571 // the respective types in ModelType
1571 const sync_driver::user_selectable_type::UserSelectableSyncType 1572 const syncer::user_selectable_type::UserSelectableSyncType
1572 user_selectable_types[] = { 1573 user_selectable_types[] = {
1573 sync_driver::user_selectable_type::BOOKMARKS, 1574 syncer::user_selectable_type::BOOKMARKS,
1574 sync_driver::user_selectable_type::PREFERENCES, 1575 syncer::user_selectable_type::PREFERENCES,
1575 sync_driver::user_selectable_type::PASSWORDS, 1576 syncer::user_selectable_type::PASSWORDS,
1576 sync_driver::user_selectable_type::AUTOFILL, 1577 syncer::user_selectable_type::AUTOFILL,
1577 sync_driver::user_selectable_type::THEMES, 1578 syncer::user_selectable_type::THEMES,
1578 sync_driver::user_selectable_type::TYPED_URLS, 1579 syncer::user_selectable_type::TYPED_URLS,
1579 sync_driver::user_selectable_type::EXTENSIONS, 1580 syncer::user_selectable_type::EXTENSIONS,
1580 sync_driver::user_selectable_type::APPS, 1581 syncer::user_selectable_type::APPS,
1581 sync_driver::user_selectable_type::PROXY_TABS, 1582 syncer::user_selectable_type::PROXY_TABS,
1582 }; 1583 };
1583 1584
1584 static_assert(39 == syncer::MODEL_TYPE_COUNT, 1585 static_assert(39 == syncer::MODEL_TYPE_COUNT,
1585 "custom config histogram must be updated"); 1586 "custom config histogram must be updated");
1586 1587
1587 if (!sync_everything) { 1588 if (!sync_everything) {
1588 const syncer::ModelTypeSet current_types = GetPreferredDataTypes(); 1589 const syncer::ModelTypeSet current_types = GetPreferredDataTypes();
1589 1590
1590 syncer::ModelTypeSet type_set = syncer::UserSelectableTypes(); 1591 syncer::ModelTypeSet type_set = syncer::UserSelectableTypes();
1591 syncer::ModelTypeSet::Iterator it = type_set.First(); 1592 syncer::ModelTypeSet::Iterator it = type_set.First();
1592 1593
1593 DCHECK_EQ(arraysize(user_selectable_types), type_set.Size()); 1594 DCHECK_EQ(arraysize(user_selectable_types), type_set.Size());
1594 1595
1595 for (size_t i = 0; i < arraysize(user_selectable_types) && it.Good(); 1596 for (size_t i = 0; i < arraysize(user_selectable_types) && it.Good();
1596 ++i, it.Inc()) { 1597 ++i, it.Inc()) {
1597 const syncer::ModelType type = it.Get(); 1598 const syncer::ModelType type = it.Get();
1598 if (chosen_types.Has(type) && 1599 if (chosen_types.Has(type) &&
1599 (!IsFirstSetupComplete() || !current_types.Has(type))) { 1600 (!IsFirstSetupComplete() || !current_types.Has(type))) {
1600 // Selected type has changed - log it. 1601 // Selected type has changed - log it.
1601 UMA_HISTOGRAM_ENUMERATION( 1602 UMA_HISTOGRAM_ENUMERATION(
1602 "Sync.CustomSync", user_selectable_types[i], 1603 "Sync.CustomSync", user_selectable_types[i],
1603 sync_driver::user_selectable_type::SELECTABLE_DATATYPE_COUNT + 1); 1604 syncer::user_selectable_type::SELECTABLE_DATATYPE_COUNT + 1);
1604 } 1605 }
1605 } 1606 }
1606 } 1607 }
1607 } 1608 }
1608 1609
1609 #if defined(OS_CHROMEOS) 1610 #if defined(OS_CHROMEOS)
1610 void ProfileSyncService::RefreshSpareBootstrapToken( 1611 void ProfileSyncService::RefreshSpareBootstrapToken(
1611 const std::string& passphrase) { 1612 const std::string& passphrase) {
1612 sync_driver::SystemEncryptor encryptor; 1613 syncer::SystemEncryptor encryptor;
1613 syncer::Cryptographer temp_cryptographer(&encryptor); 1614 syncer::Cryptographer temp_cryptographer(&encryptor);
1614 // The first 2 params (hostname and username) doesn't have any effect here. 1615 // The first 2 params (hostname and username) doesn't have any effect here.
1615 syncer::KeyParams key_params = {"localhost", "dummy", passphrase}; 1616 syncer::KeyParams key_params = {"localhost", "dummy", passphrase};
1616 1617
1617 std::string bootstrap_token; 1618 std::string bootstrap_token;
1618 if (!temp_cryptographer.AddKey(key_params)) { 1619 if (!temp_cryptographer.AddKey(key_params)) {
1619 NOTREACHED() << "Failed to add key to cryptographer."; 1620 NOTREACHED() << "Failed to add key to cryptographer.";
1620 } 1621 }
1621 temp_cryptographer.GetBootstrapToken(&bootstrap_token); 1622 temp_cryptographer.GetBootstrapToken(&bootstrap_token);
1622 sync_prefs_.SetSpareBootstrapToken(bootstrap_token); 1623 sync_prefs_.SetSpareBootstrapToken(bootstrap_token);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 1655
1655 syncer::ModelTypeSet ProfileSyncService::GetActiveDataTypes() const { 1656 syncer::ModelTypeSet ProfileSyncService::GetActiveDataTypes() const {
1656 if (!IsSyncActive() || !ConfigurationDone()) 1657 if (!IsSyncActive() || !ConfigurationDone())
1657 return syncer::ModelTypeSet(); 1658 return syncer::ModelTypeSet();
1658 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes(); 1659 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes();
1659 const syncer::ModelTypeSet failed_types = 1660 const syncer::ModelTypeSet failed_types =
1660 data_type_status_table_.GetFailedTypes(); 1661 data_type_status_table_.GetFailedTypes();
1661 return Difference(preferred_types, failed_types); 1662 return Difference(preferred_types, failed_types);
1662 } 1663 }
1663 1664
1664 sync_driver::SyncClient* ProfileSyncService::GetSyncClient() const { 1665 syncer::SyncClient* ProfileSyncService::GetSyncClient() const {
1665 return sync_client_.get(); 1666 return sync_client_.get();
1666 } 1667 }
1667 1668
1668 syncer::ModelTypeSet ProfileSyncService::GetPreferredDataTypes() const { 1669 syncer::ModelTypeSet ProfileSyncService::GetPreferredDataTypes() const {
1669 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); 1670 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes();
1670 const syncer::ModelTypeSet preferred_types = 1671 const syncer::ModelTypeSet preferred_types =
1671 Union(sync_prefs_.GetPreferredDataTypes(registered_types), 1672 Union(sync_prefs_.GetPreferredDataTypes(registered_types),
1672 syncer::ControlTypes()); 1673 syncer::ControlTypes());
1673 const syncer::ModelTypeSet enforced_types = 1674 const syncer::ModelTypeSet enforced_types =
1674 Intersection(GetDataTypesFromPreferenceProviders(), registered_types); 1675 Intersection(GetDataTypesFromPreferenceProviders(), registered_types);
(...skipping 20 matching lines...) Expand all
1695 } 1696 }
1696 1697
1697 bool ProfileSyncService::IsUsingSecondaryPassphrase() const { 1698 bool ProfileSyncService::IsUsingSecondaryPassphrase() const {
1698 syncer::PassphraseType passphrase_type = GetPassphraseType(); 1699 syncer::PassphraseType passphrase_type = GetPassphraseType();
1699 return passphrase_type == 1700 return passphrase_type ==
1700 syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE || 1701 syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE ||
1701 passphrase_type == syncer::PassphraseType::CUSTOM_PASSPHRASE; 1702 passphrase_type == syncer::PassphraseType::CUSTOM_PASSPHRASE;
1702 } 1703 }
1703 1704
1704 std::string ProfileSyncService::GetCustomPassphraseKey() const { 1705 std::string ProfileSyncService::GetCustomPassphraseKey() const {
1705 sync_driver::SystemEncryptor encryptor; 1706 syncer::SystemEncryptor encryptor;
1706 syncer::Cryptographer cryptographer(&encryptor); 1707 syncer::Cryptographer cryptographer(&encryptor);
1707 cryptographer.Bootstrap(sync_prefs_.GetEncryptionBootstrapToken()); 1708 cryptographer.Bootstrap(sync_prefs_.GetEncryptionBootstrapToken());
1708 return cryptographer.GetDefaultNigoriKeyData(); 1709 return cryptographer.GetDefaultNigoriKeyData();
1709 } 1710 }
1710 1711
1711 syncer::PassphraseType ProfileSyncService::GetPassphraseType() const { 1712 syncer::PassphraseType ProfileSyncService::GetPassphraseType() const {
1712 return backend_->GetPassphraseType(); 1713 return backend_->GetPassphraseType();
1713 } 1714 }
1714 1715
1715 base::Time ProfileSyncService::GetExplicitPassphraseTime() const { 1716 base::Time ProfileSyncService::GetExplicitPassphraseTime() const {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 cookie_jar_mismatch = false; 2085 cookie_jar_mismatch = false;
2085 break; 2086 break;
2086 } 2087 }
2087 } 2088 }
2088 2089
2089 DVLOG(1) << "Cookie jar mismatch: " << cookie_jar_mismatch; 2090 DVLOG(1) << "Cookie jar mismatch: " << cookie_jar_mismatch;
2090 DVLOG(1) << "Cookie jar empty: " << cookie_jar_empty; 2091 DVLOG(1) << "Cookie jar empty: " << cookie_jar_empty;
2091 backend_->OnCookieJarChanged(cookie_jar_mismatch, cookie_jar_empty); 2092 backend_->OnCookieJarChanged(cookie_jar_mismatch, cookie_jar_empty);
2092 } 2093 }
2093 2094
2094 void ProfileSyncService::AddObserver( 2095 void ProfileSyncService::AddObserver(syncer::SyncServiceObserver* observer) {
2095 sync_driver::SyncServiceObserver* observer) {
2096 observers_.AddObserver(observer); 2096 observers_.AddObserver(observer);
2097 } 2097 }
2098 2098
2099 void ProfileSyncService::RemoveObserver( 2099 void ProfileSyncService::RemoveObserver(syncer::SyncServiceObserver* observer) {
2100 sync_driver::SyncServiceObserver* observer) {
2101 observers_.RemoveObserver(observer); 2100 observers_.RemoveObserver(observer);
2102 } 2101 }
2103 2102
2104 void ProfileSyncService::AddProtocolEventObserver( 2103 void ProfileSyncService::AddProtocolEventObserver(
2105 ProtocolEventObserver* observer) { 2104 ProtocolEventObserver* observer) {
2106 protocol_event_observers_.AddObserver(observer); 2105 protocol_event_observers_.AddObserver(observer);
2107 if (HasSyncingBackend()) { 2106 if (HasSyncingBackend()) {
2108 backend_->RequestBufferedProtocolEventsAndEnableForwarding(); 2107 backend_->RequestBufferedProtocolEventsAndEnableForwarding();
2109 } 2108 }
2110 } 2109 }
(...skipping 19 matching lines...) Expand all
2130 void ProfileSyncService::RemoveTypeDebugInfoObserver( 2129 void ProfileSyncService::RemoveTypeDebugInfoObserver(
2131 syncer::TypeDebugInfoObserver* type_debug_info_observer) { 2130 syncer::TypeDebugInfoObserver* type_debug_info_observer) {
2132 type_debug_info_observers_.RemoveObserver(type_debug_info_observer); 2131 type_debug_info_observers_.RemoveObserver(type_debug_info_observer);
2133 if (!type_debug_info_observers_.might_have_observers() && 2132 if (!type_debug_info_observers_.might_have_observers() &&
2134 backend_initialized_) { 2133 backend_initialized_) {
2135 backend_->DisableDirectoryTypeDebugInfoForwarding(); 2134 backend_->DisableDirectoryTypeDebugInfoForwarding();
2136 } 2135 }
2137 } 2136 }
2138 2137
2139 void ProfileSyncService::AddPreferenceProvider( 2138 void ProfileSyncService::AddPreferenceProvider(
2140 SyncTypePreferenceProvider* provider) { 2139 syncer::SyncTypePreferenceProvider* provider) {
2141 DCHECK(!HasPreferenceProvider(provider)) 2140 DCHECK(!HasPreferenceProvider(provider))
2142 << "Providers may only be added once!"; 2141 << "Providers may only be added once!";
2143 preference_providers_.insert(provider); 2142 preference_providers_.insert(provider);
2144 } 2143 }
2145 2144
2146 void ProfileSyncService::RemovePreferenceProvider( 2145 void ProfileSyncService::RemovePreferenceProvider(
2147 SyncTypePreferenceProvider* provider) { 2146 syncer::SyncTypePreferenceProvider* provider) {
2148 DCHECK(HasPreferenceProvider(provider)) 2147 DCHECK(HasPreferenceProvider(provider))
2149 << "Only providers that have been added before can be removed!"; 2148 << "Only providers that have been added before can be removed!";
2150 preference_providers_.erase(provider); 2149 preference_providers_.erase(provider);
2151 } 2150 }
2152 2151
2153 bool ProfileSyncService::HasPreferenceProvider( 2152 bool ProfileSyncService::HasPreferenceProvider(
2154 SyncTypePreferenceProvider* provider) const { 2153 syncer::SyncTypePreferenceProvider* provider) const {
2155 return preference_providers_.count(provider) > 0; 2154 return preference_providers_.count(provider) > 0;
2156 } 2155 }
2157 2156
2158 namespace { 2157 namespace {
2159 2158
2160 class GetAllNodesRequestHelper 2159 class GetAllNodesRequestHelper
2161 : public base::RefCountedThreadSafe<GetAllNodesRequestHelper> { 2160 : public base::RefCountedThreadSafe<GetAllNodesRequestHelper> {
2162 public: 2161 public:
2163 GetAllNodesRequestHelper( 2162 GetAllNodesRequestHelper(
2164 syncer::ModelTypeSet requested_types, 2163 syncer::ModelTypeSet requested_types,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 } 2231 }
2233 2232
2234 for (ModelTypeSet::Iterator it = all_types.First(); it.Good(); it.Inc()) { 2233 for (ModelTypeSet::Iterator it = all_types.First(); it.Good(); it.Inc()) {
2235 const auto& dtc_iter = data_type_controllers_.find(it.Get()); 2234 const auto& dtc_iter = data_type_controllers_.find(it.Get());
2236 if (dtc_iter != data_type_controllers_.end()) { 2235 if (dtc_iter != data_type_controllers_.end()) {
2237 dtc_iter->second->GetAllNodes(base::Bind( 2236 dtc_iter->second->GetAllNodes(base::Bind(
2238 &GetAllNodesRequestHelper::OnReceivedNodesForType, helper)); 2237 &GetAllNodesRequestHelper::OnReceivedNodesForType, helper));
2239 } else { 2238 } else {
2240 // Control Types 2239 // Control Types
2241 helper->OnReceivedNodesForType( 2240 helper->OnReceivedNodesForType(
2242 it.Get(), sync_driver::DirectoryDataTypeController:: 2241 it.Get(),
2243 GetAllNodesForTypeFromDirectory( 2242 syncer::DirectoryDataTypeController::GetAllNodesForTypeFromDirectory(
2244 it.Get(), GetUserShare()->directory.get())); 2243 it.Get(), GetUserShare()->directory.get()));
2245 } 2244 }
2246 } 2245 }
2247 } 2246 }
2248 2247
2249 bool ProfileSyncService::HasObserver( 2248 bool ProfileSyncService::HasObserver(
2250 const sync_driver::SyncServiceObserver* observer) const { 2249 const syncer::SyncServiceObserver* observer) const {
2251 return observers_.HasObserver(observer); 2250 return observers_.HasObserver(observer);
2252 } 2251 }
2253 2252
2254 base::WeakPtr<syncer::JsController> ProfileSyncService::GetJsController() { 2253 base::WeakPtr<syncer::JsController> ProfileSyncService::GetJsController() {
2255 return sync_js_controller_.AsWeakPtr(); 2254 return sync_js_controller_.AsWeakPtr();
2256 } 2255 }
2257 2256
2258 void ProfileSyncService::SyncEvent(SyncEventCodes code) { 2257 void ProfileSyncService::SyncEvent(SyncEventCodes code) {
2259 UMA_HISTOGRAM_ENUMERATION("Sync.EventCodes", code, MAX_SYNC_EVENT_CODE); 2258 UMA_HISTOGRAM_ENUMERATION("Sync.EventCodes", code, MAX_SYNC_EVENT_CODE);
2260 } 2259 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 << "Unrecoverable error."; 2315 << "Unrecoverable error.";
2317 } else { 2316 } else {
2318 DVLOG(0) << "ConfigureDataTypeManager not invoked because backend is not " 2317 DVLOG(0) << "ConfigureDataTypeManager not invoked because backend is not "
2319 << "initialized"; 2318 << "initialized";
2320 } 2319 }
2321 } 2320 }
2322 2321
2323 syncer::ModelTypeSet ProfileSyncService::GetDataTypesFromPreferenceProviders() 2322 syncer::ModelTypeSet ProfileSyncService::GetDataTypesFromPreferenceProviders()
2324 const { 2323 const {
2325 syncer::ModelTypeSet types; 2324 syncer::ModelTypeSet types;
2326 for (std::set<SyncTypePreferenceProvider*>::const_iterator it = 2325 for (std::set<syncer::SyncTypePreferenceProvider*>::const_iterator it =
2327 preference_providers_.begin(); 2326 preference_providers_.begin();
2328 it != preference_providers_.end(); ++it) { 2327 it != preference_providers_.end(); ++it) {
2329 types.PutAll((*it)->GetPreferredDataTypes()); 2328 types.PutAll((*it)->GetPreferredDataTypes());
2330 } 2329 }
2331 return types; 2330 return types;
2332 } 2331 }
2333 2332
2334 const DataTypeStatusTable& ProfileSyncService::data_type_status_table() const { 2333 const DataTypeStatusTable& ProfileSyncService::data_type_status_table() const {
2335 return data_type_status_table_; 2334 return data_type_status_table_;
2336 } 2335 }
(...skipping 21 matching lines...) Expand all
2358 } 2357 }
2359 2358
2360 syncer::SyncableService* ProfileSyncService::GetSessionsSyncableService() { 2359 syncer::SyncableService* ProfileSyncService::GetSessionsSyncableService() {
2361 return sessions_sync_manager_.get(); 2360 return sessions_sync_manager_.get();
2362 } 2361 }
2363 2362
2364 syncer::SyncableService* ProfileSyncService::GetDeviceInfoSyncableService() { 2363 syncer::SyncableService* ProfileSyncService::GetDeviceInfoSyncableService() {
2365 return device_info_sync_service_.get(); 2364 return device_info_sync_service_.get();
2366 } 2365 }
2367 2366
2368 syncer_v2::ModelTypeService* ProfileSyncService::GetDeviceInfoService() { 2367 syncer::ModelTypeService* ProfileSyncService::GetDeviceInfoService() {
2369 return device_info_service_.get(); 2368 return device_info_service_.get();
2370 } 2369 }
2371 2370
2372 sync_driver::SyncService::SyncTokenStatus 2371 syncer::SyncService::SyncTokenStatus ProfileSyncService::GetSyncTokenStatus()
2373 ProfileSyncService::GetSyncTokenStatus() const { 2372 const {
2374 SyncTokenStatus status; 2373 SyncTokenStatus status;
2375 status.connection_status_update_time = connection_status_update_time_; 2374 status.connection_status_update_time = connection_status_update_time_;
2376 status.connection_status = connection_status_; 2375 status.connection_status = connection_status_;
2377 status.token_request_time = token_request_time_; 2376 status.token_request_time = token_request_time_;
2378 status.token_receive_time = token_receive_time_; 2377 status.token_receive_time = token_receive_time_;
2379 status.last_get_token_error = last_get_token_error_; 2378 status.last_get_token_error = last_get_token_error_;
2380 if (request_access_token_retry_timer_.IsRunning()) 2379 if (request_access_token_retry_timer_.IsRunning())
2381 status.next_token_request_time = next_token_request_time_; 2380 status.next_token_request_time = next_token_request_time_;
2382 return status; 2381 return status;
2383 } 2382 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2491 2490
2492 DCHECK(startup_controller_->IsSetupInProgress()); 2491 DCHECK(startup_controller_->IsSetupInProgress());
2493 startup_controller_->SetSetupInProgress(false); 2492 startup_controller_->SetSetupInProgress(false);
2494 2493
2495 if (IsBackendInitialized()) 2494 if (IsBackendInitialized())
2496 ReconfigureDatatypeManager(); 2495 ReconfigureDatatypeManager();
2497 NotifyObservers(); 2496 NotifyObservers();
2498 } 2497 }
2499 2498
2500 } // namespace browser_sync 2499 } // namespace browser_sync
OLDNEW
« no previous file with comments | « components/browser_sync/profile_sync_service.h ('k') | components/browser_sync/profile_sync_service_autofill_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698