| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/settings_manage_profile_handler.h" | 5 #include "chrome/browser/ui/webui/settings/settings_manage_profile_handler.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/value_conversions.h" | 15 #include "base/value_conversions.h" |
| 13 #include "base/values.h" | 16 #include "base/values.h" |
| 14 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/profiles/gaia_info_update_service.h" | 19 #include "chrome/browser/profiles/gaia_info_update_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/profiles/profile_attributes_entry.h" | 21 #include "chrome/browser/profiles/profile_attributes_entry.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 std::unique_ptr<base::ListValue> ManageProfileHandler::GetAvailableIcons() { | 103 std::unique_ptr<base::ListValue> ManageProfileHandler::GetAvailableIcons() { |
| 101 std::unique_ptr<base::ListValue> image_url_list( | 104 std::unique_ptr<base::ListValue> image_url_list( |
| 102 profiles::GetDefaultProfileAvatarIconsAndLabels()); | 105 profiles::GetDefaultProfileAvatarIconsAndLabels()); |
| 103 | 106 |
| 104 // Add the GAIA picture to the beginning of the list if it is available. | 107 // Add the GAIA picture to the beginning of the list if it is available. |
| 105 ProfileAttributesEntry* entry; | 108 ProfileAttributesEntry* entry; |
| 106 if (g_browser_process->profile_manager()->GetProfileAttributesStorage(). | 109 if (g_browser_process->profile_manager()->GetProfileAttributesStorage(). |
| 107 GetProfileAttributesWithPath(profile_->GetPath(), &entry)) { | 110 GetProfileAttributesWithPath(profile_->GetPath(), &entry)) { |
| 108 const gfx::Image* icon = entry->GetGAIAPicture(); | 111 const gfx::Image* icon = entry->GetGAIAPicture(); |
| 109 if (icon) { | 112 if (icon) { |
| 110 base::DictionaryValue* gaia_picture_info = new base::DictionaryValue(); | 113 auto gaia_picture_info = base::MakeUnique<base::DictionaryValue>(); |
| 111 gfx::Image icon2 = profiles::GetAvatarIconForWebUI(*icon, true); | 114 gfx::Image icon2 = profiles::GetAvatarIconForWebUI(*icon, true); |
| 112 gaia_picture_url_ = webui::GetBitmapDataUrl(icon2.AsBitmap()); | 115 gaia_picture_url_ = webui::GetBitmapDataUrl(icon2.AsBitmap()); |
| 113 gaia_picture_info->SetString("url", gaia_picture_url_); | 116 gaia_picture_info->SetString("url", gaia_picture_url_); |
| 114 gaia_picture_info->SetString( | 117 gaia_picture_info->SetString( |
| 115 "label", | 118 "label", |
| 116 l10n_util::GetStringUTF16(IDS_SETTINGS_CHANGE_PICTURE_PROFILE_PHOTO)); | 119 l10n_util::GetStringUTF16(IDS_SETTINGS_CHANGE_PICTURE_PROFILE_PHOTO)); |
| 117 image_url_list->Insert(0, gaia_picture_info); | 120 image_url_list->Insert(0, std::move(gaia_picture_info)); |
| 118 } | 121 } |
| 119 } | 122 } |
| 120 | 123 |
| 121 return image_url_list; | 124 return image_url_list; |
| 122 } | 125 } |
| 123 | 126 |
| 124 void ManageProfileHandler::HandleSetProfileIconAndName( | 127 void ManageProfileHandler::HandleSetProfileIconAndName( |
| 125 const base::ListValue* args) { | 128 const base::ListValue* args) { |
| 126 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 129 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 127 DCHECK(args); | 130 DCHECK(args); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 g_browser_process->profile_manager()->profile_shortcut_manager(); | 223 g_browser_process->profile_manager()->profile_shortcut_manager(); |
| 221 DCHECK(shortcut_manager); | 224 DCHECK(shortcut_manager); |
| 222 | 225 |
| 223 shortcut_manager->RemoveProfileShortcuts(profile_->GetPath()); | 226 shortcut_manager->RemoveProfileShortcuts(profile_->GetPath()); |
| 224 | 227 |
| 225 // Update the UI buttons. | 228 // Update the UI buttons. |
| 226 OnHasProfileShortcuts(false); | 229 OnHasProfileShortcuts(false); |
| 227 } | 230 } |
| 228 | 231 |
| 229 } // namespace settings | 232 } // namespace settings |
| OLD | NEW |