| 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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 } | 878 } |
| 879 | 879 |
| 880 void SigninScreenHandler::SetPublicSessionDisplayName( | 880 void SigninScreenHandler::SetPublicSessionDisplayName( |
| 881 const std::string& user_id, | 881 const std::string& user_id, |
| 882 const std::string& display_name) { | 882 const std::string& display_name) { |
| 883 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", | 883 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", |
| 884 user_id, | 884 user_id, |
| 885 display_name); | 885 display_name); |
| 886 } | 886 } |
| 887 | 887 |
| 888 void SigninScreenHandler::SetPublicSessionLocales( | |
| 889 const std::string& user_id, | |
| 890 scoped_ptr<base::ListValue> locales, | |
| 891 const std::string& default_locale, | |
| 892 bool multipleRecommendedLocales) { | |
| 893 CallJS("login.AccountPickerScreen.setPublicSessionLocales", | |
| 894 user_id, | |
| 895 *locales, | |
| 896 default_locale, | |
| 897 multipleRecommendedLocales); | |
| 898 } | |
| 899 | |
| 900 void SigninScreenHandler::Observe(int type, | 888 void SigninScreenHandler::Observe(int type, |
| 901 const content::NotificationSource& source, | 889 const content::NotificationSource& source, |
| 902 const content::NotificationDetails& details) { | 890 const content::NotificationDetails& details) { |
| 903 switch (type) { | 891 switch (type) { |
| 904 case chrome::NOTIFICATION_AUTH_NEEDED: { | 892 case chrome::NOTIFICATION_AUTH_NEEDED: { |
| 905 has_pending_auth_ui_ = true; | 893 has_pending_auth_ui_ = true; |
| 906 break; | 894 break; |
| 907 } | 895 } |
| 908 case chrome::NOTIFICATION_AUTH_SUPPLIED: | 896 case chrome::NOTIFICATION_AUTH_SUPPLIED: |
| 909 has_pending_auth_ui_ = false; | 897 has_pending_auth_ui_ = false; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 attempt_token), | 1323 attempt_token), |
| 1336 Profile::FromWebUI(web_ui())->GetRequestContext())); | 1324 Profile::FromWebUI(web_ui())->GetRequestContext())); |
| 1337 } | 1325 } |
| 1338 | 1326 |
| 1339 void SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts( | 1327 void SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts( |
| 1340 const std::string& user_id, | 1328 const std::string& user_id, |
| 1341 const std::string& locale) { | 1329 const std::string& locale) { |
| 1342 GetKeyboardLayoutsForLocale( | 1330 GetKeyboardLayoutsForLocale( |
| 1343 base::Bind(&SigninScreenHandler::SendPublicSessionKeyboardLayouts, | 1331 base::Bind(&SigninScreenHandler::SendPublicSessionKeyboardLayouts, |
| 1344 weak_factory_.GetWeakPtr(), | 1332 weak_factory_.GetWeakPtr(), |
| 1345 user_id, | 1333 user_id), |
| 1346 locale), | |
| 1347 locale); | 1334 locale); |
| 1348 } | 1335 } |
| 1349 | 1336 |
| 1350 void SigninScreenHandler::SendPublicSessionKeyboardLayouts( | 1337 void SigninScreenHandler::SendPublicSessionKeyboardLayouts( |
| 1351 const std::string& user_id, | 1338 const std::string& user_id, |
| 1352 const std::string& locale, | |
| 1353 scoped_ptr<base::ListValue> keyboard_layouts) { | 1339 scoped_ptr<base::ListValue> keyboard_layouts) { |
| 1354 CallJS("login.AccountPickerScreen.setPublicSessionKeyboardLayouts", | 1340 web_ui()->CallJavascriptFunction( |
| 1355 user_id, | 1341 "login.AccountPickerScreen.setPublicSessionKeyboardLayouts", |
| 1356 locale, | 1342 base::StringValue(user_id), |
| 1357 *keyboard_layouts); | 1343 *keyboard_layouts); |
| 1358 } | 1344 } |
| 1359 | 1345 |
| 1360 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id, | 1346 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id, |
| 1361 bool diagnostic_mode) { | 1347 bool diagnostic_mode) { |
| 1362 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_id); | 1348 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_id); |
| 1363 SigninSpecifics specifics; | 1349 SigninSpecifics specifics; |
| 1364 specifics.kiosk_diagnostic_mode = diagnostic_mode; | 1350 specifics.kiosk_diagnostic_mode = diagnostic_mode; |
| 1365 if (delegate_) | 1351 if (delegate_) |
| 1366 delegate_->Login(context, specifics); | 1352 delegate_->Login(context, specifics); |
| 1367 } | 1353 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 return gaia_screen_handler_->frame_error(); | 1477 return gaia_screen_handler_->frame_error(); |
| 1492 } | 1478 } |
| 1493 | 1479 |
| 1494 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1480 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
| 1495 caps_lock_enabled_ = enabled; | 1481 caps_lock_enabled_ = enabled; |
| 1496 if (page_is_ready()) | 1482 if (page_is_ready()) |
| 1497 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1483 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
| 1498 } | 1484 } |
| 1499 | 1485 |
| 1500 } // namespace chromeos | 1486 } // namespace chromeos |
| OLD | NEW |