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 // A GoogleServiceAuthError is immutable, plain old data representing an | 5 // A GoogleServiceAuthError is immutable, plain old data representing an |
6 // error from an attempt to authenticate with a Google service. | 6 // error from an attempt to authenticate with a Google service. |
7 // It could be from Google Accounts itself, or any service using Google | 7 // It could be from Google Accounts itself, or any service using Google |
8 // Accounts (e.g expired credentials). It may contain additional data such as | 8 // Accounts (e.g expired credentials). It may contain additional data such as |
9 // captcha or OTP challenges. | 9 // captcha or OTP challenges. |
10 | 10 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 // Construct a CAPTCHA_REQUIRED error with CAPTCHA challenge data from the | 139 // Construct a CAPTCHA_REQUIRED error with CAPTCHA challenge data from the |
140 // the ClientLogin endpoint. | 140 // the ClientLogin endpoint. |
141 // TODO(rogerta): once ClientLogin is no longer used, may be able to get | 141 // TODO(rogerta): once ClientLogin is no longer used, may be able to get |
142 // rid of this function. | 142 // rid of this function. |
143 static GoogleServiceAuthError FromClientLoginCaptchaChallenge( | 143 static GoogleServiceAuthError FromClientLoginCaptchaChallenge( |
144 const std::string& captcha_token, | 144 const std::string& captcha_token, |
145 const GURL& captcha_image_url, | 145 const GURL& captcha_image_url, |
146 const GURL& captcha_unlock_url); | 146 const GURL& captcha_unlock_url); |
147 | 147 |
148 // Construct a CAPTCHA_REQUIRED error with CAPTCHA challenge data from the | |
149 // ClientOAuth endpoint. | |
150 static GoogleServiceAuthError FromCaptchaChallenge( | |
151 const std::string& captcha_token, | |
152 const GURL& captcha_audio_url, | |
153 const GURL& captcha_image_url, | |
154 int image_width, | |
155 int image_height); | |
156 | |
157 // Construct a TWO_FACTOR error with second-factor challenge data. | |
158 static GoogleServiceAuthError FromSecondFactorChallenge( | |
159 const std::string& captcha_token, | |
160 const std::string& prompt_text, | |
161 const std::string& alternate_text, | |
162 int field_length); | |
163 | |
164 // Construct an INVALID_GAIA_CREDENTIALS error from a ClientOAuth response. | |
165 // |data| is the JSON response from the server explaning the error. | |
166 static GoogleServiceAuthError FromClientOAuthError(const std::string& data); | |
167 | |
168 // Provided for convenience for clients needing to reset an instance to NONE. | 148 // Provided for convenience for clients needing to reset an instance to NONE. |
169 // (avoids err_ = GoogleServiceAuthError(GoogleServiceAuthError::NONE), due | 149 // (avoids err_ = GoogleServiceAuthError(GoogleServiceAuthError::NONE), due |
170 // to explicit class and State enum relation. Note: shouldn't be inlined! | 150 // to explicit class and State enum relation. Note: shouldn't be inlined! |
171 static GoogleServiceAuthError AuthErrorNone(); | 151 static GoogleServiceAuthError AuthErrorNone(); |
172 | 152 |
173 // The error information. | 153 // The error information. |
174 State state() const; | 154 State state() const; |
175 const Captcha& captcha() const; | 155 const Captcha& captcha() const; |
176 const SecondFactor& second_factor() const; | 156 const SecondFactor& second_factor() const; |
177 int network_error() const; | 157 int network_error() const; |
(...skipping 25 matching lines...) Expand all Loading... |
203 int field_length); | 183 int field_length); |
204 | 184 |
205 State state_; | 185 State state_; |
206 Captcha captcha_; | 186 Captcha captcha_; |
207 SecondFactor second_factor_; | 187 SecondFactor second_factor_; |
208 int network_error_; | 188 int network_error_; |
209 std::string error_message_; | 189 std::string error_message_; |
210 }; | 190 }; |
211 | 191 |
212 #endif // GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ | 192 #endif // GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ |
OLD | NEW |