Chromium Code Reviews| 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. |
| 90 WEB_LOGIN_REQUIRED = 13, | 90 WEB_LOGIN_REQUIRED = 13, |
| 91 | 91 |
| 92 // The number of known error states. | 92 // The number of known error states. |
| 93 NUM_STATES = 14, | 93 NUM_STATES = 14, |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 // Number of deprecated states in above enum, used for list size checks. | |
| 97 static const int NUM_DEPRECATED_STATES = 1; | |
| 98 | |
| 96 // Additional data for CAPTCHA_REQUIRED errors. | 99 // Additional data for CAPTCHA_REQUIRED errors. |
| 97 struct Captcha { | 100 struct Captcha { |
| 98 Captcha(); | 101 Captcha(); |
| 99 Captcha(const std::string& token, | 102 Captcha(const std::string& token, |
| 100 const GURL& audio, | 103 const GURL& audio, |
| 101 const GURL& img, | 104 const GURL& img, |
| 102 const GURL& unlock, | 105 const GURL& unlock, |
| 103 int width, | 106 int width, |
| 104 int height); | 107 int height); |
| 105 Captcha(const Captcha& other); | 108 Captcha(const Captcha& other); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 122 const std::string& prompt, | 125 const std::string& prompt, |
| 123 const std::string& alternate, | 126 const std::string& alternate, |
| 124 int length); | 127 int length); |
| 125 SecondFactor(const SecondFactor& other); | 128 SecondFactor(const SecondFactor& other); |
| 126 ~SecondFactor(); | 129 ~SecondFactor(); |
| 127 // For test only. | 130 // For test only. |
| 128 bool operator==(const SecondFactor &b) const; | 131 bool operator==(const SecondFactor &b) const; |
| 129 | 132 |
| 130 // Globally identifies the specific second-factor challenge. | 133 // Globally identifies the specific second-factor challenge. |
| 131 std::string token; | 134 std::string token; |
| 132 // Localised prompt text, eg Enter the verification code sent to your | 135 // Localized prompt text, e.g. "Enter the verification code sent to your |
| 133 // phone number ending in XXX. | 136 // phone number ending in XXX". |
| 134 std::string prompt_text; | 137 std::string prompt_text; |
| 135 // Localized text describing an alternate option, eg Get a verification | 138 // Localized text describing an alternate option, e.g. "Get a verification |
| 136 // code in a text message. | 139 // code in a text message". |
|
Greg Levin
2016/09/08 19:56:35
Fix typos, replace non-displaying Unicode open/clo
| |
| 137 std::string alternate_text; | 140 std::string alternate_text; |
| 138 // Character length for the challenge field. | 141 // Character length for the challenge field. |
| 139 int field_length; | 142 int field_length; |
| 140 }; | 143 }; |
| 141 | 144 |
| 142 // For test only. | 145 // For test only. |
| 143 bool operator==(const GoogleServiceAuthError &b) const; | 146 bool operator==(const GoogleServiceAuthError &b) const; |
| 144 bool operator!=(const GoogleServiceAuthError &b) const; | 147 bool operator!=(const GoogleServiceAuthError &b) const; |
| 145 | 148 |
| 146 // Construct a GoogleServiceAuthError from a State with no additional data. | 149 // Construct a GoogleServiceAuthError from a State with no additional data. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 int image_height); | 213 int image_height); |
| 211 | 214 |
| 212 State state_; | 215 State state_; |
| 213 Captcha captcha_; | 216 Captcha captcha_; |
| 214 SecondFactor second_factor_; | 217 SecondFactor second_factor_; |
| 215 int network_error_; | 218 int network_error_; |
| 216 std::string error_message_; | 219 std::string error_message_; |
| 217 }; | 220 }; |
| 218 | 221 |
| 219 #endif // GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ | 222 #endif // GOOGLE_APIS_GAIA_GOOGLE_SERVICE_AUTH_ERROR_H_ |
| OLD | NEW |