| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/login/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 ExistingUserController::ExistingUserController(LoginDisplayHost* host) | 124 ExistingUserController::ExistingUserController(LoginDisplayHost* host) |
| 125 : login_status_consumer_(NULL), | 125 : login_status_consumer_(NULL), |
| 126 host_(host), | 126 host_(host), |
| 127 login_display_(host_->CreateLoginDisplay(this)), | 127 login_display_(host_->CreateLoginDisplay(this)), |
| 128 num_login_attempts_(0), | 128 num_login_attempts_(0), |
| 129 cros_settings_(CrosSettings::Get()), | 129 cros_settings_(CrosSettings::Get()), |
| 130 weak_factory_(this), | 130 weak_factory_(this), |
| 131 offline_failed_(false), | 131 offline_failed_(false), |
| 132 is_login_in_progress_(false), | 132 is_login_in_progress_(false), |
| 133 password_changed_(false), | 133 password_changed_(false), |
| 134 auth_mode_(LoginPerformer::AUTH_MODE_EXTENSION), |
| 134 do_auto_enrollment_(false), | 135 do_auto_enrollment_(false), |
| 135 signin_screen_ready_(false), | 136 signin_screen_ready_(false), |
| 136 network_state_helper_(new login::NetworkStateHelper) { | 137 network_state_helper_(new login::NetworkStateHelper) { |
| 137 DCHECK(current_controller_ == NULL); | 138 DCHECK(current_controller_ == NULL); |
| 138 current_controller_ = this; | 139 current_controller_ = this; |
| 139 | 140 |
| 140 registrar_.Add(this, | 141 registrar_.Add(this, |
| 141 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, | 142 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, |
| 142 content::NotificationService::AllSources()); | 143 content::NotificationService::AllSources()); |
| 143 registrar_.Add(this, | 144 registrar_.Add(this, |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 | 748 |
| 748 // Clear the recorded displayed email so it won't affect any future attempts. | 749 // Clear the recorded displayed email so it won't affect any future attempts. |
| 749 display_email_.clear(); | 750 display_email_.clear(); |
| 750 } | 751 } |
| 751 | 752 |
| 752 void ExistingUserController::OnLoginSuccess(const UserContext& user_context) { | 753 void ExistingUserController::OnLoginSuccess(const UserContext& user_context) { |
| 753 is_login_in_progress_ = false; | 754 is_login_in_progress_ = false; |
| 754 offline_failed_ = false; | 755 offline_failed_ = false; |
| 755 login_display_->set_signin_completed(true); | 756 login_display_->set_signin_completed(true); |
| 756 | 757 |
| 758 // Login performer will be gone so cache this value to use |
| 759 // once profile is loaded. |
| 760 password_changed_ = login_performer_->password_changed(); |
| 761 auth_mode_ = login_performer_->auth_mode(); |
| 762 |
| 757 UserManager::Get()->GetUserFlow(user_context.GetUserID())-> | 763 UserManager::Get()->GetUserFlow(user_context.GetUserID())-> |
| 758 HandleLoginSuccess(user_context); | 764 HandleLoginSuccess(user_context); |
| 759 | 765 |
| 760 StopPublicSessionAutoLoginTimer(); | 766 StopPublicSessionAutoLoginTimer(); |
| 761 | 767 |
| 762 const bool has_cookies = | 768 const bool has_cookies = auth_mode_ == LoginPerformer::AUTH_MODE_EXTENSION && |
| 763 login_performer_->auth_mode() == LoginPerformer::AUTH_MODE_EXTENSION && | 769 user_context.GetAuthCode().empty(); |
| 764 user_context.GetAuthCode().empty(); | |
| 765 | |
| 766 // Login performer will be gone so cache this value to use | |
| 767 // once profile is loaded. | |
| 768 password_changed_ = login_performer_->password_changed(); | |
| 769 | 770 |
| 770 // LoginPerformer instance will delete itself once online auth result is OK. | 771 // LoginPerformer instance will delete itself once online auth result is OK. |
| 771 // In case of failure it'll bring up ScreenLock and ask for | 772 // In case of failure it'll bring up ScreenLock and ask for |
| 772 // correct password/display error message. | 773 // correct password/display error message. |
| 773 // Even in case when following online,offline protocol and returning | 774 // Even in case when following online,offline protocol and returning |
| 774 // requests_pending = false, let LoginPerformer delete itself. | 775 // requests_pending = false, let LoginPerformer delete itself. |
| 775 login_performer_->set_delegate(NULL); | 776 login_performer_->set_delegate(NULL); |
| 776 ignore_result(login_performer_.release()); | 777 ignore_result(login_performer_.release()); |
| 777 | 778 |
| 778 // Update user's displayed email. | 779 // Update user's displayed email. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 ConfigurePublicSessionAutoLogin(); | 933 ConfigurePublicSessionAutoLogin(); |
| 933 return; | 934 return; |
| 934 } | 935 } |
| 935 } | 936 } |
| 936 | 937 |
| 937 void ExistingUserController::ActivateWizard(const std::string& screen_name) { | 938 void ExistingUserController::ActivateWizard(const std::string& screen_name) { |
| 938 scoped_ptr<base::DictionaryValue> params; | 939 scoped_ptr<base::DictionaryValue> params; |
| 939 host_->StartWizard(screen_name, params.Pass()); | 940 host_->StartWizard(screen_name, params.Pass()); |
| 940 } | 941 } |
| 941 | 942 |
| 943 LoginPerformer::AuthorizationMode ExistingUserController::auth_mode() const { |
| 944 if (login_performer_) |
| 945 return login_performer_->auth_mode(); |
| 946 |
| 947 return auth_mode_; |
| 948 } |
| 949 |
| 950 bool ExistingUserController::password_changed() const { |
| 951 if (login_performer_) |
| 952 return login_performer_->password_changed(); |
| 953 |
| 954 return password_changed_; |
| 955 } |
| 956 |
| 942 void ExistingUserController::ConfigurePublicSessionAutoLogin() { | 957 void ExistingUserController::ConfigurePublicSessionAutoLogin() { |
| 943 std::string auto_login_account_id; | 958 std::string auto_login_account_id; |
| 944 cros_settings_->GetString(kAccountsPrefDeviceLocalAccountAutoLoginId, | 959 cros_settings_->GetString(kAccountsPrefDeviceLocalAccountAutoLoginId, |
| 945 &auto_login_account_id); | 960 &auto_login_account_id); |
| 946 const std::vector<policy::DeviceLocalAccount> device_local_accounts = | 961 const std::vector<policy::DeviceLocalAccount> device_local_accounts = |
| 947 policy::GetDeviceLocalAccounts(cros_settings_); | 962 policy::GetDeviceLocalAccounts(cros_settings_); |
| 948 | 963 |
| 949 public_session_auto_login_username_.clear(); | 964 public_session_auto_login_username_.clear(); |
| 950 for (std::vector<policy::DeviceLocalAccount>::const_iterator | 965 for (std::vector<policy::DeviceLocalAccount>::const_iterator |
| 951 it = device_local_accounts.begin(); | 966 it = device_local_accounts.begin(); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 } | 1132 } |
| 1118 | 1133 |
| 1119 void ExistingUserController::SendAccessibilityAlert( | 1134 void ExistingUserController::SendAccessibilityAlert( |
| 1120 const std::string& alert_text) { | 1135 const std::string& alert_text) { |
| 1121 AccessibilityAlertInfo event(ProfileHelper::GetSigninProfile(), alert_text); | 1136 AccessibilityAlertInfo event(ProfileHelper::GetSigninProfile(), alert_text); |
| 1122 SendControlAccessibilityNotification( | 1137 SendControlAccessibilityNotification( |
| 1123 ui::AX_EVENT_VALUE_CHANGED, &event); | 1138 ui::AX_EVENT_VALUE_CHANGED, &event); |
| 1124 } | 1139 } |
| 1125 | 1140 |
| 1126 } // namespace chromeos | 1141 } // namespace chromeos |
| OLD | NEW |