Chromium Code Reviews| Index: content/common/net/url_fetcher.cc |
| =================================================================== |
| --- content/common/net/url_fetcher.cc (revision 107268) |
| +++ content/common/net/url_fetcher.cc (working copy) |
| @@ -19,6 +19,7 @@ |
| #include "base/string_util.h" |
| #include "base/threading/thread.h" |
| #include "content/public/common/url_fetcher_delegate.h" |
| +#include "content/public/common/url_fetcher_factory.h" |
| #include "googleurl/src/gurl.h" |
| #include "net/base/host_port_pair.h" |
| #include "net/base/io_buffer.h" |
| @@ -463,7 +464,7 @@ |
| } |
| // static |
| -URLFetcher::Factory* URLFetcher::factory_ = NULL; |
| +static content::URLFetcherFactory* g_factory = NULL; |
|
wtc
2011/10/26 23:34:46
Remove the "// static" comment on the previous lin
wtc
2011/10/27 21:29:16
Just wondering: why did you change this static mem
jam
2011/10/27 22:34:41
because now I need to use it from the static conte
|
| // static |
| static bool g_interception_enabled = false; |
| @@ -482,7 +483,8 @@ |
| const GURL& url, |
| RequestType request_type, |
| content::URLFetcherDelegate* d) { |
| - return ::URLFetcher::Create(id, url, request_type, d); |
| + return g_factory ? g_factory->CreateURLFetcher(id, url, request_type, d) : |
| + new ::URLFetcher(url, request_type, d); |
| } |
| // static |
| @@ -507,14 +509,6 @@ |
| core_->Stop(); |
| } |
| -// static |
| -URLFetcher* URLFetcher::Create(int id, const GURL& url, |
| - RequestType request_type, |
| - content::URLFetcherDelegate* d) { |
| - return factory_ ? factory_->CreateURLFetcher(id, url, request_type, d) : |
| - new URLFetcher(url, request_type, d); |
| -} |
| - |
| URLFetcher::Core::Core(URLFetcher* fetcher, |
| const GURL& original_url, |
| RequestType request_type, |
| @@ -989,11 +983,6 @@ |
| return core_->backoff_delay_; |
| } |
| -void URLFetcher::SetBackoffDelayForTesting( |
| - base::TimeDelta backoff_delay) { |
| - core_->backoff_delay_ = backoff_delay; |
| -} |
| - |
| void URLFetcher::SaveResponseToTemporaryFile( |
| scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy) { |
| core_->file_message_loop_proxy_ = file_message_loop_proxy; |
| @@ -1082,16 +1071,6 @@ |
| return true; |
| } |
| -void URLFetcher::SetResponseDestinationForTesting( |
| - ResponseDestinationType value) { |
| - core_->response_destination_ = value; |
| -} |
| - |
| -URLFetcher::ResponseDestinationType |
| -URLFetcher::GetResponseDestinationForTesting() const { |
| - return core_->response_destination_; |
| -} |
| - |
| bool URLFetcher::GetResponseAsFilePath(bool take_ownership, |
| FilePath* out_response_path) const { |
| DCHECK(core_->delegate_loop_proxy_->BelongsToCurrentThread()); |
| @@ -1121,3 +1100,13 @@ |
| content::URLFetcherDelegate* URLFetcher::delegate() const { |
| return core_->delegate(); |
| } |
| + |
| +// static |
| +content::URLFetcherFactory* URLFetcher::factory() { |
| + return g_factory; |
| +} |
| + |
| +// static |
| +void URLFetcher::set_factory(content::URLFetcherFactory* factory) { |
| + g_factory = factory; |
| +} |