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

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

Issue 10554008: Move content::URLFetcher static functions to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win link error 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_oauth_client.h" 5 #include "chrome/common/net/gaia/gaia_oauth_client.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "content/public/common/url_fetcher.h"
12 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
13 #include "net/base/escape.h" 12 #include "net/base/escape.h"
14 #include "net/http/http_status_code.h" 13 #include "net/http/http_status_code.h"
14 #include "net/url_request/url_fetcher.h"
15 #include "net/url_request/url_fetcher_delegate.h" 15 #include "net/url_request/url_fetcher_delegate.h"
16 #include "net/url_request/url_request_context_getter.h" 16 #include "net/url_request/url_request_context_getter.h"
17 17
18 namespace { 18 namespace {
19 const char kAccessTokenValue[] = "access_token"; 19 const char kAccessTokenValue[] = "access_token";
20 const char kRefreshTokenValue[] = "refresh_token"; 20 const char kRefreshTokenValue[] = "refresh_token";
21 const char kExpiresInValue[] = "expires_in"; 21 const char kExpiresInValue[] = "expires_in";
22 } 22 }
23 23
24 namespace gaia { 24 namespace gaia {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 MakeGaiaRequest(post_body, max_retries, delegate); 93 MakeGaiaRequest(post_body, max_retries, delegate);
94 } 94 }
95 95
96 void GaiaOAuthClient::Core::MakeGaiaRequest( 96 void GaiaOAuthClient::Core::MakeGaiaRequest(
97 const std::string& post_body, 97 const std::string& post_body,
98 int max_retries, 98 int max_retries,
99 GaiaOAuthClient::Delegate* delegate) { 99 GaiaOAuthClient::Delegate* delegate) {
100 DCHECK(!request_.get()) << "Tried to fetch two things at once!"; 100 DCHECK(!request_.get()) << "Tried to fetch two things at once!";
101 delegate_ = delegate; 101 delegate_ = delegate;
102 num_retries_ = 0; 102 num_retries_ = 0;
103 request_.reset(content::URLFetcher::Create( 103 request_.reset(net::URLFetcher::Create(
104 0, gaia_url_, net::URLFetcher::POST, this)); 104 0, gaia_url_, net::URLFetcher::POST, this));
105 request_->SetRequestContext(request_context_getter_); 105 request_->SetRequestContext(request_context_getter_);
106 request_->SetUploadData("application/x-www-form-urlencoded", post_body); 106 request_->SetUploadData("application/x-www-form-urlencoded", post_body);
107 request_->SetMaxRetries(max_retries); 107 request_->SetMaxRetries(max_retries);
108 request_->Start(); 108 request_->Start();
109 } 109 }
110 110
111 // URLFetcher::Delegate implementation. 111 // URLFetcher::Delegate implementation.
112 void GaiaOAuthClient::Core::OnURLFetchComplete( 112 void GaiaOAuthClient::Core::OnURLFetchComplete(
113 const net::URLFetcher* source) { 113 const net::URLFetcher* source) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 const std::string& refresh_token, 199 const std::string& refresh_token,
200 int max_retries, 200 int max_retries,
201 Delegate* delegate) { 201 Delegate* delegate) {
202 return core_->RefreshToken(oauth_client_info, 202 return core_->RefreshToken(oauth_client_info,
203 refresh_token, 203 refresh_token,
204 max_retries, 204 max_retries,
205 delegate); 205 delegate);
206 } 206 }
207 207
208 } // namespace gaia 208 } // namespace gaia
OLDNEW
« no previous file with comments | « chrome/common/net/gaia/gaia_auth_fetcher.cc ('k') | chrome/common/net/gaia/oauth2_access_token_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698