| 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/google_service_auth_error.h" | 9 #include "chrome/browser/google_service_auth_error.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 // Returns the message that should be displayed when the user is authenticated | 53 // Returns the message that should be displayed when the user is authenticated |
| 54 // and can connect to the sync server. If the user hasn't yet authenticated, an | 54 // and can connect to the sync server. If the user hasn't yet authenticated, an |
| 55 // empty string is returned. | 55 // empty string is returned. |
| 56 string16 GetSyncedStateStatusLabel(ProfileSyncService* service) { | 56 string16 GetSyncedStateStatusLabel(ProfileSyncService* service) { |
| 57 string16 label; | 57 string16 label; |
| 58 string16 user_name(service->GetAuthenticatedUsername()); | 58 string16 user_name(service->GetAuthenticatedUsername()); |
| 59 if (user_name.empty()) | 59 if (user_name.empty()) |
| 60 return label; | 60 return label; |
| 61 | 61 |
| 62 return l10n_util::GetStringFUTF16( | 62 return l10n_util::GetStringFUTF16(IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME, |
| 63 IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME, | 63 user_name, |
| 64 user_name, | 64 service->GetLastSyncedTimeString()); |
| 65 WideToUTF16(service->GetLastSyncedTimeString())); | |
| 66 } | 65 } |
| 67 | 66 |
| 68 // TODO(akalin): Write unit tests for these three functions below. | 67 // TODO(akalin): Write unit tests for these three functions below. |
| 69 | 68 |
| 70 // status_label and link_label must either be both NULL or both non-NULL. | 69 // status_label and link_label must either be both NULL or both non-NULL. |
| 71 MessageType GetStatusInfo(ProfileSyncService* service, | 70 MessageType GetStatusInfo(ProfileSyncService* service, |
| 72 string16* status_label, | 71 string16* status_label, |
| 73 string16* link_label) { | 72 string16* link_label) { |
| 74 DCHECK_EQ(status_label == NULL, link_label == NULL); | 73 DCHECK_EQ(status_label == NULL, link_label == NULL); |
| 75 | 74 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 187 } |
| 189 if (service->HasSyncSetupCompleted()) { | 188 if (service->HasSyncSetupCompleted()) { |
| 190 ShowOptionsWindow(OPTIONS_PAGE_CONTENT, OPTIONS_GROUP_NONE, profile); | 189 ShowOptionsWindow(OPTIONS_PAGE_CONTENT, OPTIONS_GROUP_NONE, profile); |
| 191 } else { | 190 } else { |
| 192 service->EnableForUser(NULL); | 191 service->EnableForUser(NULL); |
| 193 ProfileSyncService::SyncEvent(code); | 192 ProfileSyncService::SyncEvent(code); |
| 194 } | 193 } |
| 195 } | 194 } |
| 196 | 195 |
| 197 } // namespace sync_ui_util | 196 } // namespace sync_ui_util |
| OLD | NEW |