| OLD | NEW |
| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 chromeos::options::UserImageSource::GetUserImage(account_id); | 207 chromeos::options::UserImageSource::GetUserImage(account_id); |
| 208 icon_url = webui::GetPngDataUrl(image->front(), image->size()); | 208 icon_url = webui::GetPngDataUrl(image->front(), image->size()); |
| 209 #else // !defined(OS_CHROMEOS) | 209 #else // !defined(OS_CHROMEOS) |
| 210 ProfileAttributesEntry* entry; | 210 ProfileAttributesEntry* entry; |
| 211 if (g_browser_process->profile_manager() | 211 if (g_browser_process->profile_manager() |
| 212 ->GetProfileAttributesStorage() | 212 ->GetProfileAttributesStorage() |
| 213 .GetProfileAttributesWithPath(profile_->GetPath(), &entry)) { | 213 .GetProfileAttributesWithPath(profile_->GetPath(), &entry)) { |
| 214 name = base::UTF16ToUTF8(entry->GetName()); | 214 name = base::UTF16ToUTF8(entry->GetName()); |
| 215 | 215 |
| 216 if (entry->IsUsingGAIAPicture() && entry->GetGAIAPicture()) { | 216 if (entry->IsUsingGAIAPicture() && entry->GetGAIAPicture()) { |
| 217 gfx::Image icon = | 217 constexpr int kAvatarIconSize = 40; |
| 218 profiles::GetAvatarIconForWebUI(entry->GetAvatarIcon(), true); | 218 gfx::Image icon = profiles::GetSizedAvatarIcon( |
| 219 entry->GetAvatarIcon(), true, kAvatarIconSize, kAvatarIconSize); |
| 219 icon_url = webui::GetBitmapDataUrl(icon.AsBitmap()); | 220 icon_url = webui::GetBitmapDataUrl(icon.AsBitmap()); |
| 220 } else { | 221 } else { |
| 221 icon_url = profiles::GetDefaultAvatarIconUrl(entry->GetAvatarIconIndex()); | 222 icon_url = profiles::GetDefaultAvatarIconUrl(entry->GetAvatarIconIndex()); |
| 222 } | 223 } |
| 223 } | 224 } |
| 224 #endif // defined(OS_CHROMEOS) | 225 #endif // defined(OS_CHROMEOS) |
| 225 | 226 |
| 226 base::DictionaryValue* response = new base::DictionaryValue(); | 227 base::DictionaryValue* response = new base::DictionaryValue(); |
| 227 response->SetString("name", name); | 228 response->SetString("name", name); |
| 228 response->SetString("iconUrl", icon_url); | 229 response->SetString("iconUrl", icon_url); |
| 229 return base::WrapUnique(response); | 230 return base::WrapUnique(response); |
| 230 } | 231 } |
| 231 | 232 |
| 232 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const { | 233 bool ProfileInfoHandler::IsProfileManagingSupervisedUsers() const { |
| 233 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); | 234 return !profile_->GetPrefs()->GetDictionary(prefs::kSupervisedUsers)->empty(); |
| 234 } | 235 } |
| 235 | 236 |
| 236 } // namespace settings | 237 } // namespace settings |
| OLD | NEW |