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

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/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/value_conversions.h" 10 #include "base/value_conversions.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 : desktop_type_(chrome::GetActiveDesktop()) { 210 : desktop_type_(chrome::GetActiveDesktop()) {
211 profileInfoCacheObserver_.reset( 211 profileInfoCacheObserver_.reset(
212 new UserManagerScreenHandler::ProfileUpdateObserver( 212 new UserManagerScreenHandler::ProfileUpdateObserver(
213 g_browser_process->profile_manager(), this)); 213 g_browser_process->profile_manager(), this));
214 } 214 }
215 215
216 UserManagerScreenHandler::~UserManagerScreenHandler() { 216 UserManagerScreenHandler::~UserManagerScreenHandler() {
217 ScreenlockBridge::Get()->SetLockHandler(NULL); 217 ScreenlockBridge::Get()->SetLockHandler(NULL);
218 } 218 }
219 219
220 void UserManagerScreenHandler::ShowBannerMessage(const std::string& message) { 220 void UserManagerScreenHandler::ShowBannerMessage(
221 const base::string16& message) {
221 web_ui()->CallJavascriptFunction( 222 web_ui()->CallJavascriptFunction(
222 "login.AccountPickerScreen.showBannerMessage", 223 "login.AccountPickerScreen.showBannerMessage",
223 base::StringValue(message)); 224 base::StringValue(message));
224 } 225 }
225 226
226 void UserManagerScreenHandler::ShowUserPodCustomIcon( 227 void UserManagerScreenHandler::ShowUserPodCustomIcon(
227 const std::string& user_email, 228 const std::string& user_email,
228 const gfx::Image& icon) { 229 const ScreenlockBridge::UserPodCustomIconOptions& icon_options) {
229 gfx::ImageSkia icon_skia = icon.AsImageSkia(); 230 scoped_ptr<base::DictionaryValue> icon = icon_options.ToDictionaryValue();
230 base::DictionaryValue icon_representations; 231 if (!icon || icon->empty())
231 icon_representations.SetString( 232 return;
232 "scale1x",
233 webui::GetBitmapDataUrl(icon_skia.GetRepresentation(1.0f).sk_bitmap()));
234 icon_representations.SetString(
235 "scale2x",
236 webui::GetBitmapDataUrl(icon_skia.GetRepresentation(2.0f).sk_bitmap()));
237 web_ui()->CallJavascriptFunction( 233 web_ui()->CallJavascriptFunction(
238 "login.AccountPickerScreen.showUserPodCustomIcon", 234 "login.AccountPickerScreen.showUserPodCustomIcon",
239 base::StringValue(user_email), 235 base::StringValue(user_email),
240 icon_representations); 236 *icon);
241 } 237 }
242 238
243 void UserManagerScreenHandler::HideUserPodCustomIcon( 239 void UserManagerScreenHandler::HideUserPodCustomIcon(
244 const std::string& user_email) { 240 const std::string& user_email) {
245 web_ui()->CallJavascriptFunction( 241 web_ui()->CallJavascriptFunction(
246 "login.AccountPickerScreen.hideUserPodCustomIcon", 242 "login.AccountPickerScreen.hideUserPodCustomIcon",
247 base::StringValue(user_email)); 243 base::StringValue(user_email));
248 } 244 }
249 245
250 void UserManagerScreenHandler::EnableInput() { 246 void UserManagerScreenHandler::EnableInput() {
251 // Nothing here because UI is not disabled when starting to authenticate. 247 // Nothing here because UI is not disabled when starting to authenticate.
252 } 248 }
253 249
254 void UserManagerScreenHandler::SetAuthType( 250 void UserManagerScreenHandler::SetAuthType(
255 const std::string& user_email, 251 const std::string& user_email,
256 ScreenlockBridge::LockHandler::AuthType auth_type, 252 ScreenlockBridge::LockHandler::AuthType auth_type,
257 const std::string& auth_value) { 253 const base::string16& auth_value) {
258 user_auth_type_map_[user_email] = auth_type; 254 user_auth_type_map_[user_email] = auth_type;
259 web_ui()->CallJavascriptFunction( 255 web_ui()->CallJavascriptFunction(
260 "login.AccountPickerScreen.setAuthType", 256 "login.AccountPickerScreen.setAuthType",
261 base::StringValue(user_email), 257 base::StringValue(user_email),
262 base::FundamentalValue(auth_type), 258 base::FundamentalValue(auth_type),
263 base::StringValue(auth_value)); 259 base::StringValue(auth_value));
264 } 260 }
265 261
266 ScreenlockBridge::LockHandler::AuthType UserManagerScreenHandler::GetAuthType( 262 ScreenlockBridge::LockHandler::AuthType UserManagerScreenHandler::GetAuthType(
267 const std::string& user_email) const { 263 const std::string& user_email) const {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 } else { 646 } else {
651 web_ui()->CallJavascriptFunction( 647 web_ui()->CallJavascriptFunction(
652 "cr.ui.Oobe.showSignInError", 648 "cr.ui.Oobe.showSignInError",
653 base::FundamentalValue(0), 649 base::FundamentalValue(0),
654 base::StringValue( 650 base::StringValue(
655 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)), 651 l10n_util::GetStringUTF8(IDS_LOGIN_ERROR_AUTHENTICATING)),
656 base::StringValue(""), 652 base::StringValue(""),
657 base::FundamentalValue(0)); 653 base::FundamentalValue(0));
658 } 654 }
659 } 655 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/user_manager_screen_handler.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698