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

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

Issue 2857753003: MD Settings: make avatar icon account for scale factor (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 icon_url = webui::GetPngDataUrl(image->front(), image->size()); 202 icon_url = webui::GetPngDataUrl(image->front(), image->size());
203 #else // !defined(OS_CHROMEOS) 203 #else // !defined(OS_CHROMEOS)
204 ProfileAttributesEntry* entry; 204 ProfileAttributesEntry* entry;
205 if (g_browser_process->profile_manager() 205 if (g_browser_process->profile_manager()
206 ->GetProfileAttributesStorage() 206 ->GetProfileAttributesStorage()
207 .GetProfileAttributesWithPath(profile_->GetPath(), &entry)) { 207 .GetProfileAttributesWithPath(profile_->GetPath(), &entry)) {
208 name = base::UTF16ToUTF8(entry->GetName()); 208 name = base::UTF16ToUTF8(entry->GetName());
209 // TODO(crbug.com/710660): return chrome://theme/IDR_PROFILE_AVATAR_* 209 // TODO(crbug.com/710660): return chrome://theme/IDR_PROFILE_AVATAR_*
210 // and update theme_source.cc to get high res avatar icons. This does less 210 // and update theme_source.cc to get high res avatar icons. This does less
211 // work here, sends less over IPC, and is more stable with returned results. 211 // work here, sends less over IPC, and is more stable with returned results.
212 constexpr int kAvatarIconSize = 40; 212 int kAvatarIconSize = 40.f * web_ui()->GetDeviceScaleFactor();
213 gfx::Image icon = profiles::GetSizedAvatarIcon( 213 gfx::Image icon = profiles::GetSizedAvatarIcon(
214 entry->GetAvatarIcon(), true, kAvatarIconSize, kAvatarIconSize); 214 entry->GetAvatarIcon(), true, kAvatarIconSize, kAvatarIconSize);
215 icon_url = webui::GetBitmapDataUrl(icon.AsBitmap()); 215 icon_url = webui::GetBitmapDataUrl(icon.AsBitmap());
216 } 216 }
217 #endif // defined(OS_CHROMEOS) 217 #endif // defined(OS_CHROMEOS)
218 218
219 base::DictionaryValue* response = new base::DictionaryValue(); 219 base::DictionaryValue* response = new base::DictionaryValue();
220 response->SetString("name", name); 220 response->SetString("name", name);
221 response->SetString("iconUrl", icon_url); 221 response->SetString("iconUrl", icon_url);
222 return base::WrapUnique(response); 222 return base::WrapUnique(response);
223 } 223 }
224 224
225 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const { 225 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const {
226 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); 226 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty();
227 } 227 }
228 228
229 } // namespace settings 229 } // namespace settings
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698