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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // This will be false if the preference was properly set or if it's controlled | 366 // This will be false if the preference was properly set or if it's controlled |
367 // by policy. | 367 // by policy. |
368 if (!keep_everything_synced->IsDefaultValue()) | 368 if (!keep_everything_synced->IsDefaultValue()) |
369 return; | 369 return; |
370 | 370 |
371 // kSyncKeepEverythingSynced was not properly set. Set it and the preferred | 371 // kSyncKeepEverythingSynced was not properly set. Set it and the preferred |
372 // types now, before we configure. | 372 // types now, before we configure. |
373 UMA_HISTOGRAM_COUNTS("Sync.DatatypePrefRecovery", 1); | 373 UMA_HISTOGRAM_COUNTS("Sync.DatatypePrefRecovery", 1); |
374 sync_prefs_.SetKeepEverythingSynced(true); | 374 sync_prefs_.SetKeepEverythingSynced(true); |
375 syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); | 375 syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); |
376 sync_prefs_.SetPreferredDataTypes(registered_types, | |
377 registered_types); | |
378 } | 376 } |
379 | 377 |
380 void ProfileSyncService::StartSyncingWithServer() { | 378 void ProfileSyncService::StartSyncingWithServer() { |
381 if (backend_) | 379 if (backend_) |
382 backend_->StartSyncingWithServer(); | 380 backend_->StartSyncingWithServer(); |
383 } | 381 } |
384 | 382 |
385 void ProfileSyncService::RegisterAuthNotifications() { | 383 void ProfileSyncService::RegisterAuthNotifications() { |
386 oauth2_token_service_->AddObserver(this); | 384 oauth2_token_service_->AddObserver(this); |
387 if (signin()) | 385 if (signin()) |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 | 1131 |
1134 SigninClient* signin_client = | 1132 SigninClient* signin_client = |
1135 ChromeSigninClientFactory::GetForProfile(profile_); | 1133 ChromeSigninClientFactory::GetForProfile(profile_); |
1136 DCHECK(signin_client); | 1134 DCHECK(signin_client); |
1137 std::string signin_scoped_device_id = | 1135 std::string signin_scoped_device_id = |
1138 signin_client->GetSigninScopedDeviceId(); | 1136 signin_client->GetSigninScopedDeviceId(); |
1139 | 1137 |
1140 // Initialize local device info. | 1138 // Initialize local device info. |
1141 local_device_->Initialize(cache_guid, signin_scoped_device_id); | 1139 local_device_->Initialize(cache_guid, signin_scoped_device_id); |
1142 | 1140 |
| 1141 DVLOG(1) << "Setting preferred types for non-blocking DTM"; |
| 1142 non_blocking_data_type_manager_.SetPreferredTypes(GetPreferredDataTypes()); |
| 1143 |
1143 // Give the DataTypeControllers a handle to the now initialized backend | 1144 // Give the DataTypeControllers a handle to the now initialized backend |
1144 // as a UserShare. | 1145 // as a UserShare. |
1145 for (DataTypeController::TypeMap::iterator it = | 1146 for (DataTypeController::TypeMap::iterator it = |
1146 directory_data_type_controllers_.begin(); | 1147 directory_data_type_controllers_.begin(); |
1147 it != directory_data_type_controllers_.end(); ++it) { | 1148 it != directory_data_type_controllers_.end(); ++it) { |
1148 it->second->OnUserShareReady(GetUserShare()); | 1149 it->second->OnUserShareReady(GetUserShare()); |
1149 } | 1150 } |
1150 | 1151 |
1151 if (backend_mode_ == BACKUP || backend_mode_ == ROLLBACK) | 1152 if (backend_mode_ == BACKUP || backend_mode_ == ROLLBACK) |
1152 ConfigureDataTypeManager(); | 1153 ConfigureDataTypeManager(); |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2762 true)); | 2763 true)); |
2763 } | 2764 } |
2764 | 2765 |
2765 bool ProfileSyncService::NeedBackup() const { | 2766 bool ProfileSyncService::NeedBackup() const { |
2766 return need_backup_; | 2767 return need_backup_; |
2767 } | 2768 } |
2768 | 2769 |
2769 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { | 2770 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { |
2770 return backend_->GetSyncedDeviceTracker()->GetLocalDeviceBackupTime(); | 2771 return backend_->GetSyncedDeviceTracker()->GetLocalDeviceBackupTime(); |
2771 } | 2772 } |
OLD | NEW |