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 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 | 999 |
1000 // Shut all data types down. | 1000 // Shut all data types down. |
1001 base::MessageLoop::current()->PostTask(FROM_HERE, | 1001 base::MessageLoop::current()->PostTask(FROM_HERE, |
1002 base::Bind(&ProfileSyncService::ShutdownImpl, | 1002 base::Bind(&ProfileSyncService::ShutdownImpl, |
1003 weak_factory_.GetWeakPtr(), | 1003 weak_factory_.GetWeakPtr(), |
1004 delete_sync_database ? | 1004 delete_sync_database ? |
1005 syncer::DISABLE_SYNC : syncer::STOP_SYNC)); | 1005 syncer::DISABLE_SYNC : syncer::STOP_SYNC)); |
1006 } | 1006 } |
1007 | 1007 |
1008 void ProfileSyncService::ReenableDatatype(syncer::ModelType type) { | 1008 void ProfileSyncService::ReenableDatatype(syncer::ModelType type) { |
1009 // Only reconfigure if the type actually had a data type or unready error. | 1009 DCHECK(backend_initialized_); |
1010 if (!failed_data_types_handler_.ResetDataTypeErrorFor(type) && | 1010 directory_data_type_manager_->ReenableType(type); |
1011 !failed_data_types_handler_.ResetUnreadyErrorFor(type)) { | |
1012 return; | |
1013 } | |
1014 | |
1015 // If the type is no longer enabled, don't bother reconfiguring. | |
1016 // TODO(zea): something else should encapsulate the notion of "whether a type | |
1017 // should be enabled". | |
1018 if (!syncer::CoreTypes().Has(type) && !GetPreferredDataTypes().Has(type)) | |
1019 return; | |
1020 | |
1021 base::MessageLoop::current()->PostTask(FROM_HERE, | |
1022 base::Bind(&ProfileSyncService::ReconfigureDatatypeManager, | |
1023 weak_factory_.GetWeakPtr())); | |
1024 } | 1011 } |
1025 | 1012 |
1026 void ProfileSyncService::UpdateBackendInitUMA(bool success) { | 1013 void ProfileSyncService::UpdateBackendInitUMA(bool success) { |
1027 if (backend_mode_ != SYNC) | 1014 if (backend_mode_ != SYNC) |
1028 return; | 1015 return; |
1029 | 1016 |
1030 is_first_time_sync_configure_ = !HasSyncSetupCompleted(); | 1017 is_first_time_sync_configure_ = !HasSyncSetupCompleted(); |
1031 | 1018 |
1032 if (is_first_time_sync_configure_) { | 1019 if (is_first_time_sync_configure_) { |
1033 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeFirstTimeSuccess", success); | 1020 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeFirstTimeSuccess", success); |
(...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2762 true)); | 2749 true)); |
2763 } | 2750 } |
2764 | 2751 |
2765 bool ProfileSyncService::NeedBackup() const { | 2752 bool ProfileSyncService::NeedBackup() const { |
2766 return need_backup_; | 2753 return need_backup_; |
2767 } | 2754 } |
2768 | 2755 |
2769 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { | 2756 base::Time ProfileSyncService::GetDeviceBackupTimeForTesting() const { |
2770 return backend_->GetSyncedDeviceTracker()->GetLocalDeviceBackupTime(); | 2757 return backend_->GetSyncedDeviceTracker()->GetLocalDeviceBackupTime(); |
2771 } | 2758 } |
OLD | NEW |