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 19 matching lines...) Expand all Loading... |
30 #include "grit/chromium_strings.h" | 30 #include "grit/chromium_strings.h" |
31 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
32 #include "grit/locale_settings.h" | 32 #include "grit/locale_settings.h" |
33 #include "sync/internal_api/public/base/model_type.h" | 33 #include "sync/internal_api/public/base/model_type.h" |
34 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 34 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
35 #include "sync/protocol/proto_enum_conversions.h" | 35 #include "sync/protocol/proto_enum_conversions.h" |
36 #include "sync/protocol/sync_protocol_error.h" | 36 #include "sync/protocol/sync_protocol_error.h" |
37 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
38 | 38 |
39 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
40 #include "chrome/browser/chromeos/login/users/user_manager.h" | 40 #include "components/user_manager/user_manager.h" |
41 #endif // defined(OS_CHROMEOS) | 41 #endif // defined(OS_CHROMEOS) |
42 | 42 |
43 typedef GoogleServiceAuthError AuthError; | 43 typedef GoogleServiceAuthError AuthError; |
44 | 44 |
45 namespace sync_ui_util { | 45 namespace sync_ui_util { |
46 | 46 |
47 namespace { | 47 namespace { |
48 | 48 |
49 // Returns the message that should be displayed when the user is authenticated | 49 // Returns the message that should be displayed when the user is authenticated |
50 // and can connect to the sync server. If the user hasn't yet authenticated, an | 50 // and can connect to the sync server. If the user hasn't yet authenticated, an |
51 // empty string is returned. | 51 // empty string is returned. |
52 base::string16 GetSyncedStateStatusLabel(ProfileSyncService* service, | 52 base::string16 GetSyncedStateStatusLabel(ProfileSyncService* service, |
53 const SigninManagerBase& signin, | 53 const SigninManagerBase& signin, |
54 StatusLabelStyle style) { | 54 StatusLabelStyle style) { |
55 std::string user_display_name = signin.GetAuthenticatedUsername(); | 55 std::string user_display_name = signin.GetAuthenticatedUsername(); |
56 | 56 |
57 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
58 if (chromeos::UserManager::IsInitialized()) { | 58 if (user_manager::UserManager::IsInitialized()) { |
59 // On CrOS user email is sanitized and then passed to the signin manager. | 59 // On CrOS user email is sanitized and then passed to the signin manager. |
60 // Original email (containing dots) is stored as "display email". | 60 // Original email (containing dots) is stored as "display email". |
61 user_display_name = chromeos::UserManager::Get()-> | 61 user_display_name = user_manager::UserManager::Get()->GetUserDisplayEmail( |
62 GetUserDisplayEmail(user_display_name); | 62 user_display_name); |
63 } | 63 } |
64 #endif // defined(OS_CHROMEOS) | 64 #endif // defined(OS_CHROMEOS) |
65 | 65 |
66 base::string16 user_name = base::UTF8ToUTF16(user_display_name); | 66 base::string16 user_name = base::UTF8ToUTF16(user_display_name); |
67 | 67 |
68 if (!user_name.empty()) { | 68 if (!user_name.empty()) { |
69 if (!service || service->IsManaged()) { | 69 if (!service || service->IsManaged()) { |
70 // User is signed in, but sync is disabled. | 70 // User is signed in, but sync is disabled. |
71 return l10n_util::GetStringFUTF16(IDS_SIGNED_IN_WITH_SYNC_DISABLED, | 71 return l10n_util::GetStringFUTF16(IDS_SIGNED_IN_WITH_SYNC_DISABLED, |
72 user_name); | 72 user_name); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 base::string16 ConstructTime(int64 time_in_int) { | 379 base::string16 ConstructTime(int64 time_in_int) { |
380 base::Time time = base::Time::FromInternalValue(time_in_int); | 380 base::Time time = base::Time::FromInternalValue(time_in_int); |
381 | 381 |
382 // If time is null the format function returns a time in 1969. | 382 // If time is null the format function returns a time in 1969. |
383 if (time.is_null()) | 383 if (time.is_null()) |
384 return base::string16(); | 384 return base::string16(); |
385 return base::TimeFormatFriendlyDateAndTime(time); | 385 return base::TimeFormatFriendlyDateAndTime(time); |
386 } | 386 } |
387 | 387 |
388 } // namespace sync_ui_util | 388 } // namespace sync_ui_util |
OLD | NEW |