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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 return "OAuth2 token fetch failed."; | 88 return "OAuth2 token fetch failed."; |
89 default: | 89 default: |
90 NOTREACHED(); | 90 NOTREACHED(); |
91 return std::string(); | 91 return std::string(); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 const GoogleServiceAuthError& error() const { return error_; } | 95 const GoogleServiceAuthError& error() const { return error_; } |
96 const FailureReason& reason() const { return reason_; } | 96 const FailureReason& reason() const { return reason_; } |
97 | 97 |
98 void SetIsPinAttempt(bool tried_pin) { is_pin_attempt_ = tried_pin; } | |
jdufault
2016/08/08 18:54:26
set_used_pin(bool used_pin) { used_pin_ = used_pin
sammiequon
2016/08/09 00:31:25
Done.
| |
99 bool IsPinAttempt() const { return is_pin_attempt_; } | |
jdufault
2016/08/08 18:54:26
bool used_pin() const { return used_pin_; }
sammiequon
2016/08/09 00:31:25
Done.
| |
100 | |
98 private: | 101 private: |
99 AuthFailure(FailureReason reason, GoogleServiceAuthError error) | 102 AuthFailure(FailureReason reason, GoogleServiceAuthError error) |
100 : reason_(reason), error_(error) {} | 103 : reason_(reason), error_(error) {} |
101 | 104 |
105 bool is_pin_attempt_ = false; | |
jdufault
2016/08/08 18:54:26
Instead of plumbing through AuthStatusConsumer we
sammiequon
2016/08/09 00:31:25
Done.
| |
102 FailureReason reason_; | 106 FailureReason reason_; |
103 GoogleServiceAuthError error_; | 107 GoogleServiceAuthError error_; |
104 }; | 108 }; |
105 | 109 |
106 // An interface that defines the callbacks for objects that the | 110 // An interface that defines the callbacks for objects that the |
107 // Authenticator class will call to report the success/failure of | 111 // Authenticator class will call to report the success/failure of |
108 // authentication for Chromium OS. | 112 // authentication for Chromium OS. |
109 class CHROMEOS_EXPORT AuthStatusConsumer { | 113 class CHROMEOS_EXPORT AuthStatusConsumer { |
110 public: | 114 public: |
111 virtual ~AuthStatusConsumer() {} | 115 virtual ~AuthStatusConsumer() {} |
112 // The current login attempt has ended in failure, with error |error|. | 116 // The current login attempt has ended in failure, with error |error|. |
113 virtual void OnAuthFailure(const AuthFailure& error) = 0; | 117 virtual void OnAuthFailure(const AuthFailure& error) = 0; |
114 | 118 |
115 // The current login attempt has succeeded for |user_context|. | 119 // The current login attempt has succeeded for |user_context|. |
116 virtual void OnAuthSuccess(const UserContext& user_context) = 0; | 120 virtual void OnAuthSuccess(const UserContext& user_context) = 0; |
117 // The current guest login attempt has succeeded. | 121 // The current guest login attempt has succeeded. |
118 virtual void OnOffTheRecordAuthSuccess() {} | 122 virtual void OnOffTheRecordAuthSuccess() {} |
119 // The same password didn't work both online and offline. | 123 // The same password didn't work both online and offline. |
120 virtual void OnPasswordChangeDetected(); | 124 virtual void OnPasswordChangeDetected(); |
121 }; | 125 }; |
122 | 126 |
123 } // namespace chromeos | 127 } // namespace chromeos |
124 | 128 |
125 #endif // CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ | 129 #endif // CHROMEOS_LOGIN_AUTH_AUTH_STATUS_CONSUMER_H_ |
OLD | NEW |