OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/signin/user_manager_screen_handler.h" | 5 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/value_conversions.h" | 8 #include "base/value_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 info_cache.IsUsingGAIAPictureOfProfileAtIndex(index) && | 100 info_cache.IsUsingGAIAPictureOfProfileAtIndex(index) && |
101 info_cache.GetGAIAPictureOfProfileAtIndex(index); | 101 info_cache.GetGAIAPictureOfProfileAtIndex(index); |
102 | 102 |
103 // If the avatar is too small (i.e. the old-style low resolution avatar), | 103 // If the avatar is too small (i.e. the old-style low resolution avatar), |
104 // it will be pixelated when displayed in the User Manager, so we should | 104 // it will be pixelated when displayed in the User Manager, so we should |
105 // return the placeholder avatar instead. | 105 // return the placeholder avatar instead. |
106 gfx::Image avatar_image = info_cache.GetAvatarIconOfProfileAtIndex(index); | 106 gfx::Image avatar_image = info_cache.GetAvatarIconOfProfileAtIndex(index); |
107 if (avatar_image.Width() <= profiles::kAvatarIconWidth || | 107 if (avatar_image.Width() <= profiles::kAvatarIconWidth || |
108 avatar_image.Height() <= profiles::kAvatarIconHeight ) { | 108 avatar_image.Height() <= profiles::kAvatarIconHeight ) { |
109 avatar_image = ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 109 avatar_image = ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
110 IDR_USER_MANAGER_DEFAULT_AVATAR); | 110 profiles::GetPlaceholderAvatarIconResourceID()); |
111 } | 111 } |
112 gfx::Image resized_image = profiles::GetSizedAvatarIcon( | 112 gfx::Image resized_image = profiles::GetSizedAvatarIcon( |
113 avatar_image, is_gaia_picture, kAvatarIconSize, kAvatarIconSize); | 113 avatar_image, is_gaia_picture, kAvatarIconSize, kAvatarIconSize); |
114 return webui::GetBitmapDataUrl(resized_image.AsBitmap()); | 114 return webui::GetBitmapDataUrl(resized_image.AsBitmap()); |
115 } | 115 } |
116 | 116 |
117 size_t GetIndexOfProfileWithEmailAndName(const ProfileInfoCache& info_cache, | 117 size_t GetIndexOfProfileWithEmailAndName(const ProfileInfoCache& info_cache, |
118 const base::string16& email, | 118 const base::string16& email, |
119 const base::string16& name) { | 119 const base::string16& name) { |
120 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) { | 120 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) { |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 } else { | 544 } else { |
545 web_ui()->CallJavascriptFunction( | 545 web_ui()->CallJavascriptFunction( |
546 "cr.ui.Oobe.showSignInError", | 546 "cr.ui.Oobe.showSignInError", |
547 base::FundamentalValue(0), | 547 base::FundamentalValue(0), |
548 base::StringValue( | 548 base::StringValue( |
549 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), | 549 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), |
550 base::StringValue(""), | 550 base::StringValue(""), |
551 base::FundamentalValue(0)); | 551 base::FundamentalValue(0)); |
552 } | 552 } |
553 } | 553 } |
OLD | NEW |