Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1133)

Side by Side Diff: chrome/browser/sync/sync_ui_util.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 base::string16 GetSyncedStateStatusLabel(ProfileSyncService* service, 56 base::string16 GetSyncedStateStatusLabel(ProfileSyncService* service,
57 const SigninManagerBase& signin, 57 const SigninManagerBase& signin,
58 StatusLabelStyle style) { 58 StatusLabelStyle style) {
59 std::string user_display_name = signin.GetAuthenticatedUsername(); 59 std::string user_display_name = signin.GetAuthenticatedUsername();
60 60
61 #if defined(OS_CHROMEOS) 61 #if defined(OS_CHROMEOS)
62 if (user_manager::UserManager::IsInitialized()) { 62 if (user_manager::UserManager::IsInitialized()) {
63 // On CrOS user email is sanitized and then passed to the signin manager. 63 // On CrOS user email is sanitized and then passed to the signin manager.
64 // Original email (containing dots) is stored as "display email". 64 // Original email (containing dots) is stored as "display email".
65 user_display_name = user_manager::UserManager::Get()->GetUserDisplayEmail( 65 user_display_name = user_manager::UserManager::Get()->GetUserDisplayEmail(
66 user_display_name); 66 user_manager::UserID::FromUserEmail(user_display_name));
67 } 67 }
68 #endif // defined(OS_CHROMEOS) 68 #endif // defined(OS_CHROMEOS)
69 69
70 base::string16 user_name = base::UTF8ToUTF16(user_display_name); 70 base::string16 user_name = base::UTF8ToUTF16(user_display_name);
71 71
72 if (!user_name.empty()) { 72 if (!user_name.empty()) {
73 if (!service || service->IsManaged()) { 73 if (!service || service->IsManaged()) {
74 // User is signed in, but sync is disabled. 74 // User is signed in, but sync is disabled.
75 return l10n_util::GetStringFUTF16(IDS_SIGNED_IN_WITH_SYNC_DISABLED, 75 return l10n_util::GetStringFUTF16(IDS_SIGNED_IN_WITH_SYNC_DISABLED,
76 user_name); 76 user_name);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 base::string16 ConstructTime(int64 time_in_int) { 389 base::string16 ConstructTime(int64 time_in_int) {
390 base::Time time = base::Time::FromInternalValue(time_in_int); 390 base::Time time = base::Time::FromInternalValue(time_in_int);
391 391
392 // If time is null the format function returns a time in 1969. 392 // If time is null the format function returns a time in 1969.
393 if (time.is_null()) 393 if (time.is_null())
394 return base::string16(); 394 return base::string16();
395 return base::TimeFormatFriendlyDateAndTime(time); 395 return base::TimeFormatFriendlyDateAndTime(time);
396 } 396 }
397 397
398 } // namespace sync_ui_util 398 } // namespace sync_ui_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698