| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 { SyncBackendHost::Status::OFFLINE_UNUSABLE }; | 773 { SyncBackendHost::Status::OFFLINE_UNUSABLE }; |
| 774 return status; | 774 return status; |
| 775 } | 775 } |
| 776 } | 776 } |
| 777 | 777 |
| 778 bool ProfileSyncService::SetupInProgress() const { | 778 bool ProfileSyncService::SetupInProgress() const { |
| 779 return !HasSyncSetupCompleted() && WizardIsVisible(); | 779 return !HasSyncSetupCompleted() && WizardIsVisible(); |
| 780 } | 780 } |
| 781 | 781 |
| 782 std::string ProfileSyncService::BuildSyncStatusSummaryText( | 782 std::string ProfileSyncService::BuildSyncStatusSummaryText( |
| 783 const sync_api::SyncManager::Status::Summary& summary) { | 783 const sync_api::SyncManager::Status::Summary& summary) { |
| 784 switch (summary) { | 784 const char* strings[] = {"INVALID", "OFFLINE", "OFFLINE_UNSYNCED", "SYNCING", |
| 785 case sync_api::SyncManager::Status::OFFLINE: | 785 "READY", "CONFLICT", "OFFLINE_UNUSABLE"}; |
| 786 return "OFFLINE"; | 786 COMPILE_ASSERT(arraysize(strings) == |
| 787 case sync_api::SyncManager::Status::OFFLINE_UNSYNCED: | 787 sync_api::SyncManager::Status::SUMMARY_STATUS_COUNT, |
| 788 return "OFFLINE_UNSYNCED"; | 788 enum_indexed_array); |
| 789 case sync_api::SyncManager::Status::SYNCING: | 789 if (summary < 0 || |
| 790 return "SYNCING"; | 790 summary >= sync_api::SyncManager::Status::SUMMARY_STATUS_COUNT) { |
| 791 case sync_api::SyncManager::Status::READY: | 791 LOG(DFATAL) << "Illegal Summary Value: " << summary; |
| 792 return "READY"; | 792 return "UNKNOWN"; |
| 793 case sync_api::SyncManager::Status::CONFLICT: | |
| 794 return "CONFLICT"; | |
| 795 case sync_api::SyncManager::Status::OFFLINE_UNUSABLE: | |
| 796 return "OFFLINE_UNUSABLE"; | |
| 797 case sync_api::SyncManager::Status::INVALID: // fall through | |
| 798 default: | |
| 799 return "UNKNOWN"; | |
| 800 } | 793 } |
| 794 return strings[summary]; |
| 801 } | 795 } |
| 802 | 796 |
| 803 bool ProfileSyncService::unrecoverable_error_detected() const { | 797 bool ProfileSyncService::unrecoverable_error_detected() const { |
| 804 return unrecoverable_error_detected_; | 798 return unrecoverable_error_detected_; |
| 805 } | 799 } |
| 806 | 800 |
| 807 string16 ProfileSyncService::GetLastSyncedTimeString() const { | 801 string16 ProfileSyncService::GetLastSyncedTimeString() const { |
| 808 if (last_synced_time_.is_null()) | 802 if (last_synced_time_.is_null()) |
| 809 return l10n_util::GetStringUTF16(IDS_SYNC_TIME_NEVER); | 803 return l10n_util::GetStringUTF16(IDS_SYNC_TIME_NEVER); |
| 810 | 804 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 // is initialized, all enabled data types are consistent with one | 1210 // is initialized, all enabled data types are consistent with one |
| 1217 // another, and no unrecoverable error has transpired. | 1211 // another, and no unrecoverable error has transpired. |
| 1218 if (unrecoverable_error_detected_) | 1212 if (unrecoverable_error_detected_) |
| 1219 return false; | 1213 return false; |
| 1220 | 1214 |
| 1221 if (!data_type_manager_.get()) | 1215 if (!data_type_manager_.get()) |
| 1222 return false; | 1216 return false; |
| 1223 | 1217 |
| 1224 return data_type_manager_->state() == DataTypeManager::CONFIGURED; | 1218 return data_type_manager_->state() == DataTypeManager::CONFIGURED; |
| 1225 } | 1219 } |
| OLD | NEW |