diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-25 01:11:15 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-25 01:11:15 +0000 |
commit | 56ed95aa44b76b41ba561237ab9c586830639b3b (patch) | |
tree | 2d621f21b57e29f5632928013488f3aab99f9fcc | |
parent | a5c6529a3be77f1c0c6e87917172d60323e97233 (diff) | |
download | chromium_src-56ed95aa44b76b41ba561237ab9c586830639b3b.zip chromium_src-56ed95aa44b76b41ba561237ab9c586830639b3b.tar.gz chromium_src-56ed95aa44b76b41ba561237ab9c586830639b3b.tar.bz2 |
Move URLFetcherFactory from content to net
BUG=118220
TEST=
TBR=jam@chromium.org,jhawkins@chromium.org,mnissler@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10438002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138956 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/policy/testing_policy_url_fetcher_factory.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc | 2 | ||||
-rw-r--r-- | chrome/common/net/gaia/gaia_oauth_client_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/common/net/gaia/mock_url_fetcher_factory.h | 2 | ||||
-rw-r--r-- | chrome/common/net/gaia/oauth2_access_token_fetcher_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/common/net/gaia/oauth2_api_call_flow_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/common/net/gaia/oauth2_mint_token_fetcher_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/common/net/gaia/oauth2_revocation_fetcher_unittest.cc | 4 | ||||
-rw-r--r-- | content/common/net/url_fetcher_impl.cc | 8 | ||||
-rw-r--r-- | content/common/net/url_fetcher_impl.h | 9 | ||||
-rw-r--r-- | content/content_common.gypi | 1 | ||||
-rw-r--r-- | content/test/test_url_fetcher_factory.cc | 4 | ||||
-rw-r--r-- | content/test/test_url_fetcher_factory.h | 14 | ||||
-rw-r--r-- | net/net.gyp | 2 | ||||
-rw-r--r-- | net/url_request/url_fetcher_factory.cc | 11 | ||||
-rw-r--r-- | net/url_request/url_fetcher_factory.h (renamed from content/public/common/url_fetcher_factory.h) | 22 |
16 files changed, 54 insertions, 41 deletions
diff --git a/chrome/browser/policy/testing_policy_url_fetcher_factory.h b/chrome/browser/policy/testing_policy_url_fetcher_factory.h index b2907ce..d731ace 100644 --- a/chrome/browser/policy/testing_policy_url_fetcher_factory.h +++ b/chrome/browser/policy/testing_policy_url_fetcher_factory.h @@ -33,7 +33,7 @@ struct TestURLResponse { // Creates mock URLFetchers whose behavior can be controlled in tests. To do so // set mock expectations on the method |Intercept|. -class TestingPolicyURLFetcherFactory : public content::URLFetcherFactory, +class TestingPolicyURLFetcherFactory : public net::URLFetcherFactory, public ScopedURLFetcherFactory { public: explicit TestingPolicyURLFetcherFactory(EventLogger* logger); diff --git a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc index c26f990..5a53b57 100644 --- a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc +++ b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc @@ -76,7 +76,7 @@ const char kCWSResponseResultFormat[] = const char kCWSFakeIconURLFormat[] = "http://example.com/%s/icon.png"; -class DummyURLFetcherFactory : public content::URLFetcherFactory { +class DummyURLFetcherFactory : public net::URLFetcherFactory { public: DummyURLFetcherFactory() {} virtual ~DummyURLFetcherFactory() {} diff --git a/chrome/common/net/gaia/gaia_oauth_client_unittest.cc b/chrome/common/net/gaia/gaia_oauth_client_unittest.cc index 885589ec..e5cebf0 100644 --- a/chrome/common/net/gaia/gaia_oauth_client_unittest.cc +++ b/chrome/common/net/gaia/gaia_oauth_client_unittest.cc @@ -64,7 +64,7 @@ class MockOAuthFetcher : public TestURLFetcher { DISALLOW_COPY_AND_ASSIGN(MockOAuthFetcher); }; -class MockOAuthFetcherFactory : public content::URLFetcherFactory, +class MockOAuthFetcherFactory : public net::URLFetcherFactory, public ScopedURLFetcherFactory { public: MockOAuthFetcherFactory() diff --git a/chrome/common/net/gaia/mock_url_fetcher_factory.h b/chrome/common/net/gaia/mock_url_fetcher_factory.h index ec403f5..351a72a 100644 --- a/chrome/common/net/gaia/mock_url_fetcher_factory.h +++ b/chrome/common/net/gaia/mock_url_fetcher_factory.h @@ -41,7 +41,7 @@ class MockFetcher : public TestURLFetcher { }; template<typename T> -class MockURLFetcherFactory : public content::URLFetcherFactory, +class MockURLFetcherFactory : public net::URLFetcherFactory, public ScopedURLFetcherFactory { public: MockURLFetcherFactory() diff --git a/chrome/common/net/gaia/oauth2_access_token_fetcher_unittest.cc b/chrome/common/net/gaia/oauth2_access_token_fetcher_unittest.cc index 585a9aa..dbdd7ad 100644 --- a/chrome/common/net/gaia/oauth2_access_token_fetcher_unittest.cc +++ b/chrome/common/net/gaia/oauth2_access_token_fetcher_unittest.cc @@ -14,22 +14,22 @@ #include "chrome/common/net/gaia/oauth2_access_token_fetcher.h" #include "chrome/test/base/testing_profile.h" #include "content/public/common/url_fetcher.h" -#include "content/public/common/url_fetcher_factory.h" #include "content/test/test_browser_thread.h" #include "content/test/test_url_fetcher_factory.h" #include "googleurl/src/gurl.h" #include "net/http/http_status_code.h" #include "net/url_request/url_fetcher_delegate.h" +#include "net/url_request/url_fetcher_factory.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_status.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; -using content::URLFetcherFactory; using net::ResponseCookies; using net::URLFetcher; using net::URLFetcherDelegate; +using net::URLFetcherFactory; using net::URLRequestStatus; using testing::_; using testing::Return; diff --git a/chrome/common/net/gaia/oauth2_api_call_flow_unittest.cc b/chrome/common/net/gaia/oauth2_api_call_flow_unittest.cc index f246558..c501aa1 100644 --- a/chrome/common/net/gaia/oauth2_api_call_flow_unittest.cc +++ b/chrome/common/net/gaia/oauth2_api_call_flow_unittest.cc @@ -15,20 +15,20 @@ #include "chrome/common/net/gaia/oauth2_api_call_flow.h" #include "chrome/test/base/testing_profile.h" #include "content/public/common/url_fetcher.h" -#include "content/public/common/url_fetcher_factory.h" #include "content/test/test_url_fetcher_factory.h" #include "net/http/http_request_headers.h" #include "net/http/http_status_code.h" #include "net/url_request/url_fetcher_delegate.h" +#include "net/url_request/url_fetcher_factory.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_status.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using content::URLFetcherFactory; using net::HttpRequestHeaders; using net::URLFetcher; using net::URLFetcherDelegate; +using net::URLFetcherFactory; using net::URLRequestStatus; using testing::_; using testing::Return; diff --git a/chrome/common/net/gaia/oauth2_mint_token_fetcher_unittest.cc b/chrome/common/net/gaia/oauth2_mint_token_fetcher_unittest.cc index cfc3c1e..2546b0f 100644 --- a/chrome/common/net/gaia/oauth2_mint_token_fetcher_unittest.cc +++ b/chrome/common/net/gaia/oauth2_mint_token_fetcher_unittest.cc @@ -15,22 +15,22 @@ #include "chrome/common/net/gaia/oauth2_mint_token_fetcher.h" #include "chrome/test/base/testing_profile.h" #include "content/public/common/url_fetcher.h" -#include "content/public/common/url_fetcher_factory.h" #include "content/test/test_browser_thread.h" #include "content/test/test_url_fetcher_factory.h" #include "googleurl/src/gurl.h" #include "net/http/http_status_code.h" #include "net/url_request/url_fetcher_delegate.h" +#include "net/url_request/url_fetcher_factory.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_status.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; -using content::URLFetcherFactory; using net::ResponseCookies; using net::URLFetcher; using net::URLFetcherDelegate; +using net::URLFetcherFactory; using net::URLRequestStatus; using testing::_; using testing::Return; diff --git a/chrome/common/net/gaia/oauth2_revocation_fetcher_unittest.cc b/chrome/common/net/gaia/oauth2_revocation_fetcher_unittest.cc index 0f64092..9054c49e 100644 --- a/chrome/common/net/gaia/oauth2_revocation_fetcher_unittest.cc +++ b/chrome/common/net/gaia/oauth2_revocation_fetcher_unittest.cc @@ -14,12 +14,12 @@ #include "chrome/common/net/gaia/oauth2_revocation_fetcher.h" #include "chrome/test/base/testing_profile.h" #include "content/public/common/url_fetcher.h" -#include "content/public/common/url_fetcher_factory.h" #include "content/test/test_browser_thread.h" #include "content/test/test_url_fetcher_factory.h" #include "googleurl/src/gurl.h" #include "net/http/http_status_code.h" #include "net/url_request/url_fetcher_delegate.h" +#include "net/url_request/url_fetcher_factory.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_status.h" #include "testing/gmock/include/gmock/gmock.h" @@ -28,7 +28,7 @@ using content::BrowserThread; using net::URLFetcher; using net::URLFetcherDelegate; -using content::URLFetcherFactory; +using net::URLFetcherFactory; using net::ResponseCookies; using net::URLRequestStatus; using testing::_; diff --git a/content/common/net/url_fetcher_impl.cc b/content/common/net/url_fetcher_impl.cc index c0709f5..4ed60b3 100644 --- a/content/common/net/url_fetcher_impl.cc +++ b/content/common/net/url_fetcher_impl.cc @@ -8,9 +8,9 @@ #include "base/message_loop_proxy.h" #include "content/common/net/url_fetcher_core.h" #include "content/common/net/url_request_user_data.h" -#include "content/public/common/url_fetcher_factory.h" +#include "net/url_request/url_fetcher_factory.h" -static content::URLFetcherFactory* g_factory = NULL; +static net::URLFetcherFactory* g_factory = NULL; // static net::URLFetcher* content::URLFetcher::Create( @@ -232,11 +232,11 @@ net::URLFetcherDelegate* URLFetcherImpl::delegate() const { } // static -content::URLFetcherFactory* URLFetcherImpl::factory() { +net::URLFetcherFactory* URLFetcherImpl::factory() { return g_factory; } // static -void URLFetcherImpl::set_factory(content::URLFetcherFactory* factory) { +void URLFetcherImpl::set_factory(net::URLFetcherFactory* factory) { g_factory = factory; } diff --git a/content/common/net/url_fetcher_impl.h b/content/common/net/url_fetcher_impl.h index 9fb9776..f661012 100644 --- a/content/common/net/url_fetcher_impl.h +++ b/content/common/net/url_fetcher_impl.h @@ -23,9 +23,12 @@ namespace content { class URLFetcherCore; class URLFetcherDelegate; -class URLFetcherFactory; } // namespace content +namespace net { +class URLFetcherFactory; +} // namespace net + class CONTENT_EXPORT URLFetcherImpl : public net::URLFetcher { public: // |url| is the URL to send the request to. @@ -100,14 +103,14 @@ class CONTENT_EXPORT URLFetcherImpl : public net::URLFetcher { // actively running. static int GetNumFetcherCores(); - static content::URLFetcherFactory* factory(); + static net::URLFetcherFactory* factory(); // Sets the factory used by the static method Create to create a URLFetcher. // URLFetcher does not take ownership of |factory|. A value of NULL results // in a URLFetcher being created directly. // // NOTE: for safety, this should only be used through ScopedURLFetcherFactory! - static void set_factory(content::URLFetcherFactory* factory); + static void set_factory(net::URLFetcherFactory* factory); const scoped_refptr<content::URLFetcherCore> core_; diff --git a/content/content_common.gypi b/content/content_common.gypi index b28ea1f..abed985 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -92,7 +92,6 @@ 'public/common/url_constants.h', 'public/common/url_fetcher.h', 'public/common/url_fetcher_delegate.h', - 'public/common/url_fetcher_factory.h', 'public/common/zygote_fork_delegate_linux.h', 'common/accessibility_messages.h', 'common/appcache/appcache_backend_proxy.cc', diff --git a/content/test/test_url_fetcher_factory.cc b/content/test/test_url_fetcher_factory.cc index d61b46d..00f9eda 100644 --- a/content/test/test_url_fetcher_factory.cc +++ b/content/test/test_url_fetcher_factory.cc @@ -17,7 +17,7 @@ #include "net/url_request/url_request_status.h" ScopedURLFetcherFactory::ScopedURLFetcherFactory( - content::URLFetcherFactory* factory) { + net::URLFetcherFactory* factory) { DCHECK(!URLFetcherImpl::factory()); URLFetcherImpl::set_factory(factory); } @@ -290,7 +290,7 @@ FakeURLFetcherFactory::FakeURLFetcherFactory() } FakeURLFetcherFactory::FakeURLFetcherFactory( - content::URLFetcherFactory* default_factory) + net::URLFetcherFactory* default_factory) : ScopedURLFetcherFactory(ALLOW_THIS_IN_INITIALIZER_LIST(this)), default_factory_(default_factory) { } diff --git a/content/test/test_url_fetcher_factory.h b/content/test/test_url_fetcher_factory.h index 86036fc..e508a35 100644 --- a/content/test/test_url_fetcher_factory.h +++ b/content/test/test_url_fetcher_factory.h @@ -12,16 +12,16 @@ #include <utility> #include "base/threading/non_thread_safe.h" -#include "content/public/common/url_fetcher_factory.h" #include "googleurl/src/gurl.h" #include "net/http/http_request_headers.h" +#include "net/url_request/url_fetcher_factory.h" #include "net/url_request/url_request_status.h" // Changes URLFetcher's Factory for the lifetime of the object. // Note that this scoper cannot be nested (to make it even harder to misuse). class ScopedURLFetcherFactory : public base::NonThreadSafe { public: - explicit ScopedURLFetcherFactory(content::URLFetcherFactory* factory); + explicit ScopedURLFetcherFactory(net::URLFetcherFactory* factory); virtual ~ScopedURLFetcherFactory(); private: @@ -180,7 +180,7 @@ class TestURLFetcher : public net::URLFetcher { // Simple URLFetcherFactory method that creates TestURLFetchers. All fetchers // are registered in a map by the id passed to the create method. -class TestURLFetcherFactory : public content::URLFetcherFactory, +class TestURLFetcherFactory : public net::URLFetcherFactory, public ScopedURLFetcherFactory { public: TestURLFetcherFactory(); @@ -234,13 +234,13 @@ class TestURLFetcherFactory : public content::URLFetcherFactory, // SomeService service; // service.Run(); // Will eventually request these two URLs. -class FakeURLFetcherFactory : public content::URLFetcherFactory, +class FakeURLFetcherFactory : public net::URLFetcherFactory, public ScopedURLFetcherFactory { public: FakeURLFetcherFactory(); // FakeURLFetcherFactory that will delegate creating URLFetcher for unknown // url to the given factory. - explicit FakeURLFetcherFactory(content::URLFetcherFactory* default_factory); + explicit FakeURLFetcherFactory(net::URLFetcherFactory* default_factory); virtual ~FakeURLFetcherFactory(); // If no fake response is set for the given URL this method will delegate the @@ -267,7 +267,7 @@ class FakeURLFetcherFactory : public content::URLFetcherFactory, private: typedef std::map<GURL, std::pair<std::string, bool> > FakeResponseMap; FakeResponseMap fake_responses_; - content::URLFetcherFactory* default_factory_; + net::URLFetcherFactory* default_factory_; DISALLOW_COPY_AND_ASSIGN(FakeURLFetcherFactory); }; @@ -276,7 +276,7 @@ class FakeURLFetcherFactory : public content::URLFetcherFactory, // URLFetcherImpl. It can be use in conjunction with a FakeURLFetcherFactory in // integration tests to control the behavior of some requests but execute // all the other ones. -class URLFetcherImplFactory : public content::URLFetcherFactory { +class URLFetcherImplFactory : public net::URLFetcherFactory { public: URLFetcherImplFactory(); virtual ~URLFetcherImplFactory(); diff --git a/net/net.gyp b/net/net.gyp index 9178ba4..ccd8d06 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -722,6 +722,8 @@ 'url_request/url_fetcher.h', 'url_request/url_fetcher_delegate.cc', 'url_request/url_fetcher_delegate.h', + 'url_request/url_fetcher_factory.cc', + 'url_request/url_fetcher_factory.h', 'url_request/url_request.cc', 'url_request/url_request.h', 'url_request/url_request_about_job.cc', diff --git a/net/url_request/url_fetcher_factory.cc b/net/url_request/url_fetcher_factory.cc new file mode 100644 index 0000000..9335e7c --- /dev/null +++ b/net/url_request/url_fetcher_factory.cc @@ -0,0 +1,11 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/url_request/url_fetcher_factory.h" + +namespace net { + +URLFetcherFactory::~URLFetcherFactory() {} + +} // namespace net diff --git a/content/public/common/url_fetcher_factory.h b/net/url_request/url_fetcher_factory.h index 5e8b890..77108b6 100644 --- a/content/public/common/url_fetcher_factory.h +++ b/net/url_request/url_fetcher_factory.h @@ -2,32 +2,30 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_PUBLIC_COMMON_URL_FETCHER_FACTORY_H_ -#define CONTENT_PUBLIC_COMMON_URL_FETCHER_FACTORY_H_ +#ifndef NET_URL_REQUEST_URL_FETCHER_FACTORY_H_ +#define NET_URL_REQUEST_URL_FETCHER_FACTORY_H_ #pragma once +#include "net/base/net_export.h" #include "net/url_request/url_fetcher.h" namespace net { class URLFetcherDelegate; -} // namespace net - -namespace content { // URLFetcher::Create uses the currently registered Factory to create the // URLFetcher. Factory is intended for testing. -class URLFetcherFactory { +class NET_EXPORT URLFetcherFactory { public: - virtual net::URLFetcher* CreateURLFetcher( + virtual URLFetcher* CreateURLFetcher( int id, const GURL& url, - net::URLFetcher::RequestType request_type, - net::URLFetcherDelegate* d) = 0; + URLFetcher::RequestType request_type, + URLFetcherDelegate* d) = 0; protected: - virtual ~URLFetcherFactory() {} + virtual ~URLFetcherFactory(); }; -} // namespace content +} // namespace net -#endif // CONTENT_PUBLIC_COMMON_URL_FETCHER_FACTORY_H_ +#endif // NET_URL_REQUEST_URL_FETCHER_FACTORY_H_ |