| 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/string16.h" | 15 #include "base/string16.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "base/timer.h" | 17 #include "base/timer.h" |
| 18 #include "chrome/browser/chromeos/login/login_display.h" | 18 #include "chrome/browser/chromeos/login/login_display.h" |
| 19 #include "chrome/browser/chromeos/login/login_performer.h" | 19 #include "chrome/browser/chromeos/login/login_performer.h" |
| 20 #include "chrome/browser/chromeos/login/login_utils.h" | 20 #include "chrome/browser/chromeos/login/login_utils.h" |
| 21 #include "chrome/browser/chromeos/login/password_changed_view.h" | 21 #include "chrome/browser/chromeos/login/password_changed_view.h" |
| 22 #include "chrome/browser/chromeos/login/user.h" | 22 #include "chrome/browser/chromeos/login/user.h" |
| 23 #include "chrome/browser/chromeos/settings/ownership_service.h" | 23 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 24 #include "content/public/browser/notification_observer.h" | 24 #include "content/public/browser/notification_observer.h" |
| 25 #include "content/public/browser/notification_registrar.h" | 25 #include "content/public/browser/notification_registrar.h" |
| 26 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
| 27 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
| 28 | 28 |
| 29 namespace chromeos { | 29 namespace chromeos { |
| 30 | 30 |
| 31 class CrosSettings; |
| 31 class LoginDisplayHost; | 32 class LoginDisplayHost; |
| 32 class CrosSettings; | |
| 33 | 33 |
| 34 // ExistingUserController is used to handle login when someone has | 34 // ExistingUserController is used to handle login when someone has |
| 35 // already logged into the machine. | 35 // already logged into the machine. |
| 36 // To use ExistingUserController create an instance of it and invoke Init. | 36 // To use ExistingUserController create an instance of it and invoke Init. |
| 37 // When Init is called it creates LoginDisplay instance which encapsulates | 37 // When Init is called it creates LoginDisplay instance which encapsulates |
| 38 // all login UI implementation. | 38 // all login UI implementation. |
| 39 // ExistingUserController maintains it's own life cycle and deletes itself when | 39 // ExistingUserController maintains it's own life cycle and deletes itself when |
| 40 // the user logs in (or chooses to see other settings). | 40 // the user logs in (or chooses to see other settings). |
| 41 class ExistingUserController : public LoginDisplay::Delegate, | 41 class ExistingUserController : public LoginDisplay::Delegate, |
| 42 public content::NotificationObserver, | 42 public content::NotificationObserver, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Show error message. |error_id| error message ID in resources. | 142 // Show error message. |error_id| error message ID in resources. |
| 143 // If |details| string is not empty, it specify additional error text | 143 // If |details| string is not empty, it specify additional error text |
| 144 // provided by authenticator, it is not localized. | 144 // provided by authenticator, it is not localized. |
| 145 void ShowError(int error_id, const std::string& details); | 145 void ShowError(int error_id, const std::string& details); |
| 146 | 146 |
| 147 // Shows Gaia page because password change was detected. | 147 // Shows Gaia page because password change was detected. |
| 148 void ShowGaiaPasswordChanged(const std::string& username); | 148 void ShowGaiaPasswordChanged(const std::string& username); |
| 149 | 149 |
| 150 // Handles result of ownership check and starts enterprise enrollment if | 150 // Handles result of ownership check and starts enterprise enrollment if |
| 151 // applicable. | 151 // applicable. |
| 152 void OnEnrollmentOwnershipCheckCompleted(OwnershipService::Status status, | 152 void OnEnrollmentOwnershipCheckCompleted( |
| 153 bool current_user_is_owner); | 153 DeviceSettingsService::OwnershipStatus status, |
| 154 bool current_user_is_owner); |
| 154 | 155 |
| 155 // Enters the enterprise enrollment screen. |forced| is true if this is the | 156 // Enters the enterprise enrollment screen. |forced| is true if this is the |
| 156 // result of an auto-enrollment check, and the user shouldn't be able to | 157 // result of an auto-enrollment check, and the user shouldn't be able to |
| 157 // easily cancel the enrollment. In that case, |user| is the user name that | 158 // easily cancel the enrollment. In that case, |user| is the user name that |
| 158 // first logged in. | 159 // first logged in. |
| 159 void ShowEnrollmentScreen(bool forced, const std::string& user); | 160 void ShowEnrollmentScreen(bool forced, const std::string& user); |
| 160 | 161 |
| 161 // Invoked to complete login. Login might be suspended if auto-enrollment | 162 // Invoked to complete login. Login might be suspended if auto-enrollment |
| 162 // has to be performed, and will resume once auto-enrollment completes. | 163 // has to be performed, and will resume once auto-enrollment completes. |
| 163 void CompleteLoginInternal(std::string username, std::string password); | 164 void CompleteLoginInternal(std::string username, std::string password); |
| 164 | 165 |
| 166 // Creates |login_performer_| if necessary and calls login() on it. |
| 167 void PerformLogin(const std::string& username, |
| 168 const std::string& password, |
| 169 LoginPerformer::AuthorizationMode auth_mode, |
| 170 DeviceSettingsService::OwnershipStatus ownership_status, |
| 171 bool is_owner); |
| 172 |
| 165 void set_login_performer_delegate(LoginPerformer::Delegate* d) { | 173 void set_login_performer_delegate(LoginPerformer::Delegate* d) { |
| 166 login_performer_delegate_.reset(d); | 174 login_performer_delegate_.reset(d); |
| 167 } | 175 } |
| 168 | 176 |
| 169 // Updates the |login_display_| attached to this controller. | 177 // Updates the |login_display_| attached to this controller. |
| 170 void UpdateLoginDisplay(const UserList& users); | 178 void UpdateLoginDisplay(const UserList& users); |
| 171 | 179 |
| 172 // Used to execute login operations. | 180 // Used to execute login operations. |
| 173 scoped_ptr<LoginPerformer> login_performer_; | 181 scoped_ptr<LoginPerformer> login_performer_; |
| 174 | 182 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 base::Time time_init_; | 254 base::Time time_init_; |
| 247 | 255 |
| 248 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, ExistingUserLogin); | 256 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, ExistingUserLogin); |
| 249 | 257 |
| 250 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); | 258 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); |
| 251 }; | 259 }; |
| 252 | 260 |
| 253 } // namespace chromeos | 261 } // namespace chromeos |
| 254 | 262 |
| 255 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 263 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
| OLD | NEW |