Chromium Code Reviews| 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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 942 // Shut all data types down. | 942 // Shut all data types down. |
| 943 base::MessageLoop::current()->PostTask(FROM_HERE, | 943 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 944 base::Bind(&ProfileSyncService::ShutdownImpl, | 944 base::Bind(&ProfileSyncService::ShutdownImpl, |
| 945 weak_factory_.GetWeakPtr(), | 945 weak_factory_.GetWeakPtr(), |
| 946 delete_sync_database ? | 946 delete_sync_database ? |
| 947 browser_sync::SyncBackendHost::DISABLE_AND_CLAIM_THREAD : | 947 browser_sync::SyncBackendHost::DISABLE_AND_CLAIM_THREAD : |
| 948 browser_sync::SyncBackendHost::STOP_AND_CLAIM_THREAD)); | 948 browser_sync::SyncBackendHost::STOP_AND_CLAIM_THREAD)); |
| 949 } | 949 } |
| 950 | 950 |
| 951 void ProfileSyncService::ReenableDatatype(syncer::ModelType type) { | 951 void ProfileSyncService::ReenableDatatype(syncer::ModelType type) { |
| 952 // Only reconfigure if the type actually had a data type or unready error. | 952 DCHECK(backend_initialized_); |
| 953 if (!failed_data_types_handler_.ResetDataTypeErrorFor(type) && | 953 directory_data_type_manager_->ReenableType(type); |
|
maniscalco
2014/08/04 23:59:30
I noticed that elsewhere in this class we check th
Nicolas Zea
2014/08/06 21:20:08
At the moment I've taking the opinion that it's in
| |
| 954 !failed_data_types_handler_.ResetUnreadyErrorFor(type)) { | |
| 955 return; | |
| 956 } | |
| 957 | |
| 958 // If the type is no longer enabled, don't bother reconfiguring. | |
| 959 // TODO(zea): something else should encapsulate the notion of "whether a type | |
| 960 // should be enabled". | |
| 961 if (!syncer::CoreTypes().Has(type) && !GetPreferredDataTypes().Has(type)) | |
| 962 return; | |
| 963 | |
| 964 base::MessageLoop::current()->PostTask(FROM_HERE, | |
| 965 base::Bind(&ProfileSyncService::ReconfigureDatatypeManager, | |
| 966 weak_factory_.GetWeakPtr())); | |
| 967 } | 954 } |
| 968 | 955 |
| 969 void ProfileSyncService::UpdateBackendInitUMA(bool success) { | 956 void ProfileSyncService::UpdateBackendInitUMA(bool success) { |
| 970 if (backend_mode_ != SYNC) | 957 if (backend_mode_ != SYNC) |
| 971 return; | 958 return; |
| 972 | 959 |
| 973 is_first_time_sync_configure_ = !HasSyncSetupCompleted(); | 960 is_first_time_sync_configure_ = !HasSyncSetupCompleted(); |
| 974 | 961 |
| 975 if (is_first_time_sync_configure_) { | 962 if (is_first_time_sync_configure_) { |
| 976 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeFirstTimeSuccess", success); | 963 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeFirstTimeSuccess", success); |
| (...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2643 browser_sync::SyncedDeviceTracker* device_tracker = | 2630 browser_sync::SyncedDeviceTracker* device_tracker = |
| 2644 backend_->GetSyncedDeviceTracker(); | 2631 backend_->GetSyncedDeviceTracker(); |
| 2645 if (device_tracker) | 2632 if (device_tracker) |
| 2646 device_tracker->UpdateLocalDeviceBackupTime(*last_backup_time_); | 2633 device_tracker->UpdateLocalDeviceBackupTime(*last_backup_time_); |
| 2647 } | 2634 } |
| 2648 } | 2635 } |
| 2649 | 2636 |
| 2650 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { | 2637 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { |
| 2651 return backend_->GetSyncedDeviceTracker()->GetLocalDeviceBackupTime(); | 2638 return backend_->GetSyncedDeviceTracker()->GetLocalDeviceBackupTime(); |
| 2652 } | 2639 } |
| OLD | NEW |