| OLD | NEW |
| 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/ui/webui/options/manage_profile_handler.h" | 5 #include "chrome/browser/ui/webui/options/manage_profile_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 ProfileInfoCache& cache = | 117 ProfileInfoCache& cache = |
| 118 g_browser_process->profile_manager()->GetProfileInfoCache(); | 118 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 119 Profile* profile = Profile::FromWebUI(web_ui()); | 119 Profile* profile = Profile::FromWebUI(web_ui()); |
| 120 size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 120 size_t profile_index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
| 121 if (profile_index != std::string::npos) { | 121 if (profile_index != std::string::npos) { |
| 122 const gfx::Image* icon = | 122 const gfx::Image* icon = |
| 123 cache.GetGAIAPictureOfProfileAtIndex(profile_index); | 123 cache.GetGAIAPictureOfProfileAtIndex(profile_index); |
| 124 if (icon) { | 124 if (icon) { |
| 125 gfx::Image icon2 = profiles::GetAvatarIconForWebUI(*icon, true); | 125 gfx::Image icon2 = profiles::GetAvatarIconForWebUI(*icon, true); |
| 126 gaia_picture_url_ = web_ui_util::GetBitmapDataUrl(icon2.AsBitmap()); | 126 gaia_picture_url_ = web_ui_util::GetBitmapDataUrl(icon2.AsBitmap()); |
| 127 image_url_list.Append(Value::CreateStringValue(gaia_picture_url_)); | 127 image_url_list.Append(new base::StringValue(gaia_picture_url_)); |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Next add the default avatar icons. | 131 // Next add the default avatar icons. |
| 132 for (size_t i = 0; i < ProfileInfoCache::GetDefaultAvatarIconCount(); i++) { | 132 for (size_t i = 0; i < ProfileInfoCache::GetDefaultAvatarIconCount(); i++) { |
| 133 std::string url = ProfileInfoCache::GetDefaultAvatarIconUrl(i); | 133 std::string url = ProfileInfoCache::GetDefaultAvatarIconUrl(i); |
| 134 image_url_list.Append(Value::CreateStringValue(url)); | 134 image_url_list.Append(new base::StringValue(url)); |
| 135 } | 135 } |
| 136 | 136 |
| 137 web_ui()->CallJavascriptFunction( | 137 web_ui()->CallJavascriptFunction( |
| 138 "ManageProfileOverlay.receiveDefaultProfileIcons", icon_grid, | 138 "ManageProfileOverlay.receiveDefaultProfileIcons", icon_grid, |
| 139 image_url_list); | 139 image_url_list); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void ManageProfileHandler::SendProfileNames() { | 142 void ManageProfileHandler::SendProfileNames() { |
| 143 ProfileInfoCache& cache = | 143 ProfileInfoCache& cache = |
| 144 g_browser_process->profile_manager()->GetProfileInfoCache(); | 144 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i); | 299 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i); |
| 300 if (gaia_name.empty()) | 300 if (gaia_name.empty()) |
| 301 return; | 301 return; |
| 302 | 302 |
| 303 StringValue gaia_name_value(gaia_name); | 303 StringValue gaia_name_value(gaia_name); |
| 304 web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName", | 304 web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName", |
| 305 gaia_name_value); | 305 gaia_name_value); |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace options | 308 } // namespace options |
| OLD | NEW |