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

Side by Side Diff: chrome/service/cloud_print/cloud_print_url_fetcher.cc

Issue 8395038: Make test URLFetcher implementations not derive from the URLFetcher implementation, since we want... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: move factory to its own file and remove Create function from URLFetcher impl Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/service/cloud_print/cloud_print_url_fetcher.h" 5 #include "chrome/service/cloud_print/cloud_print_url_fetcher.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/common/net/http_return.h" 9 #include "chrome/common/net/http_return.h"
10 #include "chrome/service/cloud_print/cloud_print_consts.h" 10 #include "chrome/service/cloud_print/cloud_print_consts.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // reached. Try again. Set up the request headers again because the token 115 // reached. Try again. Set up the request headers again because the token
116 // may have changed. 116 // may have changed.
117 SetupRequestHeaders(); 117 SetupRequestHeaders();
118 request_->StartWithRequestContextGetter(GetRequestContextGetter()); 118 request_->StartWithRequestContextGetter(GetRequestContextGetter());
119 } 119 }
120 } 120 }
121 } 121 }
122 122
123 void CloudPrintURLFetcher::StartRequestHelper( 123 void CloudPrintURLFetcher::StartRequestHelper(
124 const GURL& url, 124 const GURL& url,
125 URLFetcher::RequestType request_type, 125 content::URLFetcher::RequestType request_type,
126 Delegate* delegate, 126 Delegate* delegate,
127 int max_retries, 127 int max_retries,
128 const std::string& post_data_mime_type, 128 const std::string& post_data_mime_type,
129 const std::string& post_data, 129 const std::string& post_data,
130 const std::string& additional_headers) { 130 const std::string& additional_headers) {
131 DCHECK(delegate); 131 DCHECK(delegate);
132 // Persist the additional headers in case we need to retry the request. 132 // Persist the additional headers in case we need to retry the request.
133 additional_headers_ = additional_headers; 133 additional_headers_ = additional_headers;
134 request_.reset(new URLFetcher(url, request_type, this)); 134 request_.reset(new URLFetcher(url, request_type, this));
135 request_->SetRequestContext(GetRequestContextGetter()); 135 request_->SetRequestContext(GetRequestContextGetter());
(...skipping 30 matching lines...) Expand all
166 166
167 net::URLRequestContextGetter* CloudPrintURLFetcher::GetRequestContextGetter() { 167 net::URLRequestContextGetter* CloudPrintURLFetcher::GetRequestContextGetter() {
168 ServiceURLRequestContextGetter* getter = 168 ServiceURLRequestContextGetter* getter =
169 g_service_process->GetServiceURLRequestContextGetter(); 169 g_service_process->GetServiceURLRequestContextGetter();
170 // Now set up the user agent for cloudprint. 170 // Now set up the user agent for cloudprint.
171 std::string user_agent = getter->user_agent(); 171 std::string user_agent = getter->user_agent();
172 base::StringAppendF(&user_agent, " %s", kCloudPrintUserAgent); 172 base::StringAppendF(&user_agent, " %s", kCloudPrintUserAgent);
173 getter->set_user_agent(user_agent); 173 getter->set_user_agent(user_agent);
174 return getter; 174 return getter;
175 } 175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698