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