| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/chromeos/login/signin_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 } | 856 } |
| 857 | 857 |
| 858 void SigninScreenHandler::SetPublicSessionDisplayName( | 858 void SigninScreenHandler::SetPublicSessionDisplayName( |
| 859 const std::string& user_id, | 859 const std::string& user_id, |
| 860 const std::string& display_name) { | 860 const std::string& display_name) { |
| 861 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", | 861 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", |
| 862 user_id, | 862 user_id, |
| 863 display_name); | 863 display_name); |
| 864 } | 864 } |
| 865 | 865 |
| 866 void SigninScreenHandler::SetPublicSessionLocales( |
| 867 const std::string& user_id, |
| 868 scoped_ptr<base::ListValue> locales, |
| 869 const std::string& default_locale, |
| 870 bool multipleRecommendedLocales) { |
| 871 CallJS("login.AccountPickerScreen.setPublicSessionLocales", |
| 872 user_id, |
| 873 *locales, |
| 874 default_locale, |
| 875 multipleRecommendedLocales); |
| 876 } |
| 877 |
| 866 void SigninScreenHandler::Observe(int type, | 878 void SigninScreenHandler::Observe(int type, |
| 867 const content::NotificationSource& source, | 879 const content::NotificationSource& source, |
| 868 const content::NotificationDetails& details) { | 880 const content::NotificationDetails& details) { |
| 869 switch (type) { | 881 switch (type) { |
| 870 case chrome::NOTIFICATION_AUTH_NEEDED: { | 882 case chrome::NOTIFICATION_AUTH_NEEDED: { |
| 871 has_pending_auth_ui_ = true; | 883 has_pending_auth_ui_ = true; |
| 872 break; | 884 break; |
| 873 } | 885 } |
| 874 case chrome::NOTIFICATION_AUTH_SUPPLIED: | 886 case chrome::NOTIFICATION_AUTH_SUPPLIED: |
| 875 has_pending_auth_ui_ = false; | 887 has_pending_auth_ui_ = false; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 attempt_token), | 1313 attempt_token), |
| 1302 Profile::FromWebUI(web_ui())->GetRequestContext())); | 1314 Profile::FromWebUI(web_ui())->GetRequestContext())); |
| 1303 } | 1315 } |
| 1304 | 1316 |
| 1305 void SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts( | 1317 void SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts( |
| 1306 const std::string& user_id, | 1318 const std::string& user_id, |
| 1307 const std::string& locale) { | 1319 const std::string& locale) { |
| 1308 GetKeyboardLayoutsForLocale( | 1320 GetKeyboardLayoutsForLocale( |
| 1309 base::Bind(&SigninScreenHandler::SendPublicSessionKeyboardLayouts, | 1321 base::Bind(&SigninScreenHandler::SendPublicSessionKeyboardLayouts, |
| 1310 weak_factory_.GetWeakPtr(), | 1322 weak_factory_.GetWeakPtr(), |
| 1311 user_id), | 1323 user_id, |
| 1324 locale), |
| 1312 locale); | 1325 locale); |
| 1313 } | 1326 } |
| 1314 | 1327 |
| 1315 void SigninScreenHandler::SendPublicSessionKeyboardLayouts( | 1328 void SigninScreenHandler::SendPublicSessionKeyboardLayouts( |
| 1316 const std::string& user_id, | 1329 const std::string& user_id, |
| 1330 const std::string& locale, |
| 1317 scoped_ptr<base::ListValue> keyboard_layouts) { | 1331 scoped_ptr<base::ListValue> keyboard_layouts) { |
| 1318 web_ui()->CallJavascriptFunction( | 1332 CallJS("login.AccountPickerScreen.setPublicSessionKeyboardLayouts", |
| 1319 "login.AccountPickerScreen.setPublicSessionKeyboardLayouts", | 1333 user_id, |
| 1320 base::StringValue(user_id), | 1334 locale, |
| 1321 *keyboard_layouts); | 1335 *keyboard_layouts); |
| 1322 } | 1336 } |
| 1323 | 1337 |
| 1324 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id, | 1338 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id, |
| 1325 bool diagnostic_mode) { | 1339 bool diagnostic_mode) { |
| 1326 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_id); | 1340 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_id); |
| 1327 SigninSpecifics specifics; | 1341 SigninSpecifics specifics; |
| 1328 specifics.kiosk_diagnostic_mode = diagnostic_mode; | 1342 specifics.kiosk_diagnostic_mode = diagnostic_mode; |
| 1329 if (delegate_) | 1343 if (delegate_) |
| 1330 delegate_->Login(context, specifics); | 1344 delegate_->Login(context, specifics); |
| 1331 } | 1345 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1448 return gaia_screen_handler_->frame_error(); | 1462 return gaia_screen_handler_->frame_error(); |
| 1449 } | 1463 } |
| 1450 | 1464 |
| 1451 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1465 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
| 1452 caps_lock_enabled_ = enabled; | 1466 caps_lock_enabled_ = enabled; |
| 1453 if (page_is_ready()) | 1467 if (page_is_ready()) |
| 1454 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1468 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
| 1455 } | 1469 } |
| 1456 | 1470 |
| 1457 } // namespace chromeos | 1471 } // namespace chromeos |
| OLD | NEW |