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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 } else { | 860 } else { |
861 consumer_->OnListAccountsFailure(GenerateAuthError(data, status)); | 861 consumer_->OnListAccountsFailure(GenerateAuthError(data, status)); |
862 } | 862 } |
863 } | 863 } |
864 | 864 |
865 void GaiaAuthFetcher::OnGetUserInfoFetched( | 865 void GaiaAuthFetcher::OnGetUserInfoFetched( |
866 const std::string& data, | 866 const std::string& data, |
867 const net::URLRequestStatus& status, | 867 const net::URLRequestStatus& status, |
868 int response_code) { | 868 int response_code) { |
869 if (status.is_success() && response_code == net::HTTP_OK) { | 869 if (status.is_success() && response_code == net::HTTP_OK) { |
870 std::vector<std::pair<std::string, std::string> > tokens; | 870 base::StringPairs tokens; |
871 UserInfoMap matches; | 871 UserInfoMap matches; |
872 base::SplitStringIntoKeyValuePairs(data, '=', '\n', &tokens); | 872 base::SplitStringIntoKeyValuePairs(data, '=', '\n', &tokens); |
873 std::vector<std::pair<std::string, std::string> >::iterator i; | 873 base::StringPairs::iterator i; |
874 for (i = tokens.begin(); i != tokens.end(); ++i) { | 874 for (i = tokens.begin(); i != tokens.end(); ++i) { |
875 matches[i->first] = i->second; | 875 matches[i->first] = i->second; |
876 } | 876 } |
877 consumer_->OnGetUserInfoSuccess(matches); | 877 consumer_->OnGetUserInfoSuccess(matches); |
878 } else { | 878 } else { |
879 consumer_->OnGetUserInfoFailure(GenerateAuthError(data, status)); | 879 consumer_->OnGetUserInfoFailure(GenerateAuthError(data, status)); |
880 } | 880 } |
881 } | 881 } |
882 | 882 |
883 void GaiaAuthFetcher::OnMergeSessionFetched(const std::string& data, | 883 void GaiaAuthFetcher::OnMergeSessionFetched(const std::string& data, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 NOTREACHED(); | 974 NOTREACHED(); |
975 } | 975 } |
976 } | 976 } |
977 | 977 |
978 // static | 978 // static |
979 bool GaiaAuthFetcher::IsSecondFactorSuccess( | 979 bool GaiaAuthFetcher::IsSecondFactorSuccess( |
980 const std::string& alleged_error) { | 980 const std::string& alleged_error) { |
981 return alleged_error.find(kSecondFactor) != | 981 return alleged_error.find(kSecondFactor) != |
982 std::string::npos; | 982 std::string::npos; |
983 } | 983 } |
OLD | NEW |