OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
wtc
2012/06/18 23:04:22
The CL's description says:
Move content/common/n
akalin
2012/06/18 23:12:32
Yeah, you're right. Fixed.
| |
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 { | |
wtc
2012/06/18 23:04:22
This doesn't confirm to our Style Guide? All the
akalin
2012/06/18 23:12:32
Yeah, it's just a temporary hack. It should go aw
| |
14 | |
15 net::URLFetcher* Create( | |
14 const GURL& url, | 16 const GURL& url, |
15 net::URLFetcher::RequestType request_type, | 17 net::URLFetcher::RequestType request_type, |
16 net::URLFetcherDelegate* d) { | 18 net::URLFetcherDelegate* d) { |
17 return new net::URLFetcherImpl(url, request_type, d); | 19 return net::URLFetcher::Create(url, request_type, d); |
18 } | 20 } |
19 | 21 |
20 // static | 22 } // 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 | 23 |
41 namespace { | 24 namespace { |
42 | 25 |
43 base::SupportsUserData::Data* CreateURLRequestUserData( | 26 base::SupportsUserData::Data* CreateURLRequestUserData( |
44 int render_process_id, | 27 int render_process_id, |
45 int render_view_id) { | 28 int render_view_id) { |
46 return new URLRequestUserData(render_process_id, render_view_id); | 29 return new URLRequestUserData(render_process_id, render_view_id); |
47 } | 30 } |
48 | 31 |
49 } // namespace | 32 } // namespace |
50 | 33 |
51 namespace content { | |
52 | |
53 void AssociateURLFetcherWithRenderView(net::URLFetcher* url_fetcher, | 34 void AssociateURLFetcherWithRenderView(net::URLFetcher* url_fetcher, |
54 const GURL& first_party_for_cookies, | 35 const GURL& first_party_for_cookies, |
55 int render_process_id, | 36 int render_process_id, |
56 int render_view_id) { | 37 int render_view_id) { |
57 url_fetcher->SetFirstPartyForCookies(first_party_for_cookies); | 38 url_fetcher->SetFirstPartyForCookies(first_party_for_cookies); |
58 url_fetcher->SetURLRequestUserData( | 39 url_fetcher->SetURLRequestUserData( |
59 URLRequestUserData::kUserDataKey, | 40 URLRequestUserData::kUserDataKey, |
60 base::Bind(&CreateURLRequestUserData, | 41 base::Bind(&CreateURLRequestUserData, |
61 render_process_id, render_view_id)); | 42 render_process_id, render_view_id)); |
62 } | 43 } |
63 | 44 |
64 } // namespace content | 45 } // namespace content |
OLD | NEW |