Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(718)

Side by Side Diff: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc

Issue 446743003: Hook up new API for easy unlock to update lock screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 : desktop_type_(chrome::GetActiveDesktop()) { 208 : desktop_type_(chrome::GetActiveDesktop()) {
209 profileInfoCacheObserver_.reset( 209 profileInfoCacheObserver_.reset(
210 new UserManagerScreenHandler::ProfileUpdateObserver( 210 new UserManagerScreenHandler::ProfileUpdateObserver(
211 g_browser_process->profile_manager(), this)); 211 g_browser_process->profile_manager(), this));
212 } 212 }
213 213
214 UserManagerScreenHandler::~UserManagerScreenHandler() { 214 UserManagerScreenHandler::~UserManagerScreenHandler() {
215 ScreenlockBridge::Get()->SetLockHandler(NULL); 215 ScreenlockBridge::Get()->SetLockHandler(NULL);
216 } 216 }
217 217
218 void UserManagerScreenHandler::ShowBannerMessage(const std::string& message) { 218 void UserManagerScreenHandler::ShowBannerMessage(
219 const base::string16& message) {
219 web_ui()->CallJavascriptFunction( 220 web_ui()->CallJavascriptFunction(
220 "login.AccountPickerScreen.showBannerMessage", 221 "login.AccountPickerScreen.showBannerMessage",
221 base::StringValue(message)); 222 base::StringValue(message));
222 } 223 }
223 224
224 void UserManagerScreenHandler::ShowUserPodCustomIcon( 225 void UserManagerScreenHandler::ShowUserPodCustomIcon(
225 const std::string& user_email, 226 const std::string& user_email,
226 const gfx::Image& icon) { 227 const ScreenlockBridge::UserPodCustomIconOptions& icon_options) {
227 gfx::ImageSkia icon_skia = icon.AsImageSkia(); 228 scoped_ptr<base::DictionaryValue> icon = icon_options.ToDictionaryValue();
228 base::DictionaryValue icon_representations; 229 if (!icon || icon->empty())
229 icon_representations.SetString( 230 return;
230 "scale1x",
231 webui::GetBitmapDataUrl(icon_skia.GetRepresentation(1.0f).sk_bitmap()));
232 icon_representations.SetString(
233 "scale2x",
234 webui::GetBitmapDataUrl(icon_skia.GetRepresentation(2.0f).sk_bitmap()));
235 web_ui()->CallJavascriptFunction( 231 web_ui()->CallJavascriptFunction(
236 "login.AccountPickerScreen.showUserPodCustomIcon", 232 "login.AccountPickerScreen.showUserPodCustomIcon",
237 base::StringValue(user_email), 233 base::StringValue(user_email),
238 icon_representations); 234 *icon);
239 } 235 }
240 236
241 void UserManagerScreenHandler::HideUserPodCustomIcon( 237 void UserManagerScreenHandler::HideUserPodCustomIcon(
242 const std::string& user_email) { 238 const std::string& user_email) {
243 web_ui()->CallJavascriptFunction( 239 web_ui()->CallJavascriptFunction(
244 "login.AccountPickerScreen.hideUserPodCustomIcon", 240 "login.AccountPickerScreen.hideUserPodCustomIcon",
245 base::StringValue(user_email)); 241 base::StringValue(user_email));
246 } 242 }
247 243
248 void UserManagerScreenHandler::EnableInput() { 244 void UserManagerScreenHandler::EnableInput() {
249 // Nothing here because UI is not disabled when starting to authenticate. 245 // Nothing here because UI is not disabled when starting to authenticate.
250 } 246 }
251 247
252 void UserManagerScreenHandler::SetAuthType( 248 void UserManagerScreenHandler::SetAuthType(
253 const std::string& user_email, 249 const std::string& user_email,
254 ScreenlockBridge::LockHandler::AuthType auth_type, 250 ScreenlockBridge::LockHandler::AuthType auth_type,
255 const std::string& auth_value) { 251 const base::string16& auth_value) {
256 user_auth_type_map_[user_email] = auth_type; 252 user_auth_type_map_[user_email] = auth_type;
257 web_ui()->CallJavascriptFunction( 253 web_ui()->CallJavascriptFunction(
258 "login.AccountPickerScreen.setAuthType", 254 "login.AccountPickerScreen.setAuthType",
259 base::StringValue(user_email), 255 base::StringValue(user_email),
260 base::FundamentalValue(auth_type), 256 base::FundamentalValue(auth_type),
261 base::StringValue(auth_value)); 257 base::StringValue(auth_value));
262 } 258 }
263 259
264 ScreenlockBridge::LockHandler::AuthType UserManagerScreenHandler::GetAuthType( 260 ScreenlockBridge::LockHandler::AuthType UserManagerScreenHandler::GetAuthType(
265 const std::string& user_email) const { 261 const std::string& user_email) const {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } else { 644 } else {
649 web_ui()->CallJavascriptFunction( 645 web_ui()->CallJavascriptFunction(
650 "cr.ui.Oobe.showSignInError", 646 "cr.ui.Oobe.showSignInError",
651 base::FundamentalValue(0), 647 base::FundamentalValue(0),
652 base::StringValue( 648 base::StringValue(
653 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), 649 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)),
654 base::StringValue(""), 650 base::StringValue(""),
655 base::FundamentalValue(0)); 651 base::FundamentalValue(0));
656 } 652 }
657 } 653 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698