| 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 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/chromeos/boot_times_loader.h" | 28 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 29 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 29 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 30 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 30 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 31 #include "chrome/browser/chromeos/login/hwid_checker.h" | 31 #include "chrome/browser/chromeos/login/hwid_checker.h" |
| 32 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 32 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 33 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 33 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
| 34 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 34 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 35 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 35 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 36 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 36 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 37 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 37 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 38 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 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/extensions/api/screenlock_private/screenlock_private_ap
i.h" | 45 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.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/ui/webui/chromeos/login/authenticated_user_email_retrie
ver.h" | 48 #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" | 49 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" |
| 51 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" | 50 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 52 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" | 51 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" |
| 53 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 52 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
| 54 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 53 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 55 #include "chrome/common/pref_names.h" | 54 #include "chrome/common/pref_names.h" |
| 56 #include "chrome/common/url_constants.h" | 55 #include "chrome/common/url_constants.h" |
| 57 #include "chromeos/dbus/dbus_thread_manager.h" | 56 #include "chromeos/dbus/dbus_thread_manager.h" |
| 58 #include "chromeos/dbus/power_manager_client.h" | 57 #include "chromeos/dbus/power_manager_client.h" |
| 59 #include "chromeos/ime/ime_keyboard.h" | 58 #include "chromeos/ime/ime_keyboard.h" |
| 60 #include "chromeos/ime/input_method_descriptor.h" | 59 #include "chromeos/ime/input_method_descriptor.h" |
| 61 #include "chromeos/ime/input_method_manager.h" | 60 #include "chromeos/ime/input_method_manager.h" |
| 62 #include "chromeos/login/auth/key.h" | 61 #include "chromeos/login/auth/key.h" |
| 63 #include "chromeos/login/auth/user_context.h" | 62 #include "chromeos/login/auth/user_context.h" |
| 64 #include "chromeos/network/network_state.h" | 63 #include "chromeos/network/network_state.h" |
| 65 #include "chromeos/network/network_state_handler.h" | 64 #include "chromeos/network/network_state_handler.h" |
| 66 #include "chromeos/network/portal_detector/network_portal_detector.h" | 65 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 67 #include "components/user_manager/user.h" | 66 #include "components/user_manager/user.h" |
| 67 #include "components/user_manager/user_manager.h" |
| 68 #include "components/user_manager/user_type.h" | 68 #include "components/user_manager/user_type.h" |
| 69 #include "content/public/browser/render_frame_host.h" | 69 #include "content/public/browser/render_frame_host.h" |
| 70 #include "content/public/browser/web_contents.h" | 70 #include "content/public/browser/web_contents.h" |
| 71 #include "google_apis/gaia/gaia_auth_util.h" | 71 #include "google_apis/gaia/gaia_auth_util.h" |
| 72 #include "grit/chromium_strings.h" | 72 #include "grit/chromium_strings.h" |
| 73 #include "grit/generated_resources.h" | 73 #include "grit/generated_resources.h" |
| 74 #include "net/url_request/url_request_context_getter.h" | 74 #include "net/url_request/url_request_context_getter.h" |
| 75 #include "third_party/cros_system_api/dbus/service_constants.h" | 75 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 76 #include "ui/base/webui/web_ui_util.h" | 76 #include "ui/base/webui/web_ui_util.h" |
| 77 #include "ui/gfx/image/image.h" | 77 #include "ui/gfx/image/image.h" |
| (...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 "scale1x", | 936 "scale1x", |
| 937 webui::GetBitmapDataUrl(icon_skia.GetRepresentation(1.0f).sk_bitmap())); | 937 webui::GetBitmapDataUrl(icon_skia.GetRepresentation(1.0f).sk_bitmap())); |
| 938 icon_representations.SetString( | 938 icon_representations.SetString( |
| 939 "scale2x", | 939 "scale2x", |
| 940 webui::GetBitmapDataUrl(icon_skia.GetRepresentation(2.0f).sk_bitmap())); | 940 webui::GetBitmapDataUrl(icon_skia.GetRepresentation(2.0f).sk_bitmap())); |
| 941 CallJS("login.AccountPickerScreen.showUserPodCustomIcon", | 941 CallJS("login.AccountPickerScreen.showUserPodCustomIcon", |
| 942 username, icon_representations); | 942 username, icon_representations); |
| 943 | 943 |
| 944 // TODO(tengs): Move this code once we move unlocking to native code. | 944 // TODO(tengs): Move this code once we move unlocking to native code. |
| 945 if (ScreenLocker::default_screen_locker()) { | 945 if (ScreenLocker::default_screen_locker()) { |
| 946 UserManager* user_manager = UserManager::Get(); | 946 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 947 const user_manager::User* user = user_manager->FindUser(username); | 947 const user_manager::User* user = user_manager->FindUser(username); |
| 948 if (!user) | 948 if (!user) |
| 949 return; | 949 return; |
| 950 PrefService* profile_prefs = | 950 PrefService* profile_prefs = |
| 951 ProfileHelper::Get()->GetProfileByUser(user)->GetPrefs(); | 951 ProfileHelper::Get()->GetProfileByUser(user)->GetPrefs(); |
| 952 if (profile_prefs->GetBoolean(prefs::kEasyUnlockShowTutorial)) { | 952 if (profile_prefs->GetBoolean(prefs::kEasyUnlockShowTutorial)) { |
| 953 CallJS("login.AccountPickerScreen.showEasyUnlockBubble"); | 953 CallJS("login.AccountPickerScreen.showEasyUnlockBubble"); |
| 954 profile_prefs->SetBoolean(prefs::kEasyUnlockShowTutorial, false); | 954 profile_prefs->SetBoolean(prefs::kEasyUnlockShowTutorial, false); |
| 955 } | 955 } |
| 956 } | 956 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 bool SigninScreenHandler::ShouldLoadGaia() const { | 990 bool SigninScreenHandler::ShouldLoadGaia() const { |
| 991 // Fetching of the extension is not started before account picker page is | 991 // Fetching of the extension is not started before account picker page is |
| 992 // loaded because it can affect the loading speed. | 992 // loaded because it can affect the loading speed. |
| 993 // Do not load the extension for the screen locker, see crosbug.com/25018. | 993 // Do not load the extension for the screen locker, see crosbug.com/25018. |
| 994 return !ScreenLocker::default_screen_locker() && | 994 return !ScreenLocker::default_screen_locker() && |
| 995 is_account_picker_showing_first_time_; | 995 is_account_picker_showing_first_time_; |
| 996 } | 996 } |
| 997 | 997 |
| 998 // Update keyboard layout to least recently used by the user. | 998 // Update keyboard layout to least recently used by the user. |
| 999 void SigninScreenHandler::SetUserInputMethod(const std::string& username) { | 999 void SigninScreenHandler::SetUserInputMethod(const std::string& username) { |
| 1000 UserManager* user_manager = UserManager::Get(); | 1000 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 1001 if (user_manager->IsUserLoggedIn()) { | 1001 if (user_manager->IsUserLoggedIn()) { |
| 1002 // We are on sign-in screen inside user session (adding new user to | 1002 // We are on sign-in screen inside user session (adding new user to |
| 1003 // the session or on lock screen), don't switch input methods in this case. | 1003 // the session or on lock screen), don't switch input methods in this case. |
| 1004 // TODO(dpolukhin): adding user and sign-in should be consistent | 1004 // TODO(dpolukhin): adding user and sign-in should be consistent |
| 1005 // crbug.com/292774 | 1005 // crbug.com/292774 |
| 1006 return; | 1006 return; |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 chromeos::input_method::InputMethodManager* const manager = | 1009 chromeos::input_method::InputMethodManager* const manager = |
| 1010 chromeos::input_method::InputMethodManager::Get(); | 1010 chromeos::input_method::InputMethodManager::Get(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 delegate_->Login(context, SigninSpecifics()); | 1075 delegate_->Login(context, SigninSpecifics()); |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 void SigninScreenHandler::HandleLaunchIncognito() { | 1078 void SigninScreenHandler::HandleLaunchIncognito() { |
| 1079 UserContext context(user_manager::USER_TYPE_GUEST, std::string()); | 1079 UserContext context(user_manager::USER_TYPE_GUEST, std::string()); |
| 1080 if (delegate_) | 1080 if (delegate_) |
| 1081 delegate_->Login(context, SigninSpecifics()); | 1081 delegate_->Login(context, SigninSpecifics()); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() { | 1084 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() { |
| 1085 if (!UserManager::Get()->AreSupervisedUsersAllowed()) { | 1085 if (!user_manager::UserManager::Get()->AreSupervisedUsersAllowed()) { |
| 1086 LOG(ERROR) << "Managed users not allowed."; | 1086 LOG(ERROR) << "Managed users not allowed."; |
| 1087 return; | 1087 return; |
| 1088 } | 1088 } |
| 1089 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue()); | 1089 scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue()); |
| 1090 LoginDisplayHostImpl::default_host()-> | 1090 LoginDisplayHostImpl::default_host()-> |
| 1091 StartWizard(WizardController::kSupervisedUserCreationScreenName, | 1091 StartWizard(WizardController::kSupervisedUserCreationScreenName, |
| 1092 params.Pass()); | 1092 params.Pass()); |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 void SigninScreenHandler::HandleLaunchPublicSession( | 1095 void SigninScreenHandler::HandleLaunchPublicSession( |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 ui_state_ = UI_STATE_GAIA_SIGNIN; | 1300 ui_state_ = UI_STATE_GAIA_SIGNIN; |
| 1301 } else if (source == kSourceAccountPicker) { | 1301 } else if (source == kSourceAccountPicker) { |
| 1302 ui_state_ = UI_STATE_ACCOUNT_PICKER; | 1302 ui_state_ = UI_STATE_ACCOUNT_PICKER; |
| 1303 } else { | 1303 } else { |
| 1304 NOTREACHED(); | 1304 NOTREACHED(); |
| 1305 return; | 1305 return; |
| 1306 } | 1306 } |
| 1307 } | 1307 } |
| 1308 | 1308 |
| 1309 void SigninScreenHandler::HandleUnlockOnLoginSuccess() { | 1309 void SigninScreenHandler::HandleUnlockOnLoginSuccess() { |
| 1310 DCHECK(UserManager::Get()->IsUserLoggedIn()); | 1310 DCHECK(user_manager::UserManager::Get()->IsUserLoggedIn()); |
| 1311 if (ScreenLocker::default_screen_locker()) | 1311 if (ScreenLocker::default_screen_locker()) |
| 1312 ScreenLocker::default_screen_locker()->UnlockOnLoginSuccess(); | 1312 ScreenLocker::default_screen_locker()->UnlockOnLoginSuccess(); |
| 1313 } | 1313 } |
| 1314 | 1314 |
| 1315 void SigninScreenHandler::HandleShowLoadingTimeoutError() { | 1315 void SigninScreenHandler::HandleShowLoadingTimeoutError() { |
| 1316 UpdateState(ErrorScreenActor::ERROR_REASON_LOADING_TIMEOUT); | 1316 UpdateState(ErrorScreenActor::ERROR_REASON_LOADING_TIMEOUT); |
| 1317 } | 1317 } |
| 1318 | 1318 |
| 1319 void SigninScreenHandler::HandleUpdateOfflineLogin(bool offline_login_active) { | 1319 void SigninScreenHandler::HandleUpdateOfflineLogin(bool offline_login_active) { |
| 1320 offline_login_active_ = offline_login_active; | 1320 offline_login_active_ = offline_login_active; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 is_enrolling_consumer_management_ = false; | 1376 is_enrolling_consumer_management_ = false; |
| 1377 ShowImpl(); | 1377 ShowImpl(); |
| 1378 } | 1378 } |
| 1379 | 1379 |
| 1380 bool SigninScreenHandler::AllWhitelistedUsersPresent() { | 1380 bool SigninScreenHandler::AllWhitelistedUsersPresent() { |
| 1381 CrosSettings* cros_settings = CrosSettings::Get(); | 1381 CrosSettings* cros_settings = CrosSettings::Get(); |
| 1382 bool allow_new_user = false; | 1382 bool allow_new_user = false; |
| 1383 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 1383 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 1384 if (allow_new_user) | 1384 if (allow_new_user) |
| 1385 return false; | 1385 return false; |
| 1386 UserManager* user_manager = UserManager::Get(); | 1386 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 1387 const user_manager::UserList& users = user_manager->GetUsers(); | 1387 const user_manager::UserList& users = user_manager->GetUsers(); |
| 1388 if (!delegate_ || users.size() > kMaxUsers) { | 1388 if (!delegate_ || users.size() > kMaxUsers) { |
| 1389 return false; | 1389 return false; |
| 1390 } | 1390 } |
| 1391 const base::ListValue* whitelist = NULL; | 1391 const base::ListValue* whitelist = NULL; |
| 1392 if (!cros_settings->GetList(kAccountsPrefUsers, &whitelist) || !whitelist) | 1392 if (!cros_settings->GetList(kAccountsPrefUsers, &whitelist) || !whitelist) |
| 1393 return false; | 1393 return false; |
| 1394 for (size_t i = 0; i < whitelist->GetSize(); ++i) { | 1394 for (size_t i = 0; i < whitelist->GetSize(); ++i) { |
| 1395 std::string whitelisted_user; | 1395 std::string whitelisted_user; |
| 1396 // NB: Wildcards in the whitelist are also detected as not present here. | 1396 // 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... |
| 1495 return gaia_screen_handler_->frame_error(); | 1495 return gaia_screen_handler_->frame_error(); |
| 1496 } | 1496 } |
| 1497 | 1497 |
| 1498 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1498 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
| 1499 caps_lock_enabled_ = enabled; | 1499 caps_lock_enabled_ = enabled; |
| 1500 if (page_is_ready()) | 1500 if (page_is_ready()) |
| 1501 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1501 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
| 1502 } | 1502 } |
| 1503 | 1503 |
| 1504 } // namespace chromeos | 1504 } // namespace chromeos |
| OLD | NEW |