| 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_AUTH_ATTEMPT_STATE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ATTEMPT_STATE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ATTEMPT_STATE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ATTEMPT_STATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 10 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
| 11 #include "chrome/browser/chromeos/login/user.h" | 11 #include "chrome/browser/chromeos/login/user.h" |
| 12 #include "google_apis/gaia/gaia_auth_consumer.h" | 12 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 13 #include "google_apis/gaia/gaia_auth_fetcher.h" | 13 #include "google_apis/gaia/gaia_auth_fetcher.h" |
| 14 #include "third_party/cros_system_api/dbus/service_constants.h" | 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 // Tracks the state associated with a single attempt to log in to chromium os. | 18 // Tracks the state associated with a single attempt to log in to chromium os. |
| 19 // Enforces that methods are only called on the IO thread. | 19 // Enforces that methods are only called on the IO thread. |
| 20 | 20 |
| 21 class AuthAttemptState { | 21 class AuthAttemptState { |
| 22 public: | 22 public: |
| 23 // Used to initialize for a login attempt. | 23 // Used to initialize for a login attempt. |
| 24 AuthAttemptState(const std::string& username, | 24 AuthAttemptState(const UserCredentials& credentials, |
| 25 const std::string& password, | |
| 26 const std::string& ascii_hash, | 25 const std::string& ascii_hash, |
| 27 const std::string& login_token, | 26 const std::string& login_token, |
| 28 const std::string& login_captcha, | 27 const std::string& login_captcha, |
| 29 const User::UserType user_type, | 28 const User::UserType user_type, |
| 30 const bool user_is_new); | 29 const bool user_is_new); |
| 31 | 30 |
| 32 // Used to initialize for a externally authenticated login. | 31 // Used to initialize for a externally authenticated login. |
| 33 AuthAttemptState(const std::string& username, | 32 AuthAttemptState(const UserCredentials& credentials, |
| 34 const std::string& password, | |
| 35 const std::string& ascii_hash, | 33 const std::string& ascii_hash, |
| 36 const bool user_is_new); | 34 const bool user_is_new); |
| 37 | 35 |
| 38 // Used to initialize for a screen unlock attempt. | 36 // Used to initialize for a screen unlock attempt. |
| 39 AuthAttemptState(const std::string& username, const std::string& ascii_hash); | 37 AuthAttemptState(const std::string& username, const std::string& ascii_hash); |
| 40 | 38 |
| 41 virtual ~AuthAttemptState(); | 39 virtual ~AuthAttemptState(); |
| 42 | 40 |
| 43 // Copy |credentials| and copy |outcome| into this object, so we can have | 41 // Copy |credentials| and copy |outcome| into this object, so we can have |
| 44 // a copy we're sure to own, and can make available on the IO thread. | 42 // a copy we're sure to own, and can make available on the IO thread. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 63 virtual const LoginFailure& online_outcome(); | 61 virtual const LoginFailure& online_outcome(); |
| 64 virtual bool is_first_time_user(); | 62 virtual bool is_first_time_user(); |
| 65 virtual GaiaAuthFetcher::HostedAccountsSetting hosted_policy(); | 63 virtual GaiaAuthFetcher::HostedAccountsSetting hosted_policy(); |
| 66 | 64 |
| 67 virtual bool cryptohome_complete(); | 65 virtual bool cryptohome_complete(); |
| 68 virtual bool cryptohome_outcome(); | 66 virtual bool cryptohome_outcome(); |
| 69 virtual cryptohome::MountError cryptohome_code(); | 67 virtual cryptohome::MountError cryptohome_code(); |
| 70 | 68 |
| 71 // Saved so we can retry client login, and also so we know for whom login | 69 // Saved so we can retry client login, and also so we know for whom login |
| 72 // has succeeded, in the event of successful completion. | 70 // has succeeded, in the event of successful completion. |
| 73 const std::string username; | 71 const UserCredentials credentials; |
| 74 | 72 |
| 75 // These fields are saved so we can retry client login. | 73 // These fields are saved so we can retry client login. |
| 76 const std::string password; | |
| 77 const std::string ascii_hash; | 74 const std::string ascii_hash; |
| 78 const std::string login_token; | 75 const std::string login_token; |
| 79 const std::string login_captcha; | 76 const std::string login_captcha; |
| 80 | 77 |
| 81 // The type of the user attempting to log in. | 78 // The type of the user attempting to log in. |
| 82 const User::UserType user_type; | 79 const User::UserType user_type; |
| 83 | 80 |
| 84 const bool unlock; // True if authenticating to unlock the computer. | 81 const bool unlock; // True if authenticating to unlock the computer. |
| 85 | 82 |
| 86 protected: | 83 protected: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 98 bool cryptohome_outcome_; | 95 bool cryptohome_outcome_; |
| 99 cryptohome::MountError cryptohome_code_; | 96 cryptohome::MountError cryptohome_code_; |
| 100 | 97 |
| 101 private: | 98 private: |
| 102 DISALLOW_COPY_AND_ASSIGN(AuthAttemptState); | 99 DISALLOW_COPY_AND_ASSIGN(AuthAttemptState); |
| 103 }; | 100 }; |
| 104 | 101 |
| 105 } // namespace chromeos | 102 } // namespace chromeos |
| 106 | 103 |
| 107 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ATTEMPT_STATE_H_ | 104 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_ATTEMPT_STATE_H_ |
| OLD | NEW |