| 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" |
| 11 #include "chromeos/chromeos_export.h" | 11 #include "chromeos/chromeos_export.h" |
| 12 #include "google_apis/gaia/gaia_auth_consumer.h" | 12 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 13 #include "google_apis/gaia/google_service_auth_error.h" | 13 #include "google_apis/gaia/google_service_auth_error.h" |
| 14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 class UserContext; | 18 class UserContext; |
| 19 | 19 |
| 20 class CHROMEOS_EXPORT AuthFailure { | 20 class CHROMEOS_EXPORT AuthFailure { |
| 21 public: | 21 public: |
| 22 // Enum used for UMA. Do NOT reorder or remove entry. Don't forget to |
| 23 // update histograms.xml when adding new entries. |
| 22 enum FailureReason { | 24 enum FailureReason { |
| 23 NONE, | 25 NONE = 0, |
| 24 COULD_NOT_MOUNT_CRYPTOHOME, | 26 COULD_NOT_MOUNT_CRYPTOHOME = 1, |
| 25 COULD_NOT_MOUNT_TMPFS, | 27 COULD_NOT_MOUNT_TMPFS = 2, |
| 26 COULD_NOT_UNMOUNT_CRYPTOHOME, | 28 COULD_NOT_UNMOUNT_CRYPTOHOME = 3, |
| 27 DATA_REMOVAL_FAILED, // Could not destroy your old data | 29 DATA_REMOVAL_FAILED = 4, // Could not destroy your old data |
| 28 LOGIN_TIMED_OUT, | 30 LOGIN_TIMED_OUT = 5, |
| 29 UNLOCK_FAILED, | 31 UNLOCK_FAILED = 6, |
| 30 NETWORK_AUTH_FAILED, // Could not authenticate against Google | 32 NETWORK_AUTH_FAILED = 7, // Could not authenticate against Google |
| 31 OWNER_REQUIRED, // Only the device owner can log-in. | 33 OWNER_REQUIRED = 8, // Only the device owner can log-in. |
| 32 WHITELIST_CHECK_FAILED, // Login attempt blocked by whitelist. This | 34 WHITELIST_CHECK_FAILED = 9, // Login attempt blocked by whitelist. This |
| 33 // value is synthesized by the ExistingUserController and passed to the | 35 // value is synthesized by the ExistingUserController and passed to the |
| 34 // login_status_consumer_ in tests only. It is never generated or seen by | 36 // login_status_consumer_ in tests only. It is never generated or seen by |
| 35 // any of the other authenticator classes. | 37 // any of the other authenticator classes. |
| 36 TPM_ERROR, // Critical TPM error encountered. | 38 TPM_ERROR = 10, // Critical TPM error encountered. |
| 37 USERNAME_HASH_FAILED, // Could not get username hash. | 39 USERNAME_HASH_FAILED = 11, // Could not get username hash. |
| 38 FAILED_TO_INITIALIZE_TOKEN, // Could not get OAuth2 Token, | 40 FAILED_TO_INITIALIZE_TOKEN = 12, // Could not get OAuth2 Token, |
| 39 NUM_FAILURE_REASONS, // This has to be the last item. | 41 NUM_FAILURE_REASONS, // This has to be the last item. |
| 40 }; | 42 }; |
| 41 | 43 |
| 42 explicit AuthFailure(FailureReason reason) | 44 explicit AuthFailure(FailureReason reason) |
| 43 : reason_(reason), error_(GoogleServiceAuthError::NONE) { | 45 : reason_(reason), error_(GoogleServiceAuthError::NONE) { |
| 44 DCHECK(reason != NETWORK_AUTH_FAILED); | 46 DCHECK(reason != NETWORK_AUTH_FAILED); |
| 45 } | 47 } |
| 46 | 48 |
| 47 inline bool operator==(const AuthFailure& b) const { | 49 inline bool operator==(const AuthFailure& b) const { |
| 48 if (reason_ != b.reason_) { | 50 if (reason_ != b.reason_) { |
| 49 return false; | 51 return false; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 virtual void OnAuthSuccess(const UserContext& user_context) = 0; | 118 virtual void OnAuthSuccess(const UserContext& user_context) = 0; |
| 117 // The current guest login attempt has succeeded. | 119 // The current guest login attempt has succeeded. |
| 118 virtual void OnOffTheRecordAuthSuccess() {} | 120 virtual void OnOffTheRecordAuthSuccess() {} |
| 119 // The same password didn't work both online and offline. | 121 // The same password didn't work both online and offline. |
| 120 virtual void OnPasswordChangeDetected(); | 122 virtual void OnPasswordChangeDetected(); |
| 121 }; | 123 }; |
| 122 | 124 |
| 123 } // namespace chromeos | 125 } // namespace chromeos |
| 124 | 126 |
| 125 #endif // CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ | 127 #endif // CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ |
| OLD | NEW |