| 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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/value_conversions.h" | 9 #include "base/value_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 gfx::Image resized_image = profiles::GetSizedAvatarIcon( | 113 gfx::Image resized_image = profiles::GetSizedAvatarIcon( |
| 114 avatar_image, is_gaia_picture, kAvatarIconSize, kAvatarIconSize); | 114 avatar_image, is_gaia_picture, kAvatarIconSize, kAvatarIconSize); |
| 115 return webui::GetBitmapDataUrl(resized_image.AsBitmap()); | 115 return webui::GetBitmapDataUrl(resized_image.AsBitmap()); |
| 116 } | 116 } |
| 117 | 117 |
| 118 size_t GetIndexOfProfileWithEmailAndName(const ProfileInfoCache& info_cache, | 118 size_t GetIndexOfProfileWithEmailAndName(const ProfileInfoCache& info_cache, |
| 119 const base::string16& email, | 119 const base::string16& email, |
| 120 const base::string16& name) { | 120 const base::string16& name) { |
| 121 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) { | 121 for (size_t i = 0; i < info_cache.GetNumberOfProfiles(); ++i) { |
| 122 if (info_cache.GetUserNameOfProfileAtIndex(i) == email && | 122 if (info_cache.GetUserNameOfProfileAtIndex(i) == email && |
| 123 (name.empty() || info_cache.GetNameOfProfileAtIndex(i) == name)) { | 123 (name.empty() || |
| 124 profiles::GetAvatarNameForProfile( |
| 125 info_cache.GetPathOfProfileAtIndex(i)) == name)) { |
| 124 return i; | 126 return i; |
| 125 } | 127 } |
| 126 } | 128 } |
| 127 return std::string::npos; | 129 return std::string::npos; |
| 128 } | 130 } |
| 129 | 131 |
| 130 extensions::ScreenlockPrivateEventRouter* GetScreenlockRouter( | 132 extensions::ScreenlockPrivateEventRouter* GetScreenlockRouter( |
| 131 const std::string& email) { | 133 const std::string& email) { |
| 132 ProfileInfoCache& info_cache = | 134 ProfileInfoCache& info_cache = |
| 133 g_browser_process->profile_manager()->GetProfileInfoCache(); | 135 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 } else { | 650 } else { |
| 649 web_ui()->CallJavascriptFunction( | 651 web_ui()->CallJavascriptFunction( |
| 650 "cr.ui.Oobe.showSignInError", | 652 "cr.ui.Oobe.showSignInError", |
| 651 base::FundamentalValue(0), | 653 base::FundamentalValue(0), |
| 652 base::StringValue( | 654 base::StringValue( |
| 653 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), | 655 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), |
| 654 base::StringValue(""), | 656 base::StringValue(""), |
| 655 base::FundamentalValue(0)); | 657 base::FundamentalValue(0)); |
| 656 } | 658 } |
| 657 } | 659 } |
| OLD | NEW |