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 |
11 // A GoogleServiceAuthError without additional data is just a State, defined | 11 // A GoogleServiceAuthError without additional data is just a State, defined |
12 // below. A case could be made to have this relation implicit, to allow raising | 12 // below. A case could be made to have this relation implicit, to allow raising |
13 // error events concisely by doing OnAuthError(GoogleServiceAuthError::NONE), | 13 // error events concisely by doing OnAuthError(GoogleServiceAuthError::NONE), |
14 // for example. But the truth is this class is ever so slightly more than a | 14 // for example. But the truth is this class is ever so slightly more than a |
15 // transparent wrapper around 'State' due to additional Captcha data | 15 // transparent wrapper around 'State' due to additional Captcha data |
16 // (e.g consider operator=), and this would violate the style guide. Thus, | 16 // (e.g consider operator=), and this would violate the style guide. Thus, |
17 // you must explicitly use the constructor when all you have is a State. | 17 // you must explicitly use the constructor when all you have is a State. |
18 // The good news is the implementation nests the enum inside a class, so you | 18 // The good news is the implementation nests the enum inside a class, so you |
19 // may forward declare and typedef GoogleServiceAuthError to something shorter | 19 // may forward declare and typedef GoogleServiceAuthError to something shorter |
20 // in the comfort of your own translation unit. | 20 // in the comfort of your own translation unit. |
21 | 21 |
22 #ifndef CHROME_COMMON_NET_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ | 22 #ifndef GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ |
23 #define CHROME_COMMON_NET_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ | 23 #define GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ |
24 | 24 |
25 #include <string> | 25 #include <string> |
26 | 26 |
27 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
28 | 28 |
29 namespace base { | 29 namespace base { |
30 class DictionaryValue; | 30 class DictionaryValue; |
31 } | 31 } |
32 | 32 |
33 class GoogleServiceAuthError { | 33 class GoogleServiceAuthError { |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 const std::string& alternate_text, | 199 const std::string& alternate_text, |
200 int field_length); | 200 int field_length); |
201 | 201 |
202 State state_; | 202 State state_; |
203 Captcha captcha_; | 203 Captcha captcha_; |
204 SecondFactor second_factor_; | 204 SecondFactor second_factor_; |
205 int network_error_; | 205 int network_error_; |
206 std::string error_message_; | 206 std::string error_message_; |
207 }; | 207 }; |
208 | 208 |
209 #endif // CHROME_COMMON_NET_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ | 209 #endif // GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ |
OLD | NEW |