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

Side by Side Diff: chrome/browser/web_resource/web_resource_service.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
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_controller.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/google/google_util.h" 16 #include "chrome/browser/google/google_util.h"
17 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/chrome_utility_messages.h" 19 #include "chrome/common/chrome_utility_messages.h"
20 #include "chrome/common/web_resource/web_resource_unpacker.h" 20 #include "chrome/common/web_resource/web_resource_unpacker.h"
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/resource_dispatcher_host.h" 22 #include "content/public/browser/resource_dispatcher_host.h"
23 #include "content/public/browser/utility_process_host.h" 23 #include "content/public/browser/utility_process_host.h"
24 #include "content/public/browser/utility_process_host_client.h" 24 #include "content/public/browser/utility_process_host_client.h"
25 #include "content/public/common/url_fetcher.h"
26 #include "googleurl/src/gurl.h" 25 #include "googleurl/src/gurl.h"
27 #include "net/base/load_flags.h" 26 #include "net/base/load_flags.h"
27 #include "net/url_request/url_fetcher.h"
28 #include "net/url_request/url_request_status.h" 28 #include "net/url_request/url_request_status.h"
29 29
30 using content::BrowserThread; 30 using content::BrowserThread;
31 using content::UtilityProcessHost; 31 using content::UtilityProcessHost;
32 using content::UtilityProcessHostClient; 32 using content::UtilityProcessHostClient;
33 33
34 // This class coordinates a web resource unpack and parse task which is run in 34 // This class coordinates a web resource unpack and parse task which is run in
35 // a separate process. Results are sent back to this class and routed to 35 // a separate process. Results are sent back to this class and routed to
36 // the WebResourceService. 36 // the WebResourceService.
37 class WebResourceService::UnpackerClient : public UtilityProcessHostClient { 37 class WebResourceService::UnpackerClient : public UtilityProcessHostClient {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 in_fetch_ = true; 200 in_fetch_ = true;
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(net::URLFetcher::Create(
211 web_resource_server, net::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();
(...skipping 12 matching lines...) Expand all
233 client->Start(data); 233 client->Start(data);
234 } else { 234 } else {
235 // Don't parse data if attempt to download was unsuccessful. 235 // Don't parse data if attempt to download was unsuccessful.
236 // Stop loading new web resource data, and silently exit. 236 // Stop loading new web resource data, and silently exit.
237 // We do not call UnpackerClient, so we need to call EndFetch ourselves. 237 // We do not call UnpackerClient, so we need to call EndFetch ourselves.
238 EndFetch(); 238 EndFetch();
239 } 239 }
240 240
241 Release(); 241 Release();
242 } 242 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/intents/web_intent_picker_controller.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698