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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | |
12 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
13 #include "base/location.h" | 12 #include "base/location.h" |
14 #include "base/logging.h" | 13 #include "base/logging.h" |
15 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
16 #include "base/prefs/pref_registry_simple.h" | 15 #include "base/prefs/pref_registry_simple.h" |
17 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
18 #include "base/prefs/scoped_user_pref_update.h" | 17 #include "base/prefs/scoped_user_pref_update.h" |
19 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
20 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
21 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
(...skipping 17 matching lines...) Expand all Loading... |
39 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 38 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
40 #include "chrome/browser/chromeos/login/wizard_controller.h" | 39 #include "chrome/browser/chromeos/login/wizard_controller.h" |
41 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 40 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
42 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | 41 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
43 #include "chrome/browser/chromeos/policy/device_local_account.h" | 42 #include "chrome/browser/chromeos/policy/device_local_account.h" |
44 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 43 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
45 #include "chrome/browser/chromeos/settings/cros_settings.h" | 44 #include "chrome/browser/chromeos/settings/cros_settings.h" |
46 #include "chrome/browser/io_thread.h" | 45 #include "chrome/browser/io_thread.h" |
47 #include "chrome/browser/profiles/profile.h" | 46 #include "chrome/browser/profiles/profile.h" |
48 #include "chrome/browser/signin/easy_unlock_service.h" | 47 #include "chrome/browser/signin/easy_unlock_service.h" |
49 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie
ver.h" | |
50 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" | 48 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" |
51 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 49 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
52 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" | 50 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" |
53 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 51 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
54 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 52 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
55 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
56 #include "chrome/common/url_constants.h" | 54 #include "chrome/common/url_constants.h" |
57 #include "chrome/grit/chromium_strings.h" | 55 #include "chrome/grit/chromium_strings.h" |
58 #include "chrome/grit/generated_resources.h" | 56 #include "chrome/grit/generated_resources.h" |
59 #include "chromeos/dbus/dbus_thread_manager.h" | 57 #include "chromeos/dbus/dbus_thread_manager.h" |
60 #include "chromeos/dbus/power_manager_client.h" | 58 #include "chromeos/dbus/power_manager_client.h" |
61 #include "chromeos/ime/ime_keyboard.h" | 59 #include "chromeos/ime/ime_keyboard.h" |
62 #include "chromeos/ime/input_method_descriptor.h" | 60 #include "chromeos/ime/input_method_descriptor.h" |
63 #include "chromeos/ime/input_method_manager.h" | 61 #include "chromeos/ime/input_method_manager.h" |
64 #include "chromeos/login/auth/key.h" | 62 #include "chromeos/login/auth/key.h" |
65 #include "chromeos/login/auth/user_context.h" | 63 #include "chromeos/login/auth/user_context.h" |
66 #include "chromeos/network/network_state.h" | 64 #include "chromeos/network/network_state.h" |
67 #include "chromeos/network/network_state_handler.h" | 65 #include "chromeos/network/network_state_handler.h" |
68 #include "chromeos/network/portal_detector/network_portal_detector.h" | 66 #include "chromeos/network/portal_detector/network_portal_detector.h" |
69 #include "components/user_manager/user.h" | 67 #include "components/user_manager/user.h" |
70 #include "components/user_manager/user_manager.h" | 68 #include "components/user_manager/user_manager.h" |
71 #include "components/user_manager/user_type.h" | 69 #include "components/user_manager/user_type.h" |
72 #include "content/public/browser/render_frame_host.h" | 70 #include "content/public/browser/render_frame_host.h" |
73 #include "content/public/browser/web_contents.h" | 71 #include "content/public/browser/web_contents.h" |
74 #include "google_apis/gaia/gaia_auth_util.h" | 72 #include "google_apis/gaia/gaia_auth_util.h" |
75 #include "net/url_request/url_request_context_getter.h" | |
76 #include "third_party/cros_system_api/dbus/service_constants.h" | 73 #include "third_party/cros_system_api/dbus/service_constants.h" |
77 #include "ui/base/webui/web_ui_util.h" | 74 #include "ui/base/webui/web_ui_util.h" |
78 | 75 |
79 #if defined(USE_AURA) | 76 #if defined(USE_AURA) |
80 #include "ash/shell.h" | 77 #include "ash/shell.h" |
81 #include "ash/wm/lock_state_controller.h" | 78 #include "ash/wm/lock_state_controller.h" |
82 #endif | 79 #endif |
83 | 80 |
84 namespace { | 81 namespace { |
85 | 82 |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 AddCallback("loginUIStateChanged", | 762 AddCallback("loginUIStateChanged", |
766 &SigninScreenHandler::HandleLoginUIStateChanged); | 763 &SigninScreenHandler::HandleLoginUIStateChanged); |
767 AddCallback("unlockOnLoginSuccess", | 764 AddCallback("unlockOnLoginSuccess", |
768 &SigninScreenHandler::HandleUnlockOnLoginSuccess); | 765 &SigninScreenHandler::HandleUnlockOnLoginSuccess); |
769 AddCallback("showLoadingTimeoutError", | 766 AddCallback("showLoadingTimeoutError", |
770 &SigninScreenHandler::HandleShowLoadingTimeoutError); | 767 &SigninScreenHandler::HandleShowLoadingTimeoutError); |
771 AddCallback("updateOfflineLogin", | 768 AddCallback("updateOfflineLogin", |
772 &SigninScreenHandler::HandleUpdateOfflineLogin); | 769 &SigninScreenHandler::HandleUpdateOfflineLogin); |
773 AddCallback("focusPod", &SigninScreenHandler::HandleFocusPod); | 770 AddCallback("focusPod", &SigninScreenHandler::HandleFocusPod); |
774 AddCallback("hardlockPod", &SigninScreenHandler::HandleHardlockPod); | 771 AddCallback("hardlockPod", &SigninScreenHandler::HandleHardlockPod); |
775 AddCallback("retrieveAuthenticatedUserEmail", | |
776 &SigninScreenHandler::HandleRetrieveAuthenticatedUserEmail); | |
777 AddCallback("getPublicSessionKeyboardLayouts", | 772 AddCallback("getPublicSessionKeyboardLayouts", |
778 &SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts); | 773 &SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts); |
779 AddCallback("cancelConsumerManagementEnrollment", | 774 AddCallback("cancelConsumerManagementEnrollment", |
780 &SigninScreenHandler::HandleCancelConsumerManagementEnrollment); | 775 &SigninScreenHandler::HandleCancelConsumerManagementEnrollment); |
781 AddCallback("getTouchViewState", | 776 AddCallback("getTouchViewState", |
782 &SigninScreenHandler::HandleGetTouchViewState); | 777 &SigninScreenHandler::HandleGetTouchViewState); |
783 | 778 |
784 | 779 |
785 // This message is sent by the kiosk app menu, but is handled here | 780 // This message is sent by the kiosk app menu, but is handled here |
786 // so we can tell the delegate to launch the app. | 781 // so we can tell the delegate to launch the app. |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 void SigninScreenHandler::HandleHardlockPod(const std::string& user_id) { | 1368 void SigninScreenHandler::HandleHardlockPod(const std::string& user_id) { |
1374 SetAuthType(user_id, | 1369 SetAuthType(user_id, |
1375 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, | 1370 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, |
1376 base::string16()); | 1371 base::string16()); |
1377 EasyUnlockService* service = GetEasyUnlockServiceForUser(user_id); | 1372 EasyUnlockService* service = GetEasyUnlockServiceForUser(user_id); |
1378 if (!service) | 1373 if (!service) |
1379 return; | 1374 return; |
1380 service->SetHardlockState(EasyUnlockScreenlockStateHandler::USER_HARDLOCK); | 1375 service->SetHardlockState(EasyUnlockScreenlockStateHandler::USER_HARDLOCK); |
1381 } | 1376 } |
1382 | 1377 |
1383 void SigninScreenHandler::HandleRetrieveAuthenticatedUserEmail( | |
1384 double attempt_token) { | |
1385 // TODO(antrim) : move GaiaSigninScreen dependency to GaiaSigninScreen. | |
1386 email_retriever_.reset(new AuthenticatedUserEmailRetriever( | |
1387 base::Bind(&SigninScreenHandler::CallJS<double, std::string>, | |
1388 base::Unretained(this), | |
1389 "login.GaiaSigninScreen.setAuthenticatedUserEmail", | |
1390 attempt_token), | |
1391 Profile::FromWebUI(web_ui())->GetRequestContext())); | |
1392 } | |
1393 | |
1394 void SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts( | 1378 void SigninScreenHandler::HandleGetPublicSessionKeyboardLayouts( |
1395 const std::string& user_id, | 1379 const std::string& user_id, |
1396 const std::string& locale) { | 1380 const std::string& locale) { |
1397 GetKeyboardLayoutsForLocale( | 1381 GetKeyboardLayoutsForLocale( |
1398 base::Bind(&SigninScreenHandler::SendPublicSessionKeyboardLayouts, | 1382 base::Bind(&SigninScreenHandler::SendPublicSessionKeyboardLayouts, |
1399 weak_factory_.GetWeakPtr(), | 1383 weak_factory_.GetWeakPtr(), |
1400 user_id, | 1384 user_id, |
1401 locale), | 1385 locale), |
1402 locale); | 1386 locale); |
1403 } | 1387 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 return gaia_screen_handler_->frame_error(); | 1585 return gaia_screen_handler_->frame_error(); |
1602 } | 1586 } |
1603 | 1587 |
1604 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1588 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
1605 caps_lock_enabled_ = enabled; | 1589 caps_lock_enabled_ = enabled; |
1606 if (page_is_ready()) | 1590 if (page_is_ready()) |
1607 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1591 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
1608 } | 1592 } |
1609 | 1593 |
1610 } // namespace chromeos | 1594 } // namespace chromeos |
OLD | NEW |