| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 #include "third_party/cros_system_api/dbus/service_constants.h" | 73 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 74 #include "ui/base/webui/web_ui_util.h" | 74 #include "ui/base/webui/web_ui_util.h" |
| 75 #include "ui/gfx/image/image.h" | 75 #include "ui/gfx/image/image.h" |
| 76 #include "ui/gfx/image/image_skia.h" | 76 #include "ui/gfx/image/image_skia.h" |
| 77 | 77 |
| 78 #if defined(USE_AURA) | 78 #if defined(USE_AURA) |
| 79 #include "ash/shell.h" | 79 #include "ash/shell.h" |
| 80 #include "ash/wm/lock_state_controller.h" | 80 #include "ash/wm/lock_state_controller.h" |
| 81 #endif | 81 #endif |
| 82 | 82 |
| 83 using content::BrowserThread; | |
| 84 | |
| 85 namespace { | 83 namespace { |
| 86 | 84 |
| 87 // Max number of users to show. | 85 // Max number of users to show. |
| 88 const size_t kMaxUsers = 18; | 86 const size_t kMaxUsers = 18; |
| 89 | 87 |
| 90 // Timeout to delay first notification about offline state for a | 88 // Timeout to delay first notification about offline state for a |
| 91 // current network. | 89 // current network. |
| 92 const int kOfflineTimeoutSec = 5; | 90 const int kOfflineTimeoutSec = 5; |
| 93 | 91 |
| 94 // Timeout used to prevent infinite connecting to a flaky network. | 92 // Timeout used to prevent infinite connecting to a flaky network. |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 base::Bind(&SigninScreenHandler::CallJS<double, std::string>, | 1284 base::Bind(&SigninScreenHandler::CallJS<double, std::string>, |
| 1287 base::Unretained(this), | 1285 base::Unretained(this), |
| 1288 "login.GaiaSigninScreen.setAuthenticatedUserEmail", | 1286 "login.GaiaSigninScreen.setAuthenticatedUserEmail", |
| 1289 attempt_token), | 1287 attempt_token), |
| 1290 Profile::FromWebUI(web_ui())->GetRequestContext())); | 1288 Profile::FromWebUI(web_ui())->GetRequestContext())); |
| 1291 } | 1289 } |
| 1292 | 1290 |
| 1293 void SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts( | 1291 void SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts( |
| 1294 const std::string& user_id, | 1292 const std::string& user_id, |
| 1295 const std::string& locale) { | 1293 const std::string& locale) { |
| 1294 GetKeyboardLayoutsForLocale( |
| 1295 base::Bind(&SigninScreenHandler::SendPublicSessionKeyboardLayouts, |
| 1296 weak_factory_.GetWeakPtr(), |
| 1297 user_id), |
| 1298 locale); |
| 1299 } |
| 1300 |
| 1301 void SigninScreenHandler::SendPublicSessionKeyboardLayouts( |
| 1302 const std::string& user_id, |
| 1303 scoped_ptr<base::ListValue> keyboard_layouts) { |
| 1296 web_ui()->CallJavascriptFunction( | 1304 web_ui()->CallJavascriptFunction( |
| 1297 "login.AccountPickerScreen.setPublicSessionKeyboardLayouts", | 1305 "login.AccountPickerScreen.setPublicSessionKeyboardLayouts", |
| 1298 base::StringValue(user_id), | 1306 base::StringValue(user_id), |
| 1299 *GetKeyboardLayoutsForLocale(locale).release()); | 1307 *keyboard_layouts); |
| 1300 } | 1308 } |
| 1301 | 1309 |
| 1302 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id, | 1310 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id, |
| 1303 bool diagnostic_mode) { | 1311 bool diagnostic_mode) { |
| 1304 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_id); | 1312 UserContext context(user_manager::USER_TYPE_KIOSK_APP, app_id); |
| 1305 SigninSpecifics specifics; | 1313 SigninSpecifics specifics; |
| 1306 specifics.kiosk_diagnostic_mode = diagnostic_mode; | 1314 specifics.kiosk_diagnostic_mode = diagnostic_mode; |
| 1307 if (delegate_) | 1315 if (delegate_) |
| 1308 delegate_->Login(context, specifics); | 1316 delegate_->Login(context, specifics); |
| 1309 } | 1317 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 return gaia_screen_handler_->frame_error(); | 1434 return gaia_screen_handler_->frame_error(); |
| 1427 } | 1435 } |
| 1428 | 1436 |
| 1429 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1437 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
| 1430 caps_lock_enabled_ = enabled; | 1438 caps_lock_enabled_ = enabled; |
| 1431 if (page_is_ready()) | 1439 if (page_is_ready()) |
| 1432 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1440 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
| 1433 } | 1441 } |
| 1434 | 1442 |
| 1435 } // namespace chromeos | 1443 } // namespace chromeos |
| OLD | NEW |