| OLD | NEW |
| 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 "chrome/browser/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 // This will be false if the preference was properly set or if it's controlled | 355 // This will be false if the preference was properly set or if it's controlled |
| 356 // by policy. | 356 // by policy. |
| 357 if (!keep_everything_synced->IsDefaultValue()) | 357 if (!keep_everything_synced->IsDefaultValue()) |
| 358 return; | 358 return; |
| 359 | 359 |
| 360 // kSyncKeepEverythingSynced was not properly set. Set it and the preferred | 360 // kSyncKeepEverythingSynced was not properly set. Set it and the preferred |
| 361 // types now, before we configure. | 361 // types now, before we configure. |
| 362 UMA_HISTOGRAM_COUNTS("Sync.DatatypePrefRecovery", 1); | 362 UMA_HISTOGRAM_COUNTS("Sync.DatatypePrefRecovery", 1); |
| 363 sync_prefs_.SetKeepEverythingSynced(true); | 363 sync_prefs_.SetKeepEverythingSynced(true); |
| 364 syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); | 364 syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); |
| 365 sync_prefs_.SetPreferredDataTypes(registered_types, | |
| 366 registered_types); | |
| 367 } | 365 } |
| 368 | 366 |
| 369 void ProfileSyncService::StartSyncingWithServer() { | 367 void ProfileSyncService::StartSyncingWithServer() { |
| 370 if (backend_) | 368 if (backend_) |
| 371 backend_->StartSyncingWithServer(); | 369 backend_->StartSyncingWithServer(); |
| 372 } | 370 } |
| 373 | 371 |
| 374 void ProfileSyncService::RegisterAuthNotifications() { | 372 void ProfileSyncService::RegisterAuthNotifications() { |
| 375 oauth2_token_service_->AddObserver(this); | 373 oauth2_token_service_->AddObserver(this); |
| 376 if (signin()) | 374 if (signin()) |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 | 1095 |
| 1098 SigninClient* signin_client = | 1096 SigninClient* signin_client = |
| 1099 ChromeSigninClientFactory::GetForProfile(profile_); | 1097 ChromeSigninClientFactory::GetForProfile(profile_); |
| 1100 DCHECK(signin_client); | 1098 DCHECK(signin_client); |
| 1101 std::string signin_scoped_device_id = | 1099 std::string signin_scoped_device_id = |
| 1102 signin_client->GetSigninScopedDeviceId(); | 1100 signin_client->GetSigninScopedDeviceId(); |
| 1103 | 1101 |
| 1104 // Initialize local device info. | 1102 // Initialize local device info. |
| 1105 local_device_->Initialize(cache_guid, signin_scoped_device_id); | 1103 local_device_->Initialize(cache_guid, signin_scoped_device_id); |
| 1106 | 1104 |
| 1105 DVLOG(1) << "Setting preferred types for non-blocking DTM"; |
| 1106 non_blocking_data_type_manager_.SetPreferredTypes(GetPreferredDataTypes()); |
| 1107 |
| 1107 // Give the DataTypeControllers a handle to the now initialized backend | 1108 // Give the DataTypeControllers a handle to the now initialized backend |
| 1108 // as a UserShare. | 1109 // as a UserShare. |
| 1109 for (DataTypeController::TypeMap::iterator it = | 1110 for (DataTypeController::TypeMap::iterator it = |
| 1110 directory_data_type_controllers_.begin(); | 1111 directory_data_type_controllers_.begin(); |
| 1111 it != directory_data_type_controllers_.end(); ++it) { | 1112 it != directory_data_type_controllers_.end(); ++it) { |
| 1112 it->second->OnUserShareReady(GetUserShare()); | 1113 it->second->OnUserShareReady(GetUserShare()); |
| 1113 } | 1114 } |
| 1114 | 1115 |
| 1115 if (backend_mode_ == BACKUP || backend_mode_ == ROLLBACK) | 1116 if (backend_mode_ == BACKUP || backend_mode_ == ROLLBACK) |
| 1116 ConfigureDataTypeManager(); | 1117 ConfigureDataTypeManager(); |
| (...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2663 browser_sync::SyncedDeviceTracker* device_tracker = | 2664 browser_sync::SyncedDeviceTracker* device_tracker = |
| 2664 backend_->GetSyncedDeviceTracker(); | 2665 backend_->GetSyncedDeviceTracker(); |
| 2665 if (device_tracker) | 2666 if (device_tracker) |
| 2666 device_tracker->UpdateLocalDeviceBackupTime(*last_backup_time_); | 2667 device_tracker->UpdateLocalDeviceBackupTime(*last_backup_time_); |
| 2667 } | 2668 } |
| 2668 } | 2669 } |
| 2669 | 2670 |
| 2670 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { | 2671 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { |
| 2671 return backend_->GetSyncedDeviceTracker()->GetLocalDeviceBackupTime(); | 2672 return backend_->GetSyncedDeviceTracker()->GetLocalDeviceBackupTime(); |
| 2672 } | 2673 } |
| OLD | NEW |