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

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

Powered by Google App Engine
This is Rietveld 408576698