OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 if (backend_.get() && backend_initialized_) { | 989 if (backend_.get() && backend_initialized_) { |
990 return backend_->GetDetailedStatus(); | 990 return backend_->GetDetailedStatus(); |
991 } else { | 991 } else { |
992 SyncBackendHost::Status status; | 992 SyncBackendHost::Status status; |
993 status.summary = SyncBackendHost::Status::OFFLINE_UNUSABLE; | 993 status.summary = SyncBackendHost::Status::OFFLINE_UNUSABLE; |
994 status.sync_protocol_error = last_actionable_error_; | 994 status.sync_protocol_error = last_actionable_error_; |
995 return status; | 995 return status; |
996 } | 996 } |
997 } | 997 } |
998 | 998 |
999 const GoogleServiceAuthError& ProfileSyncService::GetAuthError() const { | |
1000 return last_auth_error_; | |
1001 } | |
1002 | |
1003 bool ProfileSyncService::SetupInProgress() const { | 999 bool ProfileSyncService::SetupInProgress() const { |
1004 return !HasSyncSetupCompleted() && WizardIsVisible(); | 1000 return !HasSyncSetupCompleted() && WizardIsVisible(); |
1005 } | 1001 } |
1006 | 1002 |
1007 std::string ProfileSyncService::BuildSyncStatusSummaryText( | 1003 std::string ProfileSyncService::BuildSyncStatusSummaryText( |
1008 const sync_api::SyncManager::Status::Summary& summary) { | 1004 const sync_api::SyncManager::Status::Summary& summary) { |
1009 const char* strings[] = {"INVALID", "OFFLINE", "OFFLINE_UNSYNCED", "SYNCING", | 1005 const char* strings[] = {"INVALID", "OFFLINE", "OFFLINE_UNSYNCED", "SYNCING", |
1010 "READY", "CONFLICT", "OFFLINE_UNUSABLE"}; | 1006 "READY", "CONFLICT", "OFFLINE_UNUSABLE"}; |
1011 COMPILE_ASSERT(arraysize(strings) == | 1007 COMPILE_ASSERT(arraysize(strings) == |
1012 sync_api::SyncManager::Status::SUMMARY_STATUS_COUNT, | 1008 sync_api::SyncManager::Status::SUMMARY_STATUS_COUNT, |
1013 enum_indexed_array); | 1009 enum_indexed_array); |
1014 if (summary < 0 || | 1010 if (summary < 0 || |
1015 summary >= sync_api::SyncManager::Status::SUMMARY_STATUS_COUNT) { | 1011 summary >= sync_api::SyncManager::Status::SUMMARY_STATUS_COUNT) { |
1016 LOG(DFATAL) << "Illegal Summary Value: " << summary; | 1012 LOG(DFATAL) << "Illegal Summary Value: " << summary; |
1017 return "UNKNOWN"; | 1013 return "UNKNOWN"; |
1018 } | 1014 } |
1019 return strings[summary]; | 1015 return strings[summary]; |
1020 } | 1016 } |
1021 | 1017 |
1022 bool ProfileSyncService::sync_initialized() const { | 1018 bool ProfileSyncService::sync_initialized() const { |
1023 return backend_initialized_; | 1019 return backend_initialized_; |
1024 } | 1020 } |
1025 | 1021 |
1026 bool ProfileSyncService::unrecoverable_error_detected() const { | 1022 bool ProfileSyncService::unrecoverable_error_detected() const { |
1027 return unrecoverable_error_detected_; | 1023 return unrecoverable_error_detected_; |
1028 } | 1024 } |
1029 | 1025 |
1030 bool ProfileSyncService::UIShouldDepictAuthInProgress() const { | |
1031 return is_auth_in_progress_; | |
1032 } | |
1033 | |
1034 bool ProfileSyncService::IsPassphraseRequired() const { | 1026 bool ProfileSyncService::IsPassphraseRequired() const { |
1035 return passphrase_required_reason_ != | 1027 return passphrase_required_reason_ != |
1036 sync_api::REASON_PASSPHRASE_NOT_REQUIRED; | 1028 sync_api::REASON_PASSPHRASE_NOT_REQUIRED; |
1037 } | 1029 } |
1038 | 1030 |
1039 // TODO(zea): Rename this IsPassphraseNeededFromUI and ensure it's used | 1031 // TODO(zea): Rename this IsPassphraseNeededFromUI and ensure it's used |
1040 // appropriately (see http://crbug.com/91379). | 1032 // appropriately (see http://crbug.com/91379). |
1041 bool ProfileSyncService::IsPassphraseRequiredForDecryption() const { | 1033 bool ProfileSyncService::IsPassphraseRequiredForDecryption() const { |
1042 // If there is an encrypted datatype enabled and we don't have the proper | 1034 // If there is an encrypted datatype enabled and we don't have the proper |
1043 // passphrase, we must prompt the user for a passphrase. The only way for the | 1035 // passphrase, we must prompt the user for a passphrase. The only way for the |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 << "Unrecoverable error."; | 1549 << "Unrecoverable error."; |
1558 } else { | 1550 } else { |
1559 VLOG(0) << "ConfigureDataTypeManager not invoked because backend is not " | 1551 VLOG(0) << "ConfigureDataTypeManager not invoked because backend is not " |
1560 << "initialized"; | 1552 << "initialized"; |
1561 } | 1553 } |
1562 } | 1554 } |
1563 | 1555 |
1564 const FailedDatatypesHandler& ProfileSyncService::failed_datatypes_handler() { | 1556 const FailedDatatypesHandler& ProfileSyncService::failed_datatypes_handler() { |
1565 return failed_datatypes_handler_; | 1557 return failed_datatypes_handler_; |
1566 } | 1558 } |
OLD | NEW |