| 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/sync_ui_util.h" | 5 #include "chrome/browser/sync/sync_ui_util.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
| 10 #include "chrome/browser/sync/profile_sync_service.h" | 10 #include "chrome/browser/sync/profile_sync_service.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 if (!service) { | 80 if (!service) { |
| 81 return PRE_SYNCED; | 81 return PRE_SYNCED; |
| 82 } | 82 } |
| 83 | 83 |
| 84 if (service->HasSyncSetupCompleted()) { | 84 if (service->HasSyncSetupCompleted()) { |
| 85 ProfileSyncService::Status status(service->QueryDetailedSyncStatus()); | 85 ProfileSyncService::Status status(service->QueryDetailedSyncStatus()); |
| 86 const AuthError& auth_error = service->GetAuthError(); | 86 const AuthError& auth_error = service->GetAuthError(); |
| 87 | 87 |
| 88 // Either show auth error information with a link to re-login, auth in prog, | 88 // Either show auth error information with a link to re-login, auth in prog, |
| 89 // or note that everything is OK with the last synced time. | 89 // or note that everything is OK with the last synced time. |
| 90 if (status.authenticated) { | 90 if (status.authenticated && !service->observed_passphrase_required()) { |
| 91 // Everything is peachy. | 91 // Everything is peachy. |
| 92 if (status_label) { | 92 if (status_label) { |
| 93 status_label->assign(GetSyncedStateStatusLabel(service)); | 93 status_label->assign(GetSyncedStateStatusLabel(service)); |
| 94 } | 94 } |
| 95 DCHECK_EQ(auth_error.state(), AuthError::NONE); | 95 DCHECK_EQ(auth_error.state(), AuthError::NONE); |
| 96 } else if (service->UIShouldDepictAuthInProgress()) { | 96 } else if (service->UIShouldDepictAuthInProgress()) { |
| 97 if (status_label) { | 97 if (status_label) { |
| 98 status_label->assign( | 98 status_label->assign( |
| 99 l10n_util::GetStringUTF16(IDS_SYNC_AUTHENTICATING_LABEL)); | 99 l10n_util::GetStringUTF16(IDS_SYNC_AUTHENTICATING_LABEL)); |
| 100 } | 100 } |
| 101 result_type = PRE_SYNCED; | 101 result_type = PRE_SYNCED; |
| 102 } else if (auth_error.state() != AuthError::NONE) { | 102 } else if (auth_error.state() != AuthError::NONE || |
| 103 service->observed_passphrase_required()) { |
| 103 if (status_label && link_label) { | 104 if (status_label && link_label) { |
| 104 GetStatusLabelsForAuthError(auth_error, service, | 105 GetStatusLabelsForAuthError(auth_error, service, |
| 105 status_label, link_label); | 106 status_label, link_label); |
| 106 } | 107 } |
| 107 result_type = SYNC_ERROR; | 108 result_type = SYNC_ERROR; |
| 108 } | 109 } |
| 109 } else { | 110 } else { |
| 110 // Either show auth error information with a link to re-login, auth in prog, | 111 // Either show auth error information with a link to re-login, auth in prog, |
| 111 // or provide a link to continue with setup. | 112 // or provide a link to continue with setup. |
| 112 result_type = PRE_SYNCED; | 113 result_type = PRE_SYNCED; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 191 } |
| 191 if (service->HasSyncSetupCompleted()) { | 192 if (service->HasSyncSetupCompleted()) { |
| 192 ShowOptionsWindow(OPTIONS_PAGE_CONTENT, OPTIONS_GROUP_NONE, profile); | 193 ShowOptionsWindow(OPTIONS_PAGE_CONTENT, OPTIONS_GROUP_NONE, profile); |
| 193 } else { | 194 } else { |
| 194 service->ShowLoginDialog(NULL); | 195 service->ShowLoginDialog(NULL); |
| 195 ProfileSyncService::SyncEvent(code); // UMA stats | 196 ProfileSyncService::SyncEvent(code); // UMA stats |
| 196 } | 197 } |
| 197 } | 198 } |
| 198 | 199 |
| 199 } // namespace sync_ui_util | 200 } // namespace sync_ui_util |
| OLD | NEW |