| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // The service is not available; try again later. | 67 // The service is not available; try again later. |
| 68 SERVICE_UNAVAILABLE = 7, | 68 SERVICE_UNAVAILABLE = 7, |
| 69 | 69 |
| 70 // The password is valid but we need two factor to get a token. | 70 // The password is valid but we need two factor to get a token. |
| 71 TWO_FACTOR = 8, | 71 TWO_FACTOR = 8, |
| 72 | 72 |
| 73 // The requestor of the authentication step cancelled the request | 73 // The requestor of the authentication step cancelled the request |
| 74 // prior to completion. | 74 // prior to completion. |
| 75 REQUEST_CANCELED = 9, | 75 REQUEST_CANCELED = 9, |
| 76 | 76 |
| 77 // The user has provided a HOSTED account, when this service requires | 77 // HOSTED accounts are deprecated; left in enumeration to match |
| 78 // a GOOGLE account. | 78 // GoogleServiceAuthError enum in histograms.xml. |
| 79 HOSTED_NOT_ALLOWED = 10, | 79 HOSTED_NOT_ALLOWED_DEPRECATED = 10, |
| 80 | 80 |
| 81 // Indicates the service responded to a request, but we cannot | 81 // Indicates the service responded to a request, but we cannot |
| 82 // interpret the response. | 82 // interpret the response. |
| 83 UNEXPECTED_SERVICE_RESPONSE = 11, | 83 UNEXPECTED_SERVICE_RESPONSE = 11, |
| 84 | 84 |
| 85 // Indicates the service responded and response carried details of the | 85 // Indicates the service responded and response carried details of the |
| 86 // application error. | 86 // application error. |
| 87 SERVICE_ERROR = 12, | 87 SERVICE_ERROR = 12, |
| 88 | 88 |
| 89 // The password is valid but web login is required to get a token. | 89 // The password is valid but web login is required to get a token. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 const std::string& prompt, | 122 const std::string& prompt, |
| 123 const std::string& alternate, | 123 const std::string& alternate, |
| 124 int length); | 124 int length); |
| 125 SecondFactor(const SecondFactor& other); | 125 SecondFactor(const SecondFactor& other); |
| 126 ~SecondFactor(); | 126 ~SecondFactor(); |
| 127 // For test only. | 127 // For test only. |
| 128 bool operator==(const SecondFactor &b) const; | 128 bool operator==(const SecondFactor &b) const; |
| 129 | 129 |
| 130 // Globally identifies the specific second-factor challenge. | 130 // Globally identifies the specific second-factor challenge. |
| 131 std::string token; | 131 std::string token; |
| 132 // Localised prompt text, eg Enter the verification code sent to your | 132 // Localized prompt text, e.g. "Enter the verification code sent to your |
| 133 // phone number ending in XXX. | 133 // phone number ending in XXX". |
| 134 std::string prompt_text; | 134 std::string prompt_text; |
| 135 // Localized text describing an alternate option, eg Get a verification | 135 // Localized text describing an alternate option, e.g. "Get a verification |
| 136 // code in a text message. | 136 // code in a text message". |
| 137 std::string alternate_text; | 137 std::string alternate_text; |
| 138 // Character length for the challenge field. | 138 // Character length for the challenge field. |
| 139 int field_length; | 139 int field_length; |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 // For test only. | 142 // For test only. |
| 143 bool operator==(const GoogleServiceAuthError &b) const; | 143 bool operator==(const GoogleServiceAuthError &b) const; |
| 144 bool operator!=(const GoogleServiceAuthError &b) const; | 144 bool operator!=(const GoogleServiceAuthError &b) const; |
| 145 | 145 |
| 146 // Construct a GoogleServiceAuthError from a State with no additional data. | 146 // Construct a GoogleServiceAuthError from a State with no additional data. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 169 // Construct an UNEXPECTED_SERVICE_RESPONSE error, with an |error_message| | 169 // Construct an UNEXPECTED_SERVICE_RESPONSE error, with an |error_message| |
| 170 // detailing the problems with the response. | 170 // detailing the problems with the response. |
| 171 static GoogleServiceAuthError FromUnexpectedServiceResponse( | 171 static GoogleServiceAuthError FromUnexpectedServiceResponse( |
| 172 const std::string& error_message); | 172 const std::string& error_message); |
| 173 | 173 |
| 174 // Provided for convenience for clients needing to reset an instance to NONE. | 174 // Provided for convenience for clients needing to reset an instance to NONE. |
| 175 // (avoids err_ = GoogleServiceAuthError(GoogleServiceAuthError::NONE), due | 175 // (avoids err_ = GoogleServiceAuthError(GoogleServiceAuthError::NONE), due |
| 176 // to explicit class and State enum relation. Note: shouldn't be inlined! | 176 // to explicit class and State enum relation. Note: shouldn't be inlined! |
| 177 static GoogleServiceAuthError AuthErrorNone(); | 177 static GoogleServiceAuthError AuthErrorNone(); |
| 178 | 178 |
| 179 static bool IsDeprecated(State state); |
| 180 |
| 179 // The error information. | 181 // The error information. |
| 180 State state() const; | 182 State state() const; |
| 181 const Captcha& captcha() const; | 183 const Captcha& captcha() const; |
| 182 const SecondFactor& second_factor() const; | 184 const SecondFactor& second_factor() const; |
| 183 int network_error() const; | 185 int network_error() const; |
| 184 const std::string& token() const; | 186 const std::string& token() const; |
| 185 const std::string& error_message() const; | 187 const std::string& error_message() const; |
| 186 | 188 |
| 187 // Returns info about this object in a dictionary. Caller takes | 189 // Returns info about this object in a dictionary. Caller takes |
| 188 // ownership of returned dictionary. | 190 // ownership of returned dictionary. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 210 int image_height); | 212 int image_height); |
| 211 | 213 |
| 212 State state_; | 214 State state_; |
| 213 Captcha captcha_; | 215 Captcha captcha_; |
| 214 SecondFactor second_factor_; | 216 SecondFactor second_factor_; |
| 215 int network_error_; | 217 int network_error_; |
| 216 std::string error_message_; | 218 std::string error_message_; |
| 217 }; | 219 }; |
| 218 | 220 |
| 219 #endif // GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ | 221 #endif // GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ |
| OLD | NEW |