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