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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #include "chromeos/network/network_state.h" | 60 #include "chromeos/network/network_state.h" |
61 #include "chromeos/network/network_state_handler.h" | 61 #include "chromeos/network/network_state_handler.h" |
62 #include "content/public/browser/browser_thread.h" | 62 #include "content/public/browser/browser_thread.h" |
63 #include "content/public/browser/render_frame_host.h" | 63 #include "content/public/browser/render_frame_host.h" |
64 #include "content/public/browser/web_contents.h" | 64 #include "content/public/browser/web_contents.h" |
65 #include "google_apis/gaia/gaia_auth_util.h" | 65 #include "google_apis/gaia/gaia_auth_util.h" |
66 #include "grit/chromium_strings.h" | 66 #include "grit/chromium_strings.h" |
67 #include "grit/generated_resources.h" | 67 #include "grit/generated_resources.h" |
68 #include "net/url_request/url_request_context_getter.h" | 68 #include "net/url_request/url_request_context_getter.h" |
69 #include "third_party/cros_system_api/dbus/service_constants.h" | 69 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 70 #include "ui/base/webui/web_ui_util.h" |
70 | 71 |
71 #if defined(USE_AURA) | 72 #if defined(USE_AURA) |
72 #include "ash/shell.h" | 73 #include "ash/shell.h" |
73 #include "ash/wm/lock_state_controller.h" | 74 #include "ash/wm/lock_state_controller.h" |
74 #endif | 75 #endif |
75 | 76 |
76 using content::BrowserThread; | 77 using content::BrowserThread; |
77 | 78 |
78 namespace { | 79 namespace { |
79 | 80 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 chrome::NOTIFICATION_AUTH_CANCELLED, | 340 chrome::NOTIFICATION_AUTH_CANCELLED, |
340 content::NotificationService::AllSources()); | 341 content::NotificationService::AllSources()); |
341 } | 342 } |
342 | 343 |
343 SigninScreenHandler::~SigninScreenHandler() { | 344 SigninScreenHandler::~SigninScreenHandler() { |
344 ash::Shell::GetInstance()->RemovePreTargetHandler(this); | 345 ash::Shell::GetInstance()->RemovePreTargetHandler(this); |
345 weak_factory_.InvalidateWeakPtrs(); | 346 weak_factory_.InvalidateWeakPtrs(); |
346 if (delegate_) | 347 if (delegate_) |
347 delegate_->SetWebUIHandler(NULL); | 348 delegate_->SetWebUIHandler(NULL); |
348 network_state_informer_->RemoveObserver(this); | 349 network_state_informer_->RemoveObserver(this); |
| 350 ScreenlockBridge::Get()->SetLockHandler(NULL); |
349 } | 351 } |
350 | 352 |
351 void SigninScreenHandler::DeclareLocalizedValues( | 353 void SigninScreenHandler::DeclareLocalizedValues( |
352 LocalizedValuesBuilder* builder) { | 354 LocalizedValuesBuilder* builder) { |
353 builder->Add("passwordHint", IDS_LOGIN_POD_EMPTY_PASSWORD_TEXT); | 355 builder->Add("passwordHint", IDS_LOGIN_POD_EMPTY_PASSWORD_TEXT); |
354 builder->Add("podMenuButtonAccessibleName", | 356 builder->Add("podMenuButtonAccessibleName", |
355 IDS_LOGIN_POD_MENU_BUTTON_ACCESSIBLE_NAME); | 357 IDS_LOGIN_POD_MENU_BUTTON_ACCESSIBLE_NAME); |
356 builder->Add("podMenuRemoveItemAccessibleName", | 358 builder->Add("podMenuRemoveItemAccessibleName", |
357 IDS_LOGIN_POD_MENU_REMOVE_ITEM_ACCESSIBLE_NAME); | 359 IDS_LOGIN_POD_MENU_REMOVE_ITEM_ACCESSIBLE_NAME); |
358 builder->Add("passwordFieldAccessibleName", | 360 builder->Add("passwordFieldAccessibleName", |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 AddCallback("resyncUserData", &SigninScreenHandler::HandleResyncUserData); | 787 AddCallback("resyncUserData", &SigninScreenHandler::HandleResyncUserData); |
786 AddCallback("loginUIStateChanged", | 788 AddCallback("loginUIStateChanged", |
787 &SigninScreenHandler::HandleLoginUIStateChanged); | 789 &SigninScreenHandler::HandleLoginUIStateChanged); |
788 AddCallback("unlockOnLoginSuccess", | 790 AddCallback("unlockOnLoginSuccess", |
789 &SigninScreenHandler::HandleUnlockOnLoginSuccess); | 791 &SigninScreenHandler::HandleUnlockOnLoginSuccess); |
790 AddCallback("showLoadingTimeoutError", | 792 AddCallback("showLoadingTimeoutError", |
791 &SigninScreenHandler::HandleShowLoadingTimeoutError); | 793 &SigninScreenHandler::HandleShowLoadingTimeoutError); |
792 AddCallback("updateOfflineLogin", | 794 AddCallback("updateOfflineLogin", |
793 &SigninScreenHandler::HandleUpdateOfflineLogin); | 795 &SigninScreenHandler::HandleUpdateOfflineLogin); |
794 AddCallback("focusPod", &SigninScreenHandler::HandleFocusPod); | 796 AddCallback("focusPod", &SigninScreenHandler::HandleFocusPod); |
795 AddCallback("customButtonClicked", | |
796 &SigninScreenHandler::HandleCustomButtonClicked); | |
797 AddCallback("retrieveAuthenticatedUserEmail", | 797 AddCallback("retrieveAuthenticatedUserEmail", |
798 &SigninScreenHandler::HandleRetrieveAuthenticatedUserEmail); | 798 &SigninScreenHandler::HandleRetrieveAuthenticatedUserEmail); |
799 | 799 |
800 // This message is sent by the kiosk app menu, but is handled here | 800 // This message is sent by the kiosk app menu, but is handled here |
801 // so we can tell the delegate to launch the app. | 801 // so we can tell the delegate to launch the app. |
802 AddCallback("launchKioskApp", &SigninScreenHandler::HandleLaunchKioskApp); | 802 AddCallback("launchKioskApp", &SigninScreenHandler::HandleLaunchKioskApp); |
803 } | 803 } |
804 | 804 |
805 void SigninScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { | 805 void SigninScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { |
806 registry->RegisterDictionaryPref(prefs::kUsersLRUInputMethod); | 806 registry->RegisterDictionaryPref(prefs::kUsersLRUInputMethod); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 SendUserList(false); | 852 SendUserList(false); |
853 UpdateUIState(UI_STATE_ACCOUNT_PICKER, NULL); | 853 UpdateUIState(UI_STATE_ACCOUNT_PICKER, NULL); |
854 } | 854 } |
855 preferences_changed_delayed_ = false; | 855 preferences_changed_delayed_ = false; |
856 } | 856 } |
857 | 857 |
858 void SigninScreenHandler::ResetSigninScreenHandlerDelegate() { | 858 void SigninScreenHandler::ResetSigninScreenHandlerDelegate() { |
859 SetDelegate(NULL); | 859 SetDelegate(NULL); |
860 } | 860 } |
861 | 861 |
862 void SigninScreenHandler::ShowBannerMessage(const std::string& message) { | |
863 CallJS("login.AccountPickerScreen.showBannerMessage", message); | |
864 } | |
865 | |
866 void SigninScreenHandler::ShowUserPodButton( | |
867 const std::string& username, | |
868 const std::string& iconURL, | |
869 const base::Closure& click_callback) { | |
870 user_pod_button_callback_map_[username] = click_callback; | |
871 CallJS("login.AccountPickerScreen.showUserPodButton", username, iconURL); | |
872 | |
873 // TODO(tengs): Move this code once we move unlocking to native code. | |
874 if (ScreenLocker::default_screen_locker()) { | |
875 UserManager* user_manager = UserManager::Get(); | |
876 const User* user = user_manager->FindUser(username); | |
877 if (!user) | |
878 return; | |
879 PrefService* profile_prefs = | |
880 user_manager->GetProfileByUser(user)->GetPrefs(); | |
881 if (profile_prefs->GetBoolean(prefs::kEasyUnlockShowTutorial)) { | |
882 CallJS("login.AccountPickerScreen.showEasyUnlockBubble"); | |
883 profile_prefs->SetBoolean(prefs::kEasyUnlockShowTutorial, false); | |
884 } | |
885 } | |
886 } | |
887 | |
888 void SigninScreenHandler::HideUserPodButton(const std::string& username) { | |
889 CallJS("login.AccountPickerScreen.hideUserPodButton", username); | |
890 } | |
891 | |
892 void SigninScreenHandler::SetAuthType(const std::string& username, | |
893 LoginDisplay::AuthType auth_type, | |
894 const std::string& initial_value) { | |
895 user_auth_type_map_[username] = auth_type; | |
896 CallJS("login.AccountPickerScreen.setAuthType", | |
897 username, | |
898 static_cast<int>(auth_type), | |
899 base::StringValue(initial_value)); | |
900 } | |
901 | |
902 LoginDisplay::AuthType SigninScreenHandler::GetAuthType( | |
903 const std::string& username) const { | |
904 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) | |
905 return LoginDisplay::OFFLINE_PASSWORD; | |
906 return user_auth_type_map_.find(username)->second; | |
907 } | |
908 | |
909 void SigninScreenHandler::ShowError(int login_attempts, | 862 void SigninScreenHandler::ShowError(int login_attempts, |
910 const std::string& error_text, | 863 const std::string& error_text, |
911 const std::string& help_link_text, | 864 const std::string& help_link_text, |
912 HelpAppLauncher::HelpTopic help_topic_id) { | 865 HelpAppLauncher::HelpTopic help_topic_id) { |
913 core_oobe_actor_->ShowSignInError(login_attempts, error_text, help_link_text, | 866 core_oobe_actor_->ShowSignInError(login_attempts, error_text, help_link_text, |
914 help_topic_id); | 867 help_topic_id); |
915 } | 868 } |
916 | 869 |
917 void SigninScreenHandler::ShowErrorScreen(LoginDisplay::SigninError error_id) { | 870 void SigninScreenHandler::ShowErrorScreen(LoginDisplay::SigninError error_id) { |
918 switch (error_id) { | 871 switch (error_id) { |
(...skipping 13 matching lines...) Expand all Loading... |
932 void SigninScreenHandler::ShowControlBar(bool show) { | 885 void SigninScreenHandler::ShowControlBar(bool show) { |
933 core_oobe_actor_->ShowControlBar(show); | 886 core_oobe_actor_->ShowControlBar(show); |
934 } | 887 } |
935 | 888 |
936 void SigninScreenHandler::ShowGaiaPasswordChanged(const std::string& username) { | 889 void SigninScreenHandler::ShowGaiaPasswordChanged(const std::string& username) { |
937 email_ = username; | 890 email_ = username; |
938 password_changed_for_.insert(email_); | 891 password_changed_for_.insert(email_); |
939 core_oobe_actor_->ShowSignInUI(email_); | 892 core_oobe_actor_->ShowSignInUI(email_); |
940 CallJS("login.setAuthType", | 893 CallJS("login.setAuthType", |
941 username, | 894 username, |
942 static_cast<int>(LoginDisplay::ONLINE_SIGN_IN), | 895 static_cast<int>(ONLINE_SIGN_IN), |
943 base::StringValue("")); | 896 base::StringValue("")); |
944 } | 897 } |
945 | 898 |
946 void SigninScreenHandler::ShowPasswordChangedDialog(bool show_password_error) { | 899 void SigninScreenHandler::ShowPasswordChangedDialog(bool show_password_error) { |
947 core_oobe_actor_->ShowPasswordChangedScreen(show_password_error); | 900 core_oobe_actor_->ShowPasswordChangedScreen(show_password_error); |
948 } | 901 } |
949 | 902 |
950 void SigninScreenHandler::ShowSigninScreenForCreds( | 903 void SigninScreenHandler::ShowSigninScreenForCreds( |
951 const std::string& username, | 904 const std::string& username, |
952 const std::string& password) { | 905 const std::string& password) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 // Don't reload auth extension if proxy auth dialog was cancelled. | 953 // Don't reload auth extension if proxy auth dialog was cancelled. |
1001 has_pending_auth_ui_ = false; | 954 has_pending_auth_ui_ = false; |
1002 update_state_closure_.Cancel(); | 955 update_state_closure_.Cancel(); |
1003 break; | 956 break; |
1004 } | 957 } |
1005 default: | 958 default: |
1006 NOTREACHED() << "Unexpected notification " << type; | 959 NOTREACHED() << "Unexpected notification " << type; |
1007 } | 960 } |
1008 } | 961 } |
1009 | 962 |
| 963 void SigninScreenHandler::ShowBannerMessage(const std::string& message) { |
| 964 CallJS("login.AccountPickerScreen.showBannerMessage", message); |
| 965 } |
| 966 |
| 967 void SigninScreenHandler::ShowUserPodButton( |
| 968 const std::string& username, |
| 969 const gfx::Image& icon) { |
| 970 GURL icon_url(webui::GetBitmapDataUrl(icon.AsBitmap())); |
| 971 CallJS("login.AccountPickerScreen.showUserPodButton", |
| 972 username, icon_url.spec()); |
| 973 |
| 974 // TODO(tengs): Move this code once we move unlocking to native code. |
| 975 if (ScreenLocker::default_screen_locker()) { |
| 976 UserManager* user_manager = UserManager::Get(); |
| 977 const User* user = user_manager->FindUser(username); |
| 978 if (!user) |
| 979 return; |
| 980 PrefService* profile_prefs = |
| 981 user_manager->GetProfileByUser(user)->GetPrefs(); |
| 982 if (profile_prefs->GetBoolean(prefs::kEasyUnlockShowTutorial)) { |
| 983 CallJS("login.AccountPickerScreen.showEasyUnlockBubble"); |
| 984 profile_prefs->SetBoolean(prefs::kEasyUnlockShowTutorial, false); |
| 985 } |
| 986 } |
| 987 } |
| 988 |
| 989 void SigninScreenHandler::HideUserPodButton(const std::string& username) { |
| 990 CallJS("login.AccountPickerScreen.hideUserPodButton", username); |
| 991 } |
| 992 |
| 993 void SigninScreenHandler::EnableInput() { |
| 994 // Only for lock screen at the moment. |
| 995 ScreenLocker::default_screen_locker()->EnableInput(); |
| 996 } |
| 997 |
| 998 void SigninScreenHandler::SetAuthType( |
| 999 const std::string& username, |
| 1000 ScreenlockBridge::LockHandler::AuthType auth_type, |
| 1001 const std::string& initial_value) { |
| 1002 user_auth_type_map_[username] = auth_type; |
| 1003 CallJS("login.AccountPickerScreen.setAuthType", |
| 1004 username, |
| 1005 static_cast<int>(auth_type), |
| 1006 base::StringValue(initial_value)); |
| 1007 } |
| 1008 |
| 1009 ScreenlockBridge::LockHandler::AuthType SigninScreenHandler::GetAuthType( |
| 1010 const std::string& username) const { |
| 1011 if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) |
| 1012 return OFFLINE_PASSWORD; |
| 1013 return user_auth_type_map_.find(username)->second; |
| 1014 } |
| 1015 |
| 1016 void SigninScreenHandler::Unlock(const std::string& user_email) { |
| 1017 DCHECK(ScreenLocker::default_screen_locker()); |
| 1018 ScreenLocker::Hide(); |
| 1019 } |
| 1020 |
1010 void SigninScreenHandler::OnDnsCleared() { | 1021 void SigninScreenHandler::OnDnsCleared() { |
1011 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1022 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1012 dns_clear_task_running_ = false; | 1023 dns_clear_task_running_ = false; |
1013 dns_cleared_ = true; | 1024 dns_cleared_ = true; |
1014 ShowSigninScreenIfReady(); | 1025 ShowSigninScreenIfReady(); |
1015 } | 1026 } |
1016 | 1027 |
1017 // Update keyboard layout to least recently used by the user. | 1028 // Update keyboard layout to least recently used by the user. |
1018 void SigninScreenHandler::SetUserInputMethod(const std::string& username) { | 1029 void SigninScreenHandler::SetUserInputMethod(const std::string& username) { |
1019 UserManager* user_manager = UserManager::Get(); | 1030 UserManager* user_manager = UserManager::Get(); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 } | 1288 } |
1278 } | 1289 } |
1279 | 1290 |
1280 void SigninScreenHandler::HandleToggleKioskAutolaunchScreen() { | 1291 void SigninScreenHandler::HandleToggleKioskAutolaunchScreen() { |
1281 policy::BrowserPolicyConnectorChromeOS* connector = | 1292 policy::BrowserPolicyConnectorChromeOS* connector = |
1282 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 1293 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
1283 if (delegate_ && !connector->IsEnterpriseManaged()) | 1294 if (delegate_ && !connector->IsEnterpriseManaged()) |
1284 delegate_->ShowKioskAutolaunchScreen(); | 1295 delegate_->ShowKioskAutolaunchScreen(); |
1285 } | 1296 } |
1286 | 1297 |
1287 void SigninScreenHandler::FillUserDictionary(User* user, | 1298 void SigninScreenHandler::FillUserDictionary( |
1288 bool is_owner, | 1299 User* user, |
1289 bool is_signin_to_add, | 1300 bool is_owner, |
1290 LoginDisplay::AuthType auth_type, | 1301 bool is_signin_to_add, |
1291 base::DictionaryValue* user_dict) { | 1302 ScreenlockBridge::LockHandler::AuthType auth_type, |
| 1303 base::DictionaryValue* user_dict) { |
1292 const std::string& email = user->email(); | 1304 const std::string& email = user->email(); |
1293 const bool is_public_account = | 1305 const bool is_public_account = |
1294 user->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT; | 1306 user->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT; |
1295 const bool is_locally_managed_user = | 1307 const bool is_locally_managed_user = |
1296 user->GetType() == User::USER_TYPE_LOCALLY_MANAGED; | 1308 user->GetType() == User::USER_TYPE_LOCALLY_MANAGED; |
1297 | 1309 |
1298 user_dict->SetString(kKeyUsername, email); | 1310 user_dict->SetString(kKeyUsername, email); |
1299 user_dict->SetString(kKeyEmailAddress, user->display_email()); | 1311 user_dict->SetString(kKeyEmailAddress, user->display_email()); |
1300 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); | 1312 user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); |
1301 user_dict->SetBoolean(kKeyPublicAccount, is_public_account); | 1313 user_dict->SetBoolean(kKeyPublicAccount, is_public_account); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 BootTimesLoader::Get()->RecordCurrentStats("login-send-user-list"); | 1351 BootTimesLoader::Get()->RecordCurrentStats("login-send-user-list"); |
1340 | 1352 |
1341 base::ListValue users_list; | 1353 base::ListValue users_list; |
1342 const UserList& users = delegate_->GetUsers(); | 1354 const UserList& users = delegate_->GetUsers(); |
1343 | 1355 |
1344 // TODO(nkostylev): Move to a separate method in UserManager. | 1356 // TODO(nkostylev): Move to a separate method in UserManager. |
1345 // http://crbug.com/230852 | 1357 // http://crbug.com/230852 |
1346 bool is_signin_to_add = LoginDisplayHostImpl::default_host() && | 1358 bool is_signin_to_add = LoginDisplayHostImpl::default_host() && |
1347 UserManager::Get()->IsUserLoggedIn(); | 1359 UserManager::Get()->IsUserLoggedIn(); |
1348 | 1360 |
1349 user_pod_button_callback_map_.clear(); | |
1350 user_auth_type_map_.clear(); | 1361 user_auth_type_map_.clear(); |
1351 | 1362 |
1352 bool single_user = users.size() == 1; | 1363 bool single_user = users.size() == 1; |
1353 std::string owner; | 1364 std::string owner; |
1354 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); | 1365 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); |
1355 bool has_owner = owner.size() > 0; | 1366 bool has_owner = owner.size() > 0; |
1356 size_t max_non_owner_users = has_owner ? kMaxUsers - 1 : kMaxUsers; | 1367 size_t max_non_owner_users = has_owner ? kMaxUsers - 1 : kMaxUsers; |
1357 size_t non_owner_count = 0; | 1368 size_t non_owner_count = 0; |
1358 policy::BrowserPolicyConnectorChromeOS* connector = | 1369 policy::BrowserPolicyConnectorChromeOS* connector = |
1359 g_browser_process->platform_part()-> | 1370 g_browser_process->platform_part()-> |
1360 browser_policy_connector_chromeos(); | 1371 browser_policy_connector_chromeos(); |
1361 bool is_enterprise_managed = connector->IsEnterpriseManaged(); | 1372 bool is_enterprise_managed = connector->IsEnterpriseManaged(); |
1362 | 1373 |
1363 | 1374 |
1364 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 1375 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
1365 const std::string& email = (*it)->email(); | 1376 const std::string& email = (*it)->email(); |
1366 bool is_owner = (email == owner); | 1377 bool is_owner = (email == owner); |
1367 bool is_public_account = | 1378 bool is_public_account = |
1368 ((*it)->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT); | 1379 ((*it)->GetType() == User::USER_TYPE_PUBLIC_ACCOUNT); |
1369 | 1380 |
1370 if ((is_public_account && !is_signin_to_add) || | 1381 if ((is_public_account && !is_signin_to_add) || |
1371 is_owner || | 1382 is_owner || |
1372 (!is_public_account && non_owner_count < max_non_owner_users)) { | 1383 (!is_public_account && non_owner_count < max_non_owner_users)) { |
1373 LoginDisplay::AuthType initial_auth_type = | 1384 AuthType initial_auth_type = |
1374 ShouldForceOnlineSignIn(*it) ? LoginDisplay::ONLINE_SIGN_IN | 1385 ShouldForceOnlineSignIn(*it) ? ONLINE_SIGN_IN : OFFLINE_PASSWORD; |
1375 : LoginDisplay::OFFLINE_PASSWORD; | |
1376 user_auth_type_map_[email] = initial_auth_type; | 1386 user_auth_type_map_[email] = initial_auth_type; |
1377 | 1387 |
1378 base::DictionaryValue* user_dict = new base::DictionaryValue(); | 1388 base::DictionaryValue* user_dict = new base::DictionaryValue(); |
1379 FillUserDictionary( | 1389 FillUserDictionary( |
1380 *it, is_owner, is_signin_to_add, initial_auth_type, user_dict); | 1390 *it, is_owner, is_signin_to_add, initial_auth_type, user_dict); |
1381 bool signed_in = (*it)->is_logged_in(); | 1391 bool signed_in = (*it)->is_logged_in(); |
1382 // Single user check here is necessary because owner info might not be | 1392 // Single user check here is necessary because owner info might not be |
1383 // available when running into login screen on first boot. | 1393 // available when running into login screen on first boot. |
1384 // See http://crosbug.com/12723 | 1394 // See http://crosbug.com/12723 |
1385 bool can_remove_user = ((!single_user || is_enterprise_managed) && | 1395 bool can_remove_user = ((!single_user || is_enterprise_managed) && |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 PrefService* prefs = g_browser_process->local_state(); | 1427 PrefService* prefs = g_browser_process->local_state(); |
1418 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { | 1428 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { |
1419 if (core_oobe_actor_) | 1429 if (core_oobe_actor_) |
1420 core_oobe_actor_->ShowDeviceResetScreen(); | 1430 core_oobe_actor_->ShowDeviceResetScreen(); |
1421 return; | 1431 return; |
1422 } | 1432 } |
1423 | 1433 |
1424 is_account_picker_showing_first_time_ = true; | 1434 is_account_picker_showing_first_time_ = true; |
1425 MaybePreloadAuthExtension(); | 1435 MaybePreloadAuthExtension(); |
1426 | 1436 |
1427 if (ScreenLocker::default_screen_locker()) | 1437 if (ScreenLocker::default_screen_locker()) { |
1428 ScreenLocker::default_screen_locker()->delegate()->OnLockWebUIReady(); | 1438 ScreenLocker::default_screen_locker()->delegate()->OnLockWebUIReady(); |
| 1439 ScreenlockBridge::Get()->SetLockHandler(this); |
| 1440 } |
1429 | 1441 |
1430 if (delegate_) | 1442 if (delegate_) |
1431 delegate_->OnSigninScreenReady(); | 1443 delegate_->OnSigninScreenReady(); |
1432 } | 1444 } |
1433 | 1445 |
1434 void SigninScreenHandler::HandleWallpaperReady() { | 1446 void SigninScreenHandler::HandleWallpaperReady() { |
1435 if (ScreenLocker::default_screen_locker()) { | 1447 if (ScreenLocker::default_screen_locker()) { |
1436 ScreenLocker::default_screen_locker()->delegate()-> | 1448 ScreenLocker::default_screen_locker()->delegate()-> |
1437 OnLockBackgroundDisplayed(); | 1449 OnLockBackgroundDisplayed(); |
1438 } | 1450 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1564 | 1576 |
1565 void SigninScreenHandler::HandleUpdateOfflineLogin(bool offline_login_active) { | 1577 void SigninScreenHandler::HandleUpdateOfflineLogin(bool offline_login_active) { |
1566 offline_login_active_ = offline_login_active; | 1578 offline_login_active_ = offline_login_active; |
1567 } | 1579 } |
1568 | 1580 |
1569 void SigninScreenHandler::HandleFocusPod(const std::string& user_id) { | 1581 void SigninScreenHandler::HandleFocusPod(const std::string& user_id) { |
1570 SetUserInputMethod(user_id); | 1582 SetUserInputMethod(user_id); |
1571 WallpaperManager::Get()->SetUserWallpaperDelayed(user_id); | 1583 WallpaperManager::Get()->SetUserWallpaperDelayed(user_id); |
1572 } | 1584 } |
1573 | 1585 |
1574 void SigninScreenHandler::HandleCustomButtonClicked( | |
1575 const std::string& username) { | |
1576 if (user_pod_button_callback_map_.find(username) | |
1577 == user_pod_button_callback_map_.end()) { | |
1578 LOG(WARNING) << "User pod custom button clicked but no callback found"; | |
1579 return; | |
1580 } | |
1581 user_pod_button_callback_map_[username].Run(); | |
1582 } | |
1583 | |
1584 void SigninScreenHandler::HandleRetrieveAuthenticatedUserEmail( | 1586 void SigninScreenHandler::HandleRetrieveAuthenticatedUserEmail( |
1585 double attempt_token) { | 1587 double attempt_token) { |
1586 email_retriever_.reset(new AuthenticatedUserEmailRetriever( | 1588 email_retriever_.reset(new AuthenticatedUserEmailRetriever( |
1587 base::Bind(&SigninScreenHandler::CallJS<double, std::string>, | 1589 base::Bind(&SigninScreenHandler::CallJS<double, std::string>, |
1588 base::Unretained(this), | 1590 base::Unretained(this), |
1589 "login.GaiaSigninScreen.setAuthenticatedUserEmail", | 1591 "login.GaiaSigninScreen.setAuthenticatedUserEmail", |
1590 attempt_token), | 1592 attempt_token), |
1591 Profile::FromWebUI(web_ui())->GetRequestContext())); | 1593 Profile::FromWebUI(web_ui())->GetRequestContext())); |
1592 } | 1594 } |
1593 | 1595 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 DCHECK(gaia_screen_handler_); | 1787 DCHECK(gaia_screen_handler_); |
1786 return gaia_screen_handler_->frame_state(); | 1788 return gaia_screen_handler_->frame_state(); |
1787 } | 1789 } |
1788 | 1790 |
1789 net::Error SigninScreenHandler::FrameError() const { | 1791 net::Error SigninScreenHandler::FrameError() const { |
1790 DCHECK(gaia_screen_handler_); | 1792 DCHECK(gaia_screen_handler_); |
1791 return gaia_screen_handler_->frame_error(); | 1793 return gaia_screen_handler_->frame_error(); |
1792 } | 1794 } |
1793 | 1795 |
1794 } // namespace chromeos | 1796 } // namespace chromeos |
OLD | NEW |