OLD | NEW |
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/common/net/url_fetcher_impl.h" | 5 #include "content/common/net/url_fetcher_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "content/common/net/url_fetcher_core.h" | 9 #include "content/common/net/url_fetcher_core.h" |
10 #include "content/common/net/url_request_user_data.h" | 10 #include "content/common/net/url_request_user_data.h" |
11 #include "content/public/common/url_fetcher_factory.h" | 11 #include "content/public/common/url_fetcher_factory.h" |
12 | 12 |
13 static content::URLFetcherFactory* g_factory = NULL; | 13 static content::URLFetcherFactory* g_factory = NULL; |
14 | 14 |
15 // static | 15 // static |
16 content::URLFetcher* content::URLFetcher::Create( | 16 content::URLFetcher* content::URLFetcher::Create( |
17 const GURL& url, | 17 const GURL& url, |
18 RequestType request_type, | 18 RequestType request_type, |
19 content::URLFetcherDelegate* d) { | 19 net::URLFetcherDelegate* d) { |
20 return new URLFetcherImpl(url, request_type, d); | 20 return new URLFetcherImpl(url, request_type, d); |
21 } | 21 } |
22 | 22 |
23 // static | 23 // static |
24 content::URLFetcher* content::URLFetcher::Create( | 24 content::URLFetcher* content::URLFetcher::Create( |
25 int id, | 25 int id, |
26 const GURL& url, | 26 const GURL& url, |
27 RequestType request_type, | 27 RequestType request_type, |
28 content::URLFetcherDelegate* d) { | 28 net::URLFetcherDelegate* d) { |
29 return g_factory ? g_factory->CreateURLFetcher(id, url, request_type, d) : | 29 return g_factory ? g_factory->CreateURLFetcher(id, url, request_type, d) : |
30 new URLFetcherImpl(url, request_type, d); | 30 new URLFetcherImpl(url, request_type, d); |
31 } | 31 } |
32 | 32 |
33 // static | 33 // static |
34 void content::URLFetcher::CancelAll() { | 34 void content::URLFetcher::CancelAll() { |
35 URLFetcherImpl::CancelAll(); | 35 URLFetcherImpl::CancelAll(); |
36 } | 36 } |
37 | 37 |
38 // static | 38 // static |
(...skipping 21 matching lines...) Expand all Loading... |
60 url_fetcher->SetURLRequestUserData( | 60 url_fetcher->SetURLRequestUserData( |
61 URLRequestUserData::kUserDataKey, | 61 URLRequestUserData::kUserDataKey, |
62 base::Bind(&CreateURLRequestUserData, | 62 base::Bind(&CreateURLRequestUserData, |
63 render_process_id, render_view_id)); | 63 render_process_id, render_view_id)); |
64 } | 64 } |
65 | 65 |
66 } // namespace content | 66 } // namespace content |
67 | 67 |
68 URLFetcherImpl::URLFetcherImpl(const GURL& url, | 68 URLFetcherImpl::URLFetcherImpl(const GURL& url, |
69 RequestType request_type, | 69 RequestType request_type, |
70 content::URLFetcherDelegate* d) | 70 net::URLFetcherDelegate* d) |
71 : ALLOW_THIS_IN_INITIALIZER_LIST( | 71 : ALLOW_THIS_IN_INITIALIZER_LIST( |
72 core_(new content::URLFetcherCore(this, url, request_type, d))) { | 72 core_(new content::URLFetcherCore(this, url, request_type, d))) { |
73 } | 73 } |
74 | 74 |
75 URLFetcherImpl::~URLFetcherImpl() { | 75 URLFetcherImpl::~URLFetcherImpl() { |
76 core_->Stop(); | 76 core_->Stop(); |
77 } | 77 } |
78 | 78 |
79 void URLFetcherImpl::SetUploadData(const std::string& upload_content_type, | 79 void URLFetcherImpl::SetUploadData(const std::string& upload_content_type, |
80 const std::string& upload_content) { | 80 const std::string& upload_content) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // static | 220 // static |
221 void URLFetcherImpl::CancelAll() { | 221 void URLFetcherImpl::CancelAll() { |
222 content::URLFetcherCore::CancelAll(); | 222 content::URLFetcherCore::CancelAll(); |
223 } | 223 } |
224 | 224 |
225 // static | 225 // static |
226 int URLFetcherImpl::GetNumFetcherCores() { | 226 int URLFetcherImpl::GetNumFetcherCores() { |
227 return content::URLFetcherCore::GetNumFetcherCores(); | 227 return content::URLFetcherCore::GetNumFetcherCores(); |
228 } | 228 } |
229 | 229 |
230 content::URLFetcherDelegate* URLFetcherImpl::delegate() const { | 230 net::URLFetcherDelegate* URLFetcherImpl::delegate() const { |
231 return core_->delegate(); | 231 return core_->delegate(); |
232 } | 232 } |
233 | 233 |
234 // static | 234 // static |
235 content::URLFetcherFactory* URLFetcherImpl::factory() { | 235 content::URLFetcherFactory* URLFetcherImpl::factory() { |
236 return g_factory; | 236 return g_factory; |
237 } | 237 } |
238 | 238 |
239 // static | 239 // static |
240 void URLFetcherImpl::set_factory(content::URLFetcherFactory* factory) { | 240 void URLFetcherImpl::set_factory(content::URLFetcherFactory* factory) { |
241 g_factory = factory; | 241 g_factory = factory; |
242 } | 242 } |
OLD | NEW |