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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 two_factor_value->SetString("promptText", second_factor_.prompt_text); | 218 two_factor_value->SetString("promptText", second_factor_.prompt_text); |
219 two_factor_value->SetString("alternateText", second_factor_.alternate_text); | 219 two_factor_value->SetString("alternateText", second_factor_.alternate_text); |
220 two_factor_value->SetInteger("fieldLength", second_factor_.field_length); | 220 two_factor_value->SetInteger("fieldLength", second_factor_.field_length); |
221 } | 221 } |
222 return value; | 222 return value; |
223 } | 223 } |
224 | 224 |
225 std::string GoogleServiceAuthError::ToString() const { | 225 std::string GoogleServiceAuthError::ToString() const { |
226 switch (state_) { | 226 switch (state_) { |
227 case NONE: | 227 case NONE: |
228 return ""; | 228 return std::string(); |
229 case INVALID_GAIA_CREDENTIALS: | 229 case INVALID_GAIA_CREDENTIALS: |
230 return "Invalid credentials."; | 230 return "Invalid credentials."; |
231 case USER_NOT_SIGNED_UP: | 231 case USER_NOT_SIGNED_UP: |
232 return "Not authorized."; | 232 return "Not authorized."; |
233 case CONNECTION_FAILED: | 233 case CONNECTION_FAILED: |
234 return base::StringPrintf("Connection failed (%d).", network_error_); | 234 return base::StringPrintf("Connection failed (%d).", network_error_); |
235 case CAPTCHA_REQUIRED: | 235 case CAPTCHA_REQUIRED: |
236 return base::StringPrintf("CAPTCHA required (%s).", | 236 return base::StringPrintf("CAPTCHA required (%s).", |
237 captcha_.token.c_str()); | 237 captcha_.token.c_str()); |
238 case ACCOUNT_DELETED: | 238 case ACCOUNT_DELETED: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 GoogleServiceAuthError::GoogleServiceAuthError( | 276 GoogleServiceAuthError::GoogleServiceAuthError( |
277 State s, | 277 State s, |
278 const std::string& captcha_token, | 278 const std::string& captcha_token, |
279 const std::string& prompt_text, | 279 const std::string& prompt_text, |
280 const std::string& alternate_text, | 280 const std::string& alternate_text, |
281 int field_length) | 281 int field_length) |
282 : state_(s), | 282 : state_(s), |
283 second_factor_(captcha_token, prompt_text, alternate_text, field_length), | 283 second_factor_(captcha_token, prompt_text, alternate_text, field_length), |
284 network_error_(0) { | 284 network_error_(0) { |
285 } | 285 } |
OLD | NEW |