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 GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ | 22 #ifndef GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ |
23 #define GOOGLE_APIS_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 "url/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 { |
34 public: | 34 public: |
35 // | 35 // |
36 // These enumerations are referenced by integer value in HTML login code. | 36 // These enumerations are referenced by integer value in HTML login code. |
37 // Do not change the numeric values. | 37 // Do not change the numeric values. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 int field_length); | 204 int field_length); |
205 | 205 |
206 State state_; | 206 State state_; |
207 Captcha captcha_; | 207 Captcha captcha_; |
208 SecondFactor second_factor_; | 208 SecondFactor second_factor_; |
209 int network_error_; | 209 int network_error_; |
210 std::string error_message_; | 210 std::string error_message_; |
211 }; | 211 }; |
212 | 212 |
213 #endif // GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ | 213 #endif // GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ |
OLD | NEW |