| 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 #include "google_apis/gaia/google_service_auth_error.h" | 5 #include "google_apis/gaia/google_service_auth_error.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 GoogleServiceAuthError GoogleServiceAuthError::FromUnexpectedServiceResponse( | 119 GoogleServiceAuthError GoogleServiceAuthError::FromUnexpectedServiceResponse( |
| 120 const std::string& error_message) { | 120 const std::string& error_message) { |
| 121 return GoogleServiceAuthError(UNEXPECTED_SERVICE_RESPONSE, error_message); | 121 return GoogleServiceAuthError(UNEXPECTED_SERVICE_RESPONSE, error_message); |
| 122 } | 122 } |
| 123 | 123 |
| 124 // static | 124 // static |
| 125 GoogleServiceAuthError GoogleServiceAuthError::AuthErrorNone() { | 125 GoogleServiceAuthError GoogleServiceAuthError::AuthErrorNone() { |
| 126 return GoogleServiceAuthError(NONE); | 126 return GoogleServiceAuthError(NONE); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // static |
| 130 bool GoogleServiceAuthError::IsDeprecated(State state) { |
| 131 return state == HOSTED_NOT_ALLOWED_DEPRECATED; |
| 132 } |
| 133 |
| 129 GoogleServiceAuthError::State GoogleServiceAuthError::state() const { | 134 GoogleServiceAuthError::State GoogleServiceAuthError::state() const { |
| 130 return state_; | 135 return state_; |
| 131 } | 136 } |
| 132 | 137 |
| 133 const GoogleServiceAuthError::Captcha& GoogleServiceAuthError::captcha() const { | 138 const GoogleServiceAuthError::Captcha& GoogleServiceAuthError::captcha() const { |
| 134 return captcha_; | 139 return captcha_; |
| 135 } | 140 } |
| 136 | 141 |
| 137 const GoogleServiceAuthError::SecondFactor& | 142 const GoogleServiceAuthError::SecondFactor& |
| 138 GoogleServiceAuthError::second_factor() const { | 143 GoogleServiceAuthError::second_factor() const { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 169 STATE_CASE(NONE); | 174 STATE_CASE(NONE); |
| 170 STATE_CASE(INVALID_GAIA_CREDENTIALS); | 175 STATE_CASE(INVALID_GAIA_CREDENTIALS); |
| 171 STATE_CASE(USER_NOT_SIGNED_UP); | 176 STATE_CASE(USER_NOT_SIGNED_UP); |
| 172 STATE_CASE(CONNECTION_FAILED); | 177 STATE_CASE(CONNECTION_FAILED); |
| 173 STATE_CASE(CAPTCHA_REQUIRED); | 178 STATE_CASE(CAPTCHA_REQUIRED); |
| 174 STATE_CASE(ACCOUNT_DELETED); | 179 STATE_CASE(ACCOUNT_DELETED); |
| 175 STATE_CASE(ACCOUNT_DISABLED); | 180 STATE_CASE(ACCOUNT_DISABLED); |
| 176 STATE_CASE(SERVICE_UNAVAILABLE); | 181 STATE_CASE(SERVICE_UNAVAILABLE); |
| 177 STATE_CASE(TWO_FACTOR); | 182 STATE_CASE(TWO_FACTOR); |
| 178 STATE_CASE(REQUEST_CANCELED); | 183 STATE_CASE(REQUEST_CANCELED); |
| 179 STATE_CASE(HOSTED_NOT_ALLOWED); | |
| 180 STATE_CASE(UNEXPECTED_SERVICE_RESPONSE); | 184 STATE_CASE(UNEXPECTED_SERVICE_RESPONSE); |
| 181 STATE_CASE(SERVICE_ERROR); | 185 STATE_CASE(SERVICE_ERROR); |
| 182 STATE_CASE(WEB_LOGIN_REQUIRED); | 186 STATE_CASE(WEB_LOGIN_REQUIRED); |
| 183 #undef STATE_CASE | 187 #undef STATE_CASE |
| 184 default: | 188 default: |
| 185 NOTREACHED(); | 189 NOTREACHED(); |
| 186 break; | 190 break; |
| 187 } | 191 } |
| 188 value->SetString("state", state_str); | 192 value->SetString("state", state_str); |
| 189 if (!error_message_.empty()) { | 193 if (!error_message_.empty()) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 return "Account deleted."; | 232 return "Account deleted."; |
| 229 case ACCOUNT_DISABLED: | 233 case ACCOUNT_DISABLED: |
| 230 return "Account disabled."; | 234 return "Account disabled."; |
| 231 case SERVICE_UNAVAILABLE: | 235 case SERVICE_UNAVAILABLE: |
| 232 return "Service unavailable; try again later."; | 236 return "Service unavailable; try again later."; |
| 233 case TWO_FACTOR: | 237 case TWO_FACTOR: |
| 234 return base::StringPrintf("2-step verification required (%s).", | 238 return base::StringPrintf("2-step verification required (%s).", |
| 235 second_factor_.token.c_str()); | 239 second_factor_.token.c_str()); |
| 236 case REQUEST_CANCELED: | 240 case REQUEST_CANCELED: |
| 237 return "Request canceled."; | 241 return "Request canceled."; |
| 238 case HOSTED_NOT_ALLOWED: | |
| 239 return "Google account required."; | |
| 240 case UNEXPECTED_SERVICE_RESPONSE: | 242 case UNEXPECTED_SERVICE_RESPONSE: |
| 241 return base::StringPrintf("Unexpected service response (%s)", | 243 return base::StringPrintf("Unexpected service response (%s)", |
| 242 error_message_.c_str()); | 244 error_message_.c_str()); |
| 243 case SERVICE_ERROR: | 245 case SERVICE_ERROR: |
| 244 return base::StringPrintf("Service responded with error: '%s'", | 246 return base::StringPrintf("Service responded with error: '%s'", |
| 245 error_message_.c_str()); | 247 error_message_.c_str()); |
| 246 case WEB_LOGIN_REQUIRED: | 248 case WEB_LOGIN_REQUIRED: |
| 247 return "Less secure apps may not authenticate with this account. " | 249 return "Less secure apps may not authenticate with this account. " |
| 248 "Please visit: " | 250 "Please visit: " |
| 249 "https://www.google.com/settings/security/lesssecureapps"; | 251 "https://www.google.com/settings/security/lesssecureapps"; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 const GURL& captcha_audio_url, | 284 const GURL& captcha_audio_url, |
| 283 const GURL& captcha_image_url, | 285 const GURL& captcha_image_url, |
| 284 const GURL& captcha_unlock_url, | 286 const GURL& captcha_unlock_url, |
| 285 int image_width, | 287 int image_width, |
| 286 int image_height) | 288 int image_height) |
| 287 : state_(s), | 289 : state_(s), |
| 288 captcha_(captcha_token, captcha_audio_url, captcha_image_url, | 290 captcha_(captcha_token, captcha_audio_url, captcha_image_url, |
| 289 captcha_unlock_url, image_width, image_height), | 291 captcha_unlock_url, image_width, image_height), |
| 290 network_error_(0) { | 292 network_error_(0) { |
| 291 } | 293 } |
| OLD | NEW |