Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1847)

Side by Side Diff: google_apis/gaia/gaia_auth_fetcher.cc

Issue 1124053006: Use StringPairs with SplitStringIntoKeyValuePairs in google_apis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698