| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ | 5 #ifndef CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ |
| 6 #define CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ | 6 #define CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 NONE, | 23 NONE, |
| 24 COULD_NOT_MOUNT_CRYPTOHOME, | 24 COULD_NOT_MOUNT_CRYPTOHOME, |
| 25 COULD_NOT_MOUNT_TMPFS, | 25 COULD_NOT_MOUNT_TMPFS, |
| 26 COULD_NOT_UNMOUNT_CRYPTOHOME, | 26 COULD_NOT_UNMOUNT_CRYPTOHOME, |
| 27 DATA_REMOVAL_FAILED, // Could not destroy your old data | 27 DATA_REMOVAL_FAILED, // Could not destroy your old data |
| 28 LOGIN_TIMED_OUT, | 28 LOGIN_TIMED_OUT, |
| 29 UNLOCK_FAILED, | 29 UNLOCK_FAILED, |
| 30 NETWORK_AUTH_FAILED, // Could not authenticate against Google | 30 NETWORK_AUTH_FAILED, // Could not authenticate against Google |
| 31 OWNER_REQUIRED, // Only the device owner can log-in. | 31 OWNER_REQUIRED, // Only the device owner can log-in. |
| 32 WHITELIST_CHECK_FAILED, // Login attempt blocked by whitelist. This value | 32 WHITELIST_CHECK_FAILED, // Login attempt blocked by whitelist. This value |
| 33 // is | 33 // is synthesized by the ExistingUserController and |
| 34 // synthesized by the ExistingUserController and | |
| 35 // passed to the login_status_consumer_ in tests | 34 // passed to the login_status_consumer_ in tests |
| 36 // only. It is never generated or seen by any of the | 35 // only. It is never generated or seen by any of the |
| 37 // other authenticator classes. | 36 // other authenticator classes. |
| 38 TPM_ERROR, // Critical TPM error encountered. | 37 TPM_ERROR, // Critical TPM error encountered. |
| 39 USERNAME_HASH_FAILED, // Could not get username hash. | 38 USERNAME_HASH_FAILED, // Could not get username hash. |
| 40 NUM_FAILURE_REASONS, // This has to be the last item. | 39 FAILED_TO_INITIALIZE_TOKEN, // Could not get OAuth2 token. |
| 40 NUM_FAILURE_REASONS, // This has to be the last item. |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 explicit AuthFailure(FailureReason reason) | 43 explicit AuthFailure(FailureReason reason) |
| 44 : reason_(reason), error_(GoogleServiceAuthError::NONE) { | 44 : reason_(reason), error_(GoogleServiceAuthError::NONE) { |
| 45 DCHECK(reason != NETWORK_AUTH_FAILED); | 45 DCHECK(reason != NETWORK_AUTH_FAILED); |
| 46 } | 46 } |
| 47 | 47 |
| 48 inline bool operator==(const AuthFailure& b) const { | 48 inline bool operator==(const AuthFailure& b) const { |
| 49 if (reason_ != b.reason_) { | 49 if (reason_ != b.reason_) { |
| 50 return false; | 50 return false; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 78 return "Unlock failed."; | 78 return "Unlock failed."; |
| 79 case NETWORK_AUTH_FAILED: | 79 case NETWORK_AUTH_FAILED: |
| 80 if (error_.state() == GoogleServiceAuthError::CONNECTION_FAILED) { | 80 if (error_.state() == GoogleServiceAuthError::CONNECTION_FAILED) { |
| 81 return net::ErrorToString(error_.network_error()); | 81 return net::ErrorToString(error_.network_error()); |
| 82 } | 82 } |
| 83 return "Google authentication failed."; | 83 return "Google authentication failed."; |
| 84 case OWNER_REQUIRED: | 84 case OWNER_REQUIRED: |
| 85 return "Login is restricted to the owner's account only."; | 85 return "Login is restricted to the owner's account only."; |
| 86 case WHITELIST_CHECK_FAILED: | 86 case WHITELIST_CHECK_FAILED: |
| 87 return "Login attempt blocked by whitelist."; | 87 return "Login attempt blocked by whitelist."; |
| 88 case FAILED_TO_INITIALIZE_TOKEN: |
| 89 return "OAuth2 token fetch failed."; |
| 88 default: | 90 default: |
| 89 NOTREACHED(); | 91 NOTREACHED(); |
| 90 return std::string(); | 92 return std::string(); |
| 91 } | 93 } |
| 92 } | 94 } |
| 93 | 95 |
| 94 const GoogleServiceAuthError& error() const { return error_; } | 96 const GoogleServiceAuthError& error() const { return error_; } |
| 95 const FailureReason& reason() const { return reason_; } | 97 const FailureReason& reason() const { return reason_; } |
| 96 | 98 |
| 97 private: | 99 private: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 115 virtual void OnAuthSuccess(const UserContext& user_context) = 0; | 117 virtual void OnAuthSuccess(const UserContext& user_context) = 0; |
| 116 // The current guest login attempt has succeeded. | 118 // The current guest login attempt has succeeded. |
| 117 virtual void OnOffTheRecordAuthSuccess() {} | 119 virtual void OnOffTheRecordAuthSuccess() {} |
| 118 // The same password didn't work both online and offline. | 120 // The same password didn't work both online and offline. |
| 119 virtual void OnPasswordChangeDetected(); | 121 virtual void OnPasswordChangeDetected(); |
| 120 }; | 122 }; |
| 121 | 123 |
| 122 } // namespace chromeos | 124 } // namespace chromeos |
| 123 | 125 |
| 124 #endif // CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ | 126 #endif // CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ |
| OLD | NEW |