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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/chromeos/boot_times_loader.h" | 29 #include "chrome/browser/chromeos/boot_times_loader.h" |
30 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 30 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
31 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 31 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
32 #include "chrome/browser/chromeos/login/hwid_checker.h" | 32 #include "chrome/browser/chromeos/login/hwid_checker.h" |
33 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 33 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
34 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 34 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
35 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 35 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
36 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 36 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
37 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 37 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
38 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 38 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
39 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
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/extensions/api/screenlock_private/screenlock_private_ap
i.h" | 46 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" |
48 #include "chrome/browser/io_thread.h" | 47 #include "chrome/browser/io_thread.h" |
49 #include "chrome/browser/profiles/profile.h" | 48 #include "chrome/browser/profiles/profile.h" |
50 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie
ver.h" | 49 #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" | 50 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" |
52 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 51 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
53 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" | 52 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" |
54 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 53 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
55 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 54 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
56 #include "chrome/common/pref_names.h" | 55 #include "chrome/common/pref_names.h" |
57 #include "chrome/common/url_constants.h" | 56 #include "chrome/common/url_constants.h" |
58 #include "chromeos/dbus/dbus_thread_manager.h" | 57 #include "chromeos/dbus/dbus_thread_manager.h" |
59 #include "chromeos/dbus/power_manager_client.h" | 58 #include "chromeos/dbus/power_manager_client.h" |
60 #include "chromeos/ime/ime_keyboard.h" | 59 #include "chromeos/ime/ime_keyboard.h" |
61 #include "chromeos/ime/input_method_descriptor.h" | 60 #include "chromeos/ime/input_method_descriptor.h" |
62 #include "chromeos/ime/input_method_manager.h" | 61 #include "chromeos/ime/input_method_manager.h" |
63 #include "chromeos/login/auth/key.h" | 62 #include "chromeos/login/auth/key.h" |
64 #include "chromeos/login/auth/user_context.h" | 63 #include "chromeos/login/auth/user_context.h" |
65 #include "chromeos/network/network_state.h" | 64 #include "chromeos/network/network_state.h" |
66 #include "chromeos/network/network_state_handler.h" | 65 #include "chromeos/network/network_state_handler.h" |
67 #include "chromeos/network/portal_detector/network_portal_detector.h" | 66 #include "chromeos/network/portal_detector/network_portal_detector.h" |
68 #include "components/user_manager/user.h" | 67 #include "components/user_manager/user.h" |
| 68 #include "components/user_manager/user_manager.h" |
69 #include "components/user_manager/user_type.h" | 69 #include "components/user_manager/user_type.h" |
70 #include "content/public/browser/render_frame_host.h" | 70 #include "content/public/browser/render_frame_host.h" |
71 #include "content/public/browser/web_contents.h" | 71 #include "content/public/browser/web_contents.h" |
72 #include "google_apis/gaia/gaia_auth_util.h" | 72 #include "google_apis/gaia/gaia_auth_util.h" |
73 #include "grit/chromium_strings.h" | 73 #include "grit/chromium_strings.h" |
74 #include "grit/generated_resources.h" | 74 #include "grit/generated_resources.h" |
75 #include "net/url_request/url_request_context_getter.h" | 75 #include "net/url_request/url_request_context_getter.h" |
76 #include "third_party/cros_system_api/dbus/service_constants.h" | 76 #include "third_party/cros_system_api/dbus/service_constants.h" |
77 #include "ui/base/webui/web_ui_util.h" | 77 #include "ui/base/webui/web_ui_util.h" |
78 | 78 |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 bool SigninScreenHandler::ShouldLoadGaia() const { | 967 bool SigninScreenHandler::ShouldLoadGaia() const { |
968 // Fetching of the extension is not started before account picker page is | 968 // Fetching of the extension is not started before account picker page is |
969 // loaded because it can affect the loading speed. | 969 // loaded because it can affect the loading speed. |
970 // Do not load the extension for the screen locker, see crosbug.com/25018. | 970 // Do not load the extension for the screen locker, see crosbug.com/25018. |
971 return !ScreenLocker::default_screen_locker() && | 971 return !ScreenLocker::default_screen_locker() && |
972 is_account_picker_showing_first_time_; | 972 is_account_picker_showing_first_time_; |
973 } | 973 } |
974 | 974 |
975 // Update keyboard layout to least recently used by the user. | 975 // Update keyboard layout to least recently used by the user. |
976 void SigninScreenHandler::SetUserInputMethod(const std::string& username) { | 976 void SigninScreenHandler::SetUserInputMethod(const std::string& username) { |
977 UserManager* user_manager = UserManager::Get(); | 977 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
978 if (user_manager->IsUserLoggedIn()) { | 978 if (user_manager->IsUserLoggedIn()) { |
979 // We are on sign-in screen inside user session (adding new user to | 979 // We are on sign-in screen inside user session (adding new user to |
980 // the session or on lock screen), don't switch input methods in this case. | 980 // the session or on lock screen), don't switch input methods in this case. |
981 // TODO(dpolukhin): adding user and sign-in should be consistent | 981 // TODO(dpolukhin): adding user and sign-in should be consistent |
982 // crbug.com/292774 | 982 // crbug.com/292774 |
983 return; | 983 return; |
984 } | 984 } |
985 | 985 |
986 chromeos::input_method::InputMethodManager* const manager = | 986 chromeos::input_method::InputMethodManager* const manager = |
987 chromeos::input_method::InputMethodManager::Get(); | 987 chromeos::input_method::InputMethodManager::Get(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 delegate_->Login(context, SigninSpecifics()); | 1052 delegate_->Login(context, SigninSpecifics()); |
1053 } | 1053 } |
1054 | 1054 |
1055 void SigninScreenHandler::HandleLaunchIncognito() { | 1055 void SigninScreenHandler::HandleLaunchIncognito() { |
1056 UserContext context(user_manager::USER_TYPE_GUEST, std::string()); | 1056 UserContext context(user_manager::USER_TYPE_GUEST, std::string()); |
1057 if (delegate_) | 1057 if (delegate_) |
1058 delegate_->Login(context, SigninSpecifics()); | 1058 delegate_->Login(context, SigninSpecifics()); |
1059 } | 1059 } |
1060 | 1060 |
1061 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() { | 1061 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() { |
1062 if (!UserManager::Get()->AreSupervisedUsersAllowed()) { | 1062 if (!user_manager::UserManager::Get()->AreSupervisedUsersAllowed()) { |
1063 LOG(ERROR) << "Managed users not allowed."; | 1063 LOG(ERROR) << "Managed users not allowed."; |
1064 return; | 1064 return; |
1065 } | 1065 } |
1066 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue()); | 1066 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue()); |
1067 LoginDisplayHostImpl::default_host()-> | 1067 LoginDisplayHostImpl::default_host()-> |
1068 StartWizard(WizardController::kSupervisedUserCreationScreenName, | 1068 StartWizard(WizardController::kSupervisedUserCreationScreenName, |
1069 params.Pass()); | 1069 params.Pass()); |
1070 } | 1070 } |
1071 | 1071 |
1072 void SigninScreenHandler::HandleLaunchPublicSession( | 1072 void SigninScreenHandler::HandleLaunchPublicSession( |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 ui_state_ = UI_STATE_GAIA_SIGNIN; | 1277 ui_state_ = UI_STATE_GAIA_SIGNIN; |
1278 } else if (source == kSourceAccountPicker) { | 1278 } else if (source == kSourceAccountPicker) { |
1279 ui_state_ = UI_STATE_ACCOUNT_PICKER; | 1279 ui_state_ = UI_STATE_ACCOUNT_PICKER; |
1280 } else { | 1280 } else { |
1281 NOTREACHED(); | 1281 NOTREACHED(); |
1282 return; | 1282 return; |
1283 } | 1283 } |
1284 } | 1284 } |
1285 | 1285 |
1286 void SigninScreenHandler::HandleUnlockOnLoginSuccess() { | 1286 void SigninScreenHandler::HandleUnlockOnLoginSuccess() { |
1287 DCHECK(UserManager::Get()->IsUserLoggedIn()); | 1287 DCHECK(user_manager::UserManager::Get()->IsUserLoggedIn()); |
1288 if (ScreenLocker::default_screen_locker()) | 1288 if (ScreenLocker::default_screen_locker()) |
1289 ScreenLocker::default_screen_locker()->UnlockOnLoginSuccess(); | 1289 ScreenLocker::default_screen_locker()->UnlockOnLoginSuccess(); |
1290 } | 1290 } |
1291 | 1291 |
1292 void SigninScreenHandler::HandleShowLoadingTimeoutError() { | 1292 void SigninScreenHandler::HandleShowLoadingTimeoutError() { |
1293 UpdateState(ErrorScreenActor::ERROR_REASON_LOADING_TIMEOUT); | 1293 UpdateState(ErrorScreenActor::ERROR_REASON_LOADING_TIMEOUT); |
1294 } | 1294 } |
1295 | 1295 |
1296 void SigninScreenHandler::HandleUpdateOfflineLogin(bool offline_login_active) { | 1296 void SigninScreenHandler::HandleUpdateOfflineLogin(bool offline_login_active) { |
1297 offline_login_active_ = offline_login_active; | 1297 offline_login_active_ = offline_login_active; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 is_enrolling_consumer_management_ = false; | 1353 is_enrolling_consumer_management_ = false; |
1354 ShowImpl(); | 1354 ShowImpl(); |
1355 } | 1355 } |
1356 | 1356 |
1357 bool SigninScreenHandler::AllWhitelistedUsersPresent() { | 1357 bool SigninScreenHandler::AllWhitelistedUsersPresent() { |
1358 CrosSettings* cros_settings = CrosSettings::Get(); | 1358 CrosSettings* cros_settings = CrosSettings::Get(); |
1359 bool allow_new_user = false; | 1359 bool allow_new_user = false; |
1360 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 1360 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
1361 if (allow_new_user) | 1361 if (allow_new_user) |
1362 return false; | 1362 return false; |
1363 UserManager* user_manager = UserManager::Get(); | 1363 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
1364 const user_manager::UserList& users = user_manager->GetUsers(); | 1364 const user_manager::UserList& users = user_manager->GetUsers(); |
1365 if (!delegate_ || users.size() > kMaxUsers) { | 1365 if (!delegate_ || users.size() > kMaxUsers) { |
1366 return false; | 1366 return false; |
1367 } | 1367 } |
1368 const base::ListValue* whitelist = NULL; | 1368 const base::ListValue* whitelist = NULL; |
1369 if (!cros_settings->GetList(kAccountsPrefUsers, &whitelist) || !whitelist) | 1369 if (!cros_settings->GetList(kAccountsPrefUsers, &whitelist) || !whitelist) |
1370 return false; | 1370 return false; |
1371 for (size_t i = 0; i < whitelist->GetSize(); ++i) { | 1371 for (size_t i = 0; i < whitelist->GetSize(); ++i) { |
1372 std::string whitelisted_user; | 1372 std::string whitelisted_user; |
1373 // NB: Wildcards in the whitelist are also detected as not present here. | 1373 // NB: Wildcards in the whitelist are also detected as not present here. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 return gaia_screen_handler_->frame_error(); | 1472 return gaia_screen_handler_->frame_error(); |
1473 } | 1473 } |
1474 | 1474 |
1475 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1475 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
1476 caps_lock_enabled_ = enabled; | 1476 caps_lock_enabled_ = enabled; |
1477 if (page_is_ready()) | 1477 if (page_is_ready()) |
1478 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1478 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
1479 } | 1479 } |
1480 | 1480 |
1481 } // namespace chromeos | 1481 } // namespace chromeos |
OLD | NEW |