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 |
999 bool ProfileSyncService::SetupInProgress() const { | 1003 bool ProfileSyncService::SetupInProgress() const { |
1000 return !HasSyncSetupCompleted() && WizardIsVisible(); | 1004 return !HasSyncSetupCompleted() && WizardIsVisible(); |
1001 } | 1005 } |
1002 | 1006 |
1003 std::string ProfileSyncService::BuildSyncStatusSummaryText( | 1007 std::string ProfileSyncService::BuildSyncStatusSummaryText( |
1004 const sync_api::SyncManager::Status::Summary& summary) { | 1008 const sync_api::SyncManager::Status::Summary& summary) { |
1005 const char* strings[] = {"INVALID", "OFFLINE", "OFFLINE_UNSYNCED", "SYNCING", | 1009 const char* strings[] = {"INVALID", "OFFLINE", "OFFLINE_UNSYNCED", "SYNCING", |
1006 "READY", "CONFLICT", "OFFLINE_UNUSABLE"}; | 1010 "READY", "CONFLICT", "OFFLINE_UNUSABLE"}; |
1007 COMPILE_ASSERT(arraysize(strings) == | 1011 COMPILE_ASSERT(arraysize(strings) == |
1008 sync_api::SyncManager::Status::SUMMARY_STATUS_COUNT, | 1012 sync_api::SyncManager::Status::SUMMARY_STATUS_COUNT, |
1009 enum_indexed_array); | 1013 enum_indexed_array); |
1010 if (summary < 0 || | 1014 if (summary < 0 || |
1011 summary >= sync_api::SyncManager::Status::SUMMARY_STATUS_COUNT) { | 1015 summary >= sync_api::SyncManager::Status::SUMMARY_STATUS_COUNT) { |
1012 LOG(DFATAL) << "Illegal Summary Value: " << summary; | 1016 LOG(DFATAL) << "Illegal Summary Value: " << summary; |
1013 return "UNKNOWN"; | 1017 return "UNKNOWN"; |
1014 } | 1018 } |
1015 return strings[summary]; | 1019 return strings[summary]; |
1016 } | 1020 } |
1017 | 1021 |
1018 bool ProfileSyncService::sync_initialized() const { | 1022 bool ProfileSyncService::sync_initialized() const { |
1019 return backend_initialized_; | 1023 return backend_initialized_; |
1020 } | 1024 } |
1021 | 1025 |
1022 bool ProfileSyncService::unrecoverable_error_detected() const { | 1026 bool ProfileSyncService::unrecoverable_error_detected() const { |
1023 return unrecoverable_error_detected_; | 1027 return unrecoverable_error_detected_; |
1024 } | 1028 } |
1025 | 1029 |
| 1030 bool ProfileSyncService::UIShouldDepictAuthInProgress() const { |
| 1031 return is_auth_in_progress_; |
| 1032 } |
| 1033 |
1026 bool ProfileSyncService::IsPassphraseRequired() const { | 1034 bool ProfileSyncService::IsPassphraseRequired() const { |
1027 return passphrase_required_reason_ != | 1035 return passphrase_required_reason_ != |
1028 sync_api::REASON_PASSPHRASE_NOT_REQUIRED; | 1036 sync_api::REASON_PASSPHRASE_NOT_REQUIRED; |
1029 } | 1037 } |
1030 | 1038 |
1031 // TODO(zea): Rename this IsPassphraseNeededFromUI and ensure it's used | 1039 // TODO(zea): Rename this IsPassphraseNeededFromUI and ensure it's used |
1032 // appropriately (see http://crbug.com/91379). | 1040 // appropriately (see http://crbug.com/91379). |
1033 bool ProfileSyncService::IsPassphraseRequiredForDecryption() const { | 1041 bool ProfileSyncService::IsPassphraseRequiredForDecryption() const { |
1034 // If there is an encrypted datatype enabled and we don't have the proper | 1042 // If there is an encrypted datatype enabled and we don't have the proper |
1035 // passphrase, we must prompt the user for a passphrase. The only way for the | 1043 // 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... |
1549 << "Unrecoverable error."; | 1557 << "Unrecoverable error."; |
1550 } else { | 1558 } else { |
1551 VLOG(0) << "ConfigureDataTypeManager not invoked because backend is not " | 1559 VLOG(0) << "ConfigureDataTypeManager not invoked because backend is not " |
1552 << "initialized"; | 1560 << "initialized"; |
1553 } | 1561 } |
1554 } | 1562 } |
1555 | 1563 |
1556 const FailedDatatypesHandler& ProfileSyncService::failed_datatypes_handler() { | 1564 const FailedDatatypesHandler& ProfileSyncService::failed_datatypes_handler() { |
1557 return failed_datatypes_handler_; | 1565 return failed_datatypes_handler_; |
1558 } | 1566 } |
OLD | NEW |