OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 StatusLabelStyle style) { | 49 StatusLabelStyle style) { |
50 string16 user_name = UTF8ToUTF16(signin.GetAuthenticatedUsername()); | 50 string16 user_name = UTF8ToUTF16(signin.GetAuthenticatedUsername()); |
51 | 51 |
52 if (!user_name.empty()) { | 52 if (!user_name.empty()) { |
53 if (!service || service->IsManaged()) { | 53 if (!service || service->IsManaged()) { |
54 // User is signed in, but sync is disabled. | 54 // User is signed in, but sync is disabled. |
55 return l10n_util::GetStringFUTF16(IDS_SIGNED_IN_WITH_SYNC_DISABLED, | 55 return l10n_util::GetStringFUTF16(IDS_SIGNED_IN_WITH_SYNC_DISABLED, |
56 user_name); | 56 user_name); |
57 } else if (service->IsStartSuppressed()) { | 57 } else if (service->IsStartSuppressed()) { |
58 // User is signed in, but sync has been stopped. | 58 // User is signed in, but sync has been stopped. |
59 return l10n_util::GetStringFUTF16( | 59 return l10n_util::GetStringFUTF16(IDS_SIGNED_IN_WITH_SYNC_SUPPRESSED, |
60 IDS_SIGNED_IN_WITH_SYNC_SUPPRESSED, | 60 user_name); |
61 user_name, | |
62 ASCIIToUTF16(chrome::kSyncGoogleDashboardURL)); | |
63 } | 61 } |
64 } | 62 } |
65 | 63 |
66 if (!service || !service->sync_initialized()) { | 64 if (!service || !service->sync_initialized()) { |
67 // User is not signed in, or sync is still initializing. | 65 // User is not signed in, or sync is still initializing. |
68 return string16(); | 66 return string16(); |
69 } | 67 } |
70 | 68 |
71 DCHECK(!user_name.empty()); | 69 DCHECK(!user_name.empty()); |
72 | 70 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 status_label); | 244 status_label); |
247 } | 245 } |
248 } else if (status_label) { | 246 } else if (status_label) { |
249 status_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_SETUP_ERROR)); | 247 status_label->assign(l10n_util::GetStringUTF16(IDS_SYNC_SETUP_ERROR)); |
250 } | 248 } |
251 } else if (!signin.GetAuthenticatedUsername().empty()) { | 249 } else if (!signin.GetAuthenticatedUsername().empty()) { |
252 // The user is signed in, but sync has been stopped. | 250 // The user is signed in, but sync has been stopped. |
253 if (status_label) { | 251 if (status_label) { |
254 string16 label = l10n_util::GetStringFUTF16( | 252 string16 label = l10n_util::GetStringFUTF16( |
255 IDS_SIGNED_IN_WITH_SYNC_SUPPRESSED, | 253 IDS_SIGNED_IN_WITH_SYNC_SUPPRESSED, |
256 UTF8ToUTF16(signin.GetAuthenticatedUsername()), | 254 UTF8ToUTF16(signin.GetAuthenticatedUsername())); |
257 ASCIIToUTF16(chrome::kSyncGoogleDashboardURL)); | |
258 status_label->assign(label); | 255 status_label->assign(label); |
259 result_type = PRE_SYNCED; | 256 result_type = PRE_SYNCED; |
260 } | 257 } |
261 } | 258 } |
262 } | 259 } |
263 return result_type; | 260 return result_type; |
264 } | 261 } |
265 | 262 |
266 // Returns the status info for use on the new tab page, where we want slightly | 263 // Returns the status info for use on the new tab page, where we want slightly |
267 // different information than in the settings panel. | 264 // different information than in the settings panel. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 string16 ConstructTime(int64 time_in_int) { | 360 string16 ConstructTime(int64 time_in_int) { |
364 base::Time time = base::Time::FromInternalValue(time_in_int); | 361 base::Time time = base::Time::FromInternalValue(time_in_int); |
365 | 362 |
366 // If time is null the format function returns a time in 1969. | 363 // If time is null the format function returns a time in 1969. |
367 if (time.is_null()) | 364 if (time.is_null()) |
368 return string16(); | 365 return string16(); |
369 return base::TimeFormatFriendlyDateAndTime(time); | 366 return base::TimeFormatFriendlyDateAndTime(time); |
370 } | 367 } |
371 | 368 |
372 } // namespace sync_ui_util | 369 } // namespace sync_ui_util |
OLD | NEW |