| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifdef CHROME_PERSONALIZATION | 5 #ifdef CHROME_PERSONALIZATION |
| 6 | 6 |
| 7 #include "chrome/browser/sync/sync_status_ui_helper.h" | 7 #include "chrome/browser/sync/sync_status_ui_helper.h" |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 return l10n_util::GetStringF(IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME, | 56 return l10n_util::GetStringF(IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME, |
| 57 user_name, service->GetLastSyncedTimeString()); | 57 user_name, service->GetLastSyncedTimeString()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // static | 60 // static |
| 61 SyncStatusUIHelper::MessageType SyncStatusUIHelper::GetLabels( | 61 SyncStatusUIHelper::MessageType SyncStatusUIHelper::GetLabels( |
| 62 ProfileSyncService* service, std::wstring* status_label, | 62 ProfileSyncService* service, std::wstring* status_label, |
| 63 std::wstring* link_label) { | 63 std::wstring* link_label) { |
| 64 MessageType result_type(SYNCED); | 64 MessageType result_type(SYNCED); |
| 65 | 65 |
| 66 if (!service) { |
| 67 return PRE_SYNCED; |
| 68 } |
| 69 |
| 66 if (service->HasSyncSetupCompleted()) { | 70 if (service->HasSyncSetupCompleted()) { |
| 67 ProfileSyncService::Status status(service->QueryDetailedSyncStatus()); | 71 ProfileSyncService::Status status(service->QueryDetailedSyncStatus()); |
| 68 AuthErrorState auth_error(service->GetAuthErrorState()); | 72 AuthErrorState auth_error(service->GetAuthErrorState()); |
| 69 | 73 |
| 70 // Either show auth error information with a link to re-login, auth in prog, | 74 // Either show auth error information with a link to re-login, auth in prog, |
| 71 // or note that everything is OK with the last synced time. | 75 // or note that everything is OK with the last synced time. |
| 72 if (status.authenticated) { | 76 if (status.authenticated) { |
| 73 // Everything is peachy. | 77 // Everything is peachy. |
| 74 status_label->assign(GetSyncedStateStatusLabel(service)); | 78 status_label->assign(GetSyncedStateStatusLabel(service)); |
| 75 DCHECK_EQ(auth_error, AUTH_ERROR_NONE); | 79 DCHECK_EQ(auth_error, AUTH_ERROR_NONE); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 104 result_type = SYNC_ERROR; | 108 result_type = SYNC_ERROR; |
| 105 status_label->assign(l10n_util::GetString(IDS_SYNC_SETUP_ERROR)); | 109 status_label->assign(l10n_util::GetString(IDS_SYNC_SETUP_ERROR)); |
| 106 } else { | 110 } else { |
| 107 status_label->assign(l10n_util::GetString(IDS_SYNC_NOT_SET_UP_INFO)); | 111 status_label->assign(l10n_util::GetString(IDS_SYNC_NOT_SET_UP_INFO)); |
| 108 } | 112 } |
| 109 } | 113 } |
| 110 return result_type; | 114 return result_type; |
| 111 } | 115 } |
| 112 | 116 |
| 113 #endif // CHROME_PERSONALIZATION | 117 #endif // CHROME_PERSONALIZATION |
| OLD | NEW |