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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 const FailureReason& reason() const { return reason_; } | 98 const FailureReason& reason() const { return reason_; } |
99 | 99 |
100 private: | 100 private: |
101 AuthFailure(FailureReason reason, GoogleServiceAuthError error) | 101 AuthFailure(FailureReason reason, GoogleServiceAuthError error) |
102 : reason_(reason), error_(error) {} | 102 : reason_(reason), error_(error) {} |
103 | 103 |
104 FailureReason reason_; | 104 FailureReason reason_; |
105 GoogleServiceAuthError error_; | 105 GoogleServiceAuthError error_; |
106 }; | 106 }; |
107 | 107 |
| 108 // Enum used for UMA. Do NOT reorder or remove entry. Don't forget to |
| 109 // update histograms.xml when adding new entries. |
| 110 enum SuccessReason { |
| 111 OFFLINE_AND_ONLINE = 0, |
| 112 OFFLINE_ONLY = 1, |
| 113 NUM_SUCCESS_REASONS, // This has to be the last item. |
| 114 }; |
| 115 |
108 // An interface that defines the callbacks for objects that the | 116 // An interface that defines the callbacks for objects that the |
109 // Authenticator class will call to report the success/failure of | 117 // Authenticator class will call to report the success/failure of |
110 // authentication for Chromium OS. | 118 // authentication for Chromium OS. |
111 class CHROMEOS_EXPORT AuthStatusConsumer { | 119 class CHROMEOS_EXPORT AuthStatusConsumer { |
112 public: | 120 public: |
113 virtual ~AuthStatusConsumer() {} | 121 virtual ~AuthStatusConsumer() {} |
114 // The current login attempt has ended in failure, with error |error|. | 122 // The current login attempt has ended in failure, with error |error|. |
115 virtual void OnAuthFailure(const AuthFailure& error) = 0; | 123 virtual void OnAuthFailure(const AuthFailure& error) = 0; |
116 | 124 |
117 // The current login attempt has succeeded for |user_context|. | 125 // The current login attempt has succeeded for |user_context|. |
118 virtual void OnAuthSuccess(const UserContext& user_context) = 0; | 126 virtual void OnAuthSuccess(const UserContext& user_context) = 0; |
119 // The current guest login attempt has succeeded. | 127 // The current guest login attempt has succeeded. |
120 virtual void OnOffTheRecordAuthSuccess() {} | 128 virtual void OnOffTheRecordAuthSuccess() {} |
121 // The same password didn't work both online and offline. | 129 // The same password didn't work both online and offline. |
122 virtual void OnPasswordChangeDetected(); | 130 virtual void OnPasswordChangeDetected(); |
123 // The cryptohome is encrypted in old format and needs migration. | 131 // The cryptohome is encrypted in old format and needs migration. |
124 virtual void OnOldEncryptionDetected(const UserContext& user_context, | 132 virtual void OnOldEncryptionDetected(const UserContext& user_context, |
125 bool has_incomplete_migration); | 133 bool has_incomplete_migration); |
126 }; | 134 }; |
127 | 135 |
128 } // namespace chromeos | 136 } // namespace chromeos |
129 | 137 |
130 #endif // CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ | 138 #endif // CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ |
OLD | NEW |