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

Side by Side Diff: chrome/browser/web_resource/web_resource_service.cc

Issue 10412050: Change most content::URLFetcher references to net::URLFetcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS, address comments Created 8 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 | 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/browser/web_resource/web_resource_service.h" 5 #include "chrome/browser/web_resource/web_resource_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 // Balanced in OnURLFetchComplete. 202 // Balanced in OnURLFetchComplete.
203 AddRef(); 203 AddRef();
204 204
205 GURL web_resource_server = apply_locale_to_url_ ? 205 GURL web_resource_server = apply_locale_to_url_ ?
206 google_util::AppendGoogleLocaleParam(web_resource_server_) : 206 google_util::AppendGoogleLocaleParam(web_resource_server_) :
207 web_resource_server_; 207 web_resource_server_;
208 208
209 DVLOG(1) << "WebResourceService StartFetch " << web_resource_server; 209 DVLOG(1) << "WebResourceService StartFetch " << web_resource_server;
210 url_fetcher_.reset(content::URLFetcher::Create( 210 url_fetcher_.reset(content::URLFetcher::Create(
211 web_resource_server, content::URLFetcher::GET, this)); 211 web_resource_server, net::URLFetcher::GET, this));
212 // Do not let url fetcher affect existing state in system context 212 // Do not let url fetcher affect existing state in system context
213 // (by setting cookies, for example). 213 // (by setting cookies, for example).
214 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | 214 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE |
215 net::LOAD_DO_NOT_SEND_COOKIES | 215 net::LOAD_DO_NOT_SEND_COOKIES |
216 net::LOAD_DO_NOT_SAVE_COOKIES); 216 net::LOAD_DO_NOT_SAVE_COOKIES);
217 net::URLRequestContextGetter* url_request_context_getter = 217 net::URLRequestContextGetter* url_request_context_getter =
218 g_browser_process->system_request_context(); 218 g_browser_process->system_request_context();
219 url_fetcher_->SetRequestContext(url_request_context_getter); 219 url_fetcher_->SetRequestContext(url_request_context_getter);
220 url_fetcher_->Start(); 220 url_fetcher_->Start();
221 } 221 }
222 222
223 void WebResourceService::OnURLFetchComplete(const net::URLFetcher* source) { 223 void WebResourceService::OnURLFetchComplete(const net::URLFetcher* source) {
224 // Delete the URLFetcher when this function exits. 224 // Delete the URLFetcher when this function exits.
225 scoped_ptr<net::URLFetcher> clean_up_fetcher(url_fetcher_.release()); 225 scoped_ptr<net::URLFetcher> clean_up_fetcher(url_fetcher_.release());
226 226
227 // Don't parse data if attempt to download was unsuccessful. 227 // Don't parse data if attempt to download was unsuccessful.
228 // Stop loading new web resource data, and silently exit. 228 // Stop loading new web resource data, and silently exit.
229 if (!source->GetStatus().is_success() || (source->GetResponseCode() != 200)) 229 if (!source->GetStatus().is_success() || (source->GetResponseCode() != 200))
230 return; 230 return;
231 231
232 std::string data; 232 std::string data;
233 source->GetResponseAsString(&data); 233 source->GetResponseAsString(&data);
234 234
235 // UnpackerClient releases itself. 235 // UnpackerClient releases itself.
236 UnpackerClient* client = new UnpackerClient(this); 236 UnpackerClient* client = new UnpackerClient(this);
237 client->Start(data); 237 client->Start(data);
238 238
239 Release(); 239 Release();
240 } 240 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/suggestions_source_discovery.cc ('k') | chrome/common/net/gaia/gaia_auth_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698