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/gaia_auth_fetcher.h" | 5 #include "google_apis/gaia/gaia_auth_fetcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 void GaiaAuthFetcher::ParseClientLoginResponse(const std::string& data, | 402 void GaiaAuthFetcher::ParseClientLoginResponse(const std::string& data, |
403 std::string* sid, | 403 std::string* sid, |
404 std::string* lsid, | 404 std::string* lsid, |
405 std::string* token) { | 405 std::string* token) { |
406 using std::vector; | 406 using std::vector; |
407 using std::pair; | 407 using std::pair; |
408 using std::string; | 408 using std::string; |
409 sid->clear(); | 409 sid->clear(); |
410 lsid->clear(); | 410 lsid->clear(); |
411 token->clear(); | 411 token->clear(); |
412 vector<pair<string, string> > tokens; | 412 base::StringPairs tokens; |
413 base::SplitStringIntoKeyValuePairs(data, '=', '\n', &tokens); | 413 base::SplitStringIntoKeyValuePairs(data, '=', '\n', &tokens); |
414 for (vector<pair<string, string> >::iterator i = tokens.begin(); | 414 for (base::StringPairs::iterator i = tokens.begin(); |
415 i != tokens.end(); ++i) { | 415 i != tokens.end(); ++i) { |
416 if (i->first == "SID") { | 416 if (i->first == "SID") { |
417 sid->assign(i->second); | 417 sid->assign(i->second); |
418 } else if (i->first == "LSID") { | 418 } else if (i->first == "LSID") { |
419 lsid->assign(i->second); | 419 lsid->assign(i->second); |
420 } else if (i->first == "Auth") { | 420 } else if (i->first == "Auth") { |
421 token->assign(i->second); | 421 token->assign(i->second); |
422 } | 422 } |
423 } | 423 } |
424 // If this was a request for uberauth token, then that's all we've got in | 424 // If this was a request for uberauth token, then that's all we've got in |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 // static | 477 // static |
478 void GaiaAuthFetcher::ParseClientLoginFailure(const std::string& data, | 478 void GaiaAuthFetcher::ParseClientLoginFailure(const std::string& data, |
479 std::string* error, | 479 std::string* error, |
480 std::string* error_url, | 480 std::string* error_url, |
481 std::string* captcha_url, | 481 std::string* captcha_url, |
482 std::string* captcha_token) { | 482 std::string* captcha_token) { |
483 using std::vector; | 483 using std::vector; |
484 using std::pair; | 484 using std::pair; |
485 using std::string; | 485 using std::string; |
486 | 486 |
487 vector<pair<string, string> > tokens; | 487 base::StringPairs tokens; |
488 base::SplitStringIntoKeyValuePairs(data, '=', '\n', &tokens); | 488 base::SplitStringIntoKeyValuePairs(data, '=', '\n', &tokens); |
489 for (vector<pair<string, string> >::iterator i = tokens.begin(); | 489 for (base::StringPairs::iterator i = tokens.begin(); |
490 i != tokens.end(); ++i) { | 490 i != tokens.end(); ++i) { |
491 if (i->first == kErrorParam) { | 491 if (i->first == kErrorParam) { |
492 error->assign(i->second); | 492 error->assign(i->second); |
493 } else if (i->first == kErrorUrlParam) { | 493 } else if (i->first == kErrorUrlParam) { |
494 error_url->assign(i->second); | 494 error_url->assign(i->second); |
495 } else if (i->first == kCaptchaUrlParam) { | 495 } else if (i->first == kCaptchaUrlParam) { |
496 captcha_url->assign(i->second); | 496 captcha_url->assign(i->second); |
497 } else if (i->first == kCaptchaTokenParam) { | 497 } else if (i->first == kCaptchaTokenParam) { |
498 captcha_token->assign(i->second); | 498 captcha_token->assign(i->second); |
499 } | 499 } |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 return alleged_error.find(kSecondFactor) != | 1106 return alleged_error.find(kSecondFactor) != |
1107 std::string::npos; | 1107 std::string::npos; |
1108 } | 1108 } |
1109 | 1109 |
1110 // static | 1110 // static |
1111 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( | 1111 bool GaiaAuthFetcher::IsWebLoginRequiredSuccess( |
1112 const std::string& alleged_error) { | 1112 const std::string& alleged_error) { |
1113 return alleged_error.find(kWebLoginRequired) != | 1113 return alleged_error.find(kWebLoginRequired) != |
1114 std::string::npos; | 1114 std::string::npos; |
1115 } | 1115 } |
OLD | NEW |