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

Side by Side Diff: content/common/net/url_fetcher.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 "content/public/common/url_fetcher.h" 5 #include "content/public/common/url_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/common/net/url_request_user_data.h" 8 #include "content/common/net/url_request_user_data.h"
9 #include "net/url_request/url_fetcher_factory.h" 9 #include "net/url_request/url_fetcher.h"
10 #include "net/url_request/url_fetcher_impl.h"
11 10
12 // static 11 namespace content {
13 net::URLFetcher* content::URLFetcher::Create( 12
13 namespace URLFetcher {
14
15 // We have to mark the definition as CONTENT_EXPORT, too, as the
16 // declaration isn't visible from here (since it's protected by an
17 // #ifdef).
18 CONTENT_EXPORT net::URLFetcher* Create(
14 const GURL& url, 19 const GURL& url,
15 net::URLFetcher::RequestType request_type, 20 net::URLFetcher::RequestType request_type,
16 net::URLFetcherDelegate* d) { 21 net::URLFetcherDelegate* d) {
17 return new net::URLFetcherImpl(url, request_type, d); 22 return net::URLFetcher::Create(url, request_type, d);
18 } 23 }
19 24
20 // static 25 } // namespace URLFetcher
21 net::URLFetcher* content::URLFetcher::Create(
22 int id,
23 const GURL& url,
24 net::URLFetcher::RequestType request_type,
25 net::URLFetcherDelegate* d) {
26 net::URLFetcherFactory* factory = net::URLFetcherImpl::factory();
27 return factory ? factory->CreateURLFetcher(id, url, request_type, d) :
28 new net::URLFetcherImpl(url, request_type, d);
29 }
30
31 // static
32 void content::URLFetcher::CancelAll() {
33 net::URLFetcherImpl::CancelAll();
34 }
35
36 // static
37 void content::URLFetcher::SetEnableInterceptionForTests(bool enabled) {
38 net::URLFetcherImpl::SetEnableInterceptionForTests(enabled);
39 }
40 26
41 namespace { 27 namespace {
42 28
43 base::SupportsUserData::Data* CreateURLRequestUserData( 29 base::SupportsUserData::Data* CreateURLRequestUserData(
44 int render_process_id, 30 int render_process_id,
45 int render_view_id) { 31 int render_view_id) {
46 return new URLRequestUserData(render_process_id, render_view_id); 32 return new URLRequestUserData(render_process_id, render_view_id);
47 } 33 }
48 34
49 } // namespace 35 } // namespace
50 36
51 namespace content {
52
53 void AssociateURLFetcherWithRenderView(net::URLFetcher* url_fetcher, 37 void AssociateURLFetcherWithRenderView(net::URLFetcher* url_fetcher,
54 const GURL& first_party_for_cookies, 38 const GURL& first_party_for_cookies,
55 int render_process_id, 39 int render_process_id,
56 int render_view_id) { 40 int render_view_id) {
57 url_fetcher->SetFirstPartyForCookies(first_party_for_cookies); 41 url_fetcher->SetFirstPartyForCookies(first_party_for_cookies);
58 url_fetcher->SetURLRequestUserData( 42 url_fetcher->SetURLRequestUserData(
59 URLRequestUserData::kUserDataKey, 43 URLRequestUserData::kUserDataKey,
60 base::Bind(&CreateURLRequestUserData, 44 base::Bind(&CreateURLRequestUserData,
61 render_process_id, render_view_id)); 45 render_process_id, render_view_id));
62 } 46 }
63 47
64 } // namespace content 48 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/speech/google_one_shot_remote_engine.cc ('k') | content/public/common/url_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698