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

Side by Side Diff: chrome/common/net/gaia/gaia_auth_fetcher.cc

Issue 10554008: Move content::URLFetcher static functions to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move URLFetcher back Created 8 years, 6 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 | Annotate | Revision Log
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 "chrome/common/net/gaia/gaia_auth_fetcher.h" 5 #include "chrome/common/net/gaia/gaia_auth_fetcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
13 #include "base/string_split.h" 13 #include "base/string_split.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/stringprintf.h" 15 #include "base/stringprintf.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/common/net/gaia/gaia_auth_consumer.h" 17 #include "chrome/common/net/gaia/gaia_auth_consumer.h"
18 #include "chrome/common/net/gaia/gaia_constants.h" 18 #include "chrome/common/net/gaia/gaia_constants.h"
19 #include "chrome/common/net/gaia/gaia_urls.h" 19 #include "chrome/common/net/gaia/gaia_urls.h"
20 #include "chrome/common/net/gaia/google_service_auth_error.h" 20 #include "chrome/common/net/gaia/google_service_auth_error.h"
21 #include "content/public/common/url_fetcher.h"
22 #include "net/base/escape.h" 21 #include "net/base/escape.h"
23 #include "net/base/load_flags.h" 22 #include "net/base/load_flags.h"
24 #include "net/http/http_status_code.h" 23 #include "net/http/http_status_code.h"
24 #include "net/url_request/url_fetcher.h"
25 #include "net/url_request/url_request_context_getter.h" 25 #include "net/url_request/url_request_context_getter.h"
26 #include "net/url_request/url_request_status.h" 26 #include "net/url_request/url_request_status.h"
27 27
28 namespace { 28 namespace {
29 const int kLoadFlagsIgnoreCookies = net::LOAD_DO_NOT_SEND_COOKIES | 29 const int kLoadFlagsIgnoreCookies = net::LOAD_DO_NOT_SEND_COOKIES |
30 net::LOAD_DO_NOT_SAVE_COOKIES; 30 net::LOAD_DO_NOT_SAVE_COOKIES;
31 31
32 static bool CookiePartsContains(const std::vector<std::string>& parts, 32 static bool CookiePartsContains(const std::vector<std::string>& parts,
33 const char* part) { 33 const char* part) {
34 return std::find(parts.begin(), parts.end(), part) != parts.end(); 34 return std::find(parts.begin(), parts.end(), part) != parts.end();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 220
221 // static 221 // static
222 net::URLFetcher* GaiaAuthFetcher::CreateGaiaFetcher( 222 net::URLFetcher* GaiaAuthFetcher::CreateGaiaFetcher(
223 net::URLRequestContextGetter* getter, 223 net::URLRequestContextGetter* getter,
224 const std::string& body, 224 const std::string& body,
225 const std::string& headers, 225 const std::string& headers,
226 const GURL& gaia_gurl, 226 const GURL& gaia_gurl,
227 int load_flags, 227 int load_flags,
228 net::URLFetcherDelegate* delegate) { 228 net::URLFetcherDelegate* delegate) {
229 net::URLFetcher* to_return = content::URLFetcher::Create( 229 net::URLFetcher* to_return = net::URLFetcher::Create(
230 0, gaia_gurl, 230 0, gaia_gurl,
231 body == "" ? net::URLFetcher::GET : net::URLFetcher::POST, 231 body == "" ? net::URLFetcher::GET : net::URLFetcher::POST,
232 delegate); 232 delegate);
233 to_return->SetRequestContext(getter); 233 to_return->SetRequestContext(getter);
234 to_return->SetUploadData("application/x-www-form-urlencoded", body); 234 to_return->SetUploadData("application/x-www-form-urlencoded", body);
235 235
236 DVLOG(2) << "Gaia fetcher URL: " << gaia_gurl.spec(); 236 DVLOG(2) << "Gaia fetcher URL: " << gaia_gurl.spec();
237 DVLOG(2) << "Gaia fetcher headers: " << headers; 237 DVLOG(2) << "Gaia fetcher headers: " << headers;
238 DVLOG(2) << "Gaia fetcher body: " << body; 238 DVLOG(2) << "Gaia fetcher body: " << body;
239 239
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 NOTREACHED(); 1102 NOTREACHED();
1103 } 1103 }
1104 } 1104 }
1105 1105
1106 // static 1106 // static
1107 bool GaiaAuthFetcher::IsSecondFactorSuccess( 1107 bool GaiaAuthFetcher::IsSecondFactorSuccess(
1108 const std::string& alleged_error) { 1108 const std::string& alleged_error) {
1109 return alleged_error.find(kSecondFactor) != 1109 return alleged_error.find(kSecondFactor) !=
1110 std::string::npos; 1110 std::string::npos;
1111 } 1111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698