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

Side by Side Diff: chrome/browser/ui/webui/settings/profile_info_handler.cc

Issue 2471993002: Remove calls to User::email() from chrome/browser/ui/webui/* (Closed)
Patch Set: Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ui/webui/settings/profile_info_handler.h" 5 #include "chrome/browser/ui/webui/settings/profile_info_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 ProfileInfoHandler::GetAccountNameAndIcon() const { 138 ProfileInfoHandler::GetAccountNameAndIcon() const {
139 std::string name; 139 std::string name;
140 std::string icon_url; 140 std::string icon_url;
141 141
142 #if defined(OS_CHROMEOS) 142 #if defined(OS_CHROMEOS)
143 name = profile_->GetProfileUserName(); 143 name = profile_->GetProfileUserName();
144 if (name.empty()) { 144 if (name.empty()) {
145 const user_manager::User* user = 145 const user_manager::User* user =
146 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); 146 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_);
147 if (user && (user->GetType() != user_manager::USER_TYPE_GUEST)) 147 if (user && (user->GetType() != user_manager::USER_TYPE_GUEST))
148 name = user->email(); 148 name = user->GetAccountId().GetUserEmail();
149 } 149 }
150 if (!name.empty()) 150 if (!name.empty())
151 name = gaia::SanitizeEmail(gaia::CanonicalizeEmail(name)); 151 name = gaia::SanitizeEmail(gaia::CanonicalizeEmail(name));
152 152
153 // Get image as data URL instead of using chrome://userimage source to avoid 153 // Get image as data URL instead of using chrome://userimage source to avoid
154 // issues with caching. 154 // issues with caching.
155 const AccountId account_id(AccountId::FromUserEmail(name)); 155 const AccountId account_id(AccountId::FromUserEmail(name));
156 scoped_refptr<base::RefCountedMemory> image = 156 scoped_refptr<base::RefCountedMemory> image =
157 chromeos::options::UserImageSource::GetUserImage(account_id); 157 chromeos::options::UserImageSource::GetUserImage(account_id);
158 icon_url = webui::GetPngDataUrl(image->front(), image->size()); 158 icon_url = webui::GetPngDataUrl(image->front(), image->size());
(...skipping 18 matching lines...) Expand all
177 response->SetString("name", name); 177 response->SetString("name", name);
178 response->SetString("iconUrl", icon_url); 178 response->SetString("iconUrl", icon_url);
179 return base::WrapUnique(response); 179 return base::WrapUnique(response);
180 } 180 }
181 181
182 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const { 182 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const {
183 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); 183 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty();
184 } 184 }
185 185
186 } // namespace settings 186 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698