diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-27 04:23:46 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-27 04:23:46 +0000 |
commit | 7b419b87571595cb0046247cb71856511cefe13d (patch) | |
tree | 1244bb31f4d935a4dad4fa94df49f3537d36ae3f | |
parent | 6b3b4806a6ee8c88819add0ca1a19279a969c664 (diff) | |
download | chromium_src-7b419b87571595cb0046247cb71856511cefe13d.zip chromium_src-7b419b87571595cb0046247cb71856511cefe13d.tar.gz chromium_src-7b419b87571595cb0046247cb71856511cefe13d.tar.bz2 |
Rename URLFetcher to be URLFetcherImpl, now that we have the content::URLFetcher interface.
BUG=98716
Review URL: http://codereview.chromium.org/8403017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107531 0039d316-1c4b-4281-b951-d872f2087c98
33 files changed, 199 insertions, 197 deletions
diff --git a/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc b/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc index 6405e77..75b0cf6 100644 --- a/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc +++ b/chrome/browser/chromeos/login/cookie_fetcher_unittest.cc @@ -13,7 +13,7 @@ #include "chrome/common/net/gaia/gaia_urls.h" #include "chrome/test/base/testing_profile.h" #include "content/browser/browser_thread.h" -#include "content/common/net/url_fetcher.h" +#include "content/public/common/url_fetcher.h" #include "googleurl/src/gurl.h" #include "net/url_request/url_request_status.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/chrome/browser/chromeos/login/google_authenticator_unittest.cc b/chrome/browser/chromeos/login/google_authenticator_unittest.cc index a43eaf4..19d1d3f 100644 --- a/chrome/browser/chromeos/login/google_authenticator_unittest.cc +++ b/chrome/browser/chromeos/login/google_authenticator_unittest.cc @@ -29,7 +29,6 @@ #include "chrome/common/net/gaia/gaia_urls.h" #include "chrome/test/base/testing_profile.h" #include "content/browser/browser_thread.h" -#include "content/common/net/url_fetcher.h" #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" #include "net/url_request/url_request_status.h" diff --git a/chrome/browser/chromeos/login/mock_auth_response_handler.cc b/chrome/browser/chromeos/login/mock_auth_response_handler.cc index f3805a3..c324709c 100644 --- a/chrome/browser/chromeos/login/mock_auth_response_handler.cc +++ b/chrome/browser/chromeos/login/mock_auth_response_handler.cc @@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/message_loop.h" -#include "content/common/net/url_fetcher.h" #include "content/public/common/url_fetcher_delegate.h" #include "content/test/test_url_fetcher_factory.h" #include "googleurl/src/gurl.h" @@ -44,7 +43,7 @@ void MockAuthResponseHandler::CompleteFetch( const net::URLRequestStatus status, const int http_response_code, const std::string data) { - TestURLFetcher fetcher(0, GURL(), URLFetcher::GET, delegate); + TestURLFetcher fetcher(0, GURL(), content::URLFetcher::GET, delegate); fetcher.set_url(remote); fetcher.set_status(status); fetcher.set_response_code(http_response_code); @@ -52,14 +51,15 @@ void MockAuthResponseHandler::CompleteFetch( delegate->OnURLFetchComplete(&fetcher); } -URLFetcher* MockAuthResponseHandler::MockNetwork( +content::URLFetcher* MockAuthResponseHandler::MockNetwork( std::string data, content::URLFetcherDelegate* delegate) { MessageLoop::current()->PostTask( FROM_HERE, base::Bind(MockAuthResponseHandler::CompleteFetch, delegate, remote_, status_, http_response_code_, data_)); - return new URLFetcher(GURL(), URLFetcher::GET, delegate); + return content::URLFetcher::Create( + GURL(), content::URLFetcher::GET, delegate); } } // namespace chromeos diff --git a/chrome/browser/chromeos/login/mock_auth_response_handler.h b/chrome/browser/chromeos/login/mock_auth_response_handler.h index d1c9a89..24ae0a6 100644 --- a/chrome/browser/chromeos/login/mock_auth_response_handler.h +++ b/chrome/browser/chromeos/login/mock_auth_response_handler.h @@ -14,7 +14,9 @@ #include "net/url_request/url_request_status.h" #include "testing/gmock/include/gmock/gmock.h" +namespace content { class URLFetcher; +} namespace chromeos { @@ -37,8 +39,8 @@ class MockAuthResponseHandler : public AuthResponseHandler { MOCK_METHOD2(Handle, content::URLFetcher*( const std::string& to_process, content::URLFetcherDelegate* catcher)); - URLFetcher* MockNetwork(std::string data, - content::URLFetcherDelegate* delegate); + content::URLFetcher* MockNetwork(std::string data, + content::URLFetcherDelegate* delegate); private: const GURL remote_; diff --git a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc index 38adbda..77ab2ce 100644 --- a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc +++ b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc @@ -26,7 +26,6 @@ #include "chrome/common/net/gaia/gaia_auth_fetcher_unittest.h" #include "chrome/test/base/testing_profile.h" #include "content/browser/browser_thread.h" -#include "content/common/net/url_fetcher.h" #include "googleurl/src/gurl.h" #include "net/base/net_errors.h" #include "net/url_request/url_request_status.h" diff --git a/chrome/browser/component_updater/component_updater_service_unittest.cc b/chrome/browser/component_updater/component_updater_service_unittest.cc index 4e72a32..35dca35 100644 --- a/chrome/browser/component_updater/component_updater_service_unittest.cc +++ b/chrome/browser/component_updater/component_updater_service_unittest.cc @@ -14,9 +14,9 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/test/base/test_url_request_context_getter.h" #include "content/browser/browser_thread.h" -#include "content/common/net/url_fetcher.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_service.h" +#include "content/public/common/url_fetcher.h" #include "content/test/test_notification_tracker.h" #include "googleurl/src/gurl.h" diff --git a/chrome/browser/extensions/extension_management_browsertest.cc b/chrome/browser/extensions/extension_management_browsertest.cc index 42dc428..41031e1 100644 --- a/chrome/browser/extensions/extension_management_browsertest.cc +++ b/chrome/browser/extensions/extension_management_browsertest.cc @@ -21,8 +21,8 @@ #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" #include "content/browser/renderer_host/render_view_host.h" -#include "content/common/net/url_fetcher.h" #include "content/public/browser/notification_service.h" +#include "content/public/common/url_fetcher.h" class ExtensionManagementTest : public ExtensionBrowserTest { protected: diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc index 39d1964..0c0359b 100644 --- a/chrome/browser/extensions/webstore_inline_installer.cc +++ b/chrome/browser/extensions/webstore_inline_installer.cc @@ -20,7 +20,7 @@ #include "chrome/common/extensions/url_pattern.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/utility_process_host.h" -#include "content/common/net/url_fetcher.h" +#include "content/public/common/url_fetcher.h" #include "net/base/escape.h" #include "net/base/load_flags.h" #include "net/url_request/url_request_status.h" diff --git a/chrome/browser/google/google_url_tracker_unittest.cc b/chrome/browser/google/google_url_tracker_unittest.cc index 9655868..18fd763 100644 --- a/chrome/browser/google/google_url_tracker_unittest.cc +++ b/chrome/browser/google/google_url_tracker_unittest.cc @@ -14,8 +14,8 @@ #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_pref_service.h" #include "content/browser/browser_thread.h" -#include "content/common/net/url_fetcher.h" #include "content/public/browser/notification_service.h" +#include "content/public/common/url_fetcher.h" #include "content/test/test_url_fetcher_factory.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context_getter.h" diff --git a/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc b/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc index 6a7a9ca..9f179d8 100644 --- a/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc +++ b/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc @@ -18,7 +18,6 @@ #include "chrome/common/net/gaia/google_service_auth_error.h" #include "chrome/common/net/http_return.h" #include "chrome/test/base/testing_profile.h" -#include "content/common/net/url_fetcher.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/test/test_url_fetcher_factory.h" @@ -161,7 +160,8 @@ TEST_F(GaiaOAuthFetcherTest, OAuthGetAccessToken) { net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); GURL url(GaiaUrls::GetInstance()->oauth_get_access_token_url()); - TestURLFetcher test_fetcher(0, GURL(), URLFetcher::GET, &oauth_fetcher); + TestURLFetcher test_fetcher( + 0, GURL(), content::URLFetcher::GET, &oauth_fetcher); test_fetcher.set_url(url); test_fetcher.set_status(status); test_fetcher.set_response_code(RC_REQUEST_OK); @@ -196,7 +196,8 @@ TEST_F(GaiaOAuthFetcherTest, OAuthWrapBridge) { net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); GURL url(GaiaUrls::GetInstance()->oauth_wrap_bridge_url()); - TestURLFetcher test_fetcher(0, GURL(), URLFetcher::GET, &oauth_fetcher); + TestURLFetcher test_fetcher( + 0, GURL(), content::URLFetcher::GET, &oauth_fetcher); test_fetcher.set_url(url); test_fetcher.set_status(status); test_fetcher.set_response_code(RC_REQUEST_OK); @@ -226,7 +227,8 @@ TEST_F(GaiaOAuthFetcherTest, UserInfo) { net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); GURL url(GaiaUrls::GetInstance()->oauth_user_info_url()); - TestURLFetcher test_fetcher(0, GURL(), URLFetcher::GET, &oauth_fetcher); + TestURLFetcher test_fetcher( + 0, GURL(), content::URLFetcher::GET, &oauth_fetcher); test_fetcher.set_url(url); test_fetcher.set_status(status); test_fetcher.set_response_code(RC_REQUEST_OK); @@ -251,7 +253,8 @@ TEST_F(GaiaOAuthFetcherTest, OAuthRevokeToken) { net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); GURL url(GaiaUrls::GetInstance()->oauth_revoke_token_url()); - TestURLFetcher test_fetcher(0, GURL(), URLFetcher::GET, &oauth_fetcher); + TestURLFetcher test_fetcher( + 0, GURL(), content::URLFetcher::GET, &oauth_fetcher); test_fetcher.set_url(url); test_fetcher.set_status(status); test_fetcher.set_response_code(RC_REQUEST_OK); diff --git a/chrome/browser/policy/cloud_policy_subsystem_unittest.cc b/chrome/browser/policy/cloud_policy_subsystem_unittest.cc index a201baf..d495fd0 100644 --- a/chrome/browser/policy/cloud_policy_subsystem_unittest.cc +++ b/chrome/browser/policy/cloud_policy_subsystem_unittest.cc @@ -20,7 +20,6 @@ #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_pref_service.h" #include "content/browser/browser_thread.h" -#include "content/common/net/url_fetcher.h" #include "policy/policy_constants.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/policy/device_management_service_browsertest.cc b/chrome/browser/policy/device_management_service_browsertest.cc index 5fcbac2..14e3415 100644 --- a/chrome/browser/policy/device_management_service_browsertest.cc +++ b/chrome/browser/policy/device_management_service_browsertest.cc @@ -9,7 +9,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" -#include "content/common/net/url_fetcher.h" +#include "content/public/common/url_fetcher.h" #include "net/test/test_server.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_test_job.h" @@ -90,7 +90,7 @@ static void QuitMessageLoop() { IN_PROC_BROWSER_TEST_F(DeviceManagementServiceIntegrationTest, CannedResponses) { - URLFetcher::SetEnableInterceptionForTests(true); + content::URLFetcher::SetEnableInterceptionForTests(true); DeviceManagementService service(kServiceUrl); service.ScheduleInitialization(0); scoped_ptr<DeviceManagementBackend> backend(service.CreateBackend()); diff --git a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc index de6a112..67d7b63 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc @@ -16,7 +16,6 @@ #include "chrome/common/safe_browsing/client_model.pb.h" #include "chrome/common/safe_browsing/csd.pb.h" #include "content/browser/browser_thread.h" -#include "content/common/net/url_fetcher.h" #include "content/test/test_url_fetcher_factory.h" #include "crypto/sha2.h" #include "googleurl/src/gurl.h" diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc index eee3cac..ff2cc23 100644 --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc @@ -17,7 +17,6 @@ #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "content/browser/browser_thread.h" #include "content/browser/download/download_item.h" -#include "content/common/net/url_fetcher.h" #include "content/public/common/url_fetcher_delegate.h" #include "content/test/test_url_fetcher_factory.h" #include "googleurl/src/gurl.h" diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc index 1e245ed..171b7b3 100644 --- a/chrome/browser/safe_browsing/safe_browsing_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_test.cc @@ -39,7 +39,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/browser_thread.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" -#include "content/common/net/url_fetcher.h" +#include "content/public/common/url_fetcher.h" #include "content/public/common/url_fetcher_delegate.h" #include "net/base/host_resolver.h" #include "net/base/load_flags.h" @@ -529,7 +529,8 @@ class SafeBrowsingServiceTestHelper // Fetch a URL. If message_loop_started is true, starts the message loop // so the caller could wait till OnURLFetchComplete is called. net::URLRequestStatus::Status FetchUrl(const GURL& url) { - url_fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this)); + url_fetcher_.reset(content::URLFetcher::Create( + url, content::URLFetcher::GET, this)); url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); url_fetcher_->SetRequestContext( Profile::Deprecated::GetDefaultRequestContext()); diff --git a/chrome/browser/sync/glue/sync_backend_host_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_unittest.cc index 261063e..906050b 100644 --- a/chrome/browser/sync/glue/sync_backend_host_unittest.cc +++ b/chrome/browser/sync/glue/sync_backend_host_unittest.cc @@ -15,7 +15,6 @@ #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/test_url_request_context_getter.h" #include "content/browser/browser_thread.h" -#include "content/common/net/url_fetcher.h" #include "content/test/test_url_fetcher_factory.h" #include "googleurl/src/gurl.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index cd2a343..33df944 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -35,7 +35,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/browser/browser_thread.h" #include "content/browser/tab_contents/tab_contents.h" -#include "content/common/net/url_fetcher.h" +#include "content/public/common/url_fetcher.h" #include "content/public/common/url_fetcher_delegate.h" #include "content/test/test_url_fetcher_factory.h" #include "googleurl/src/gurl.h" @@ -508,9 +508,10 @@ bool SyncTest::IsTestServerRunning() { std::string sync_url = cl->GetSwitchValueASCII(switches::kSyncServiceURL); GURL sync_url_status(sync_url.append("/healthz")); SyncServerStatusChecker delegate; - URLFetcher fetcher(sync_url_status, URLFetcher::GET, &delegate); - fetcher.SetRequestContext(Profile::Deprecated::GetDefaultRequestContext()); - fetcher.Start(); + scoped_ptr<content::URLFetcher> fetcher(content::URLFetcher::Create( + sync_url_status, content::URLFetcher::GET, &delegate)); + fetcher->SetRequestContext(Profile::Deprecated::GetDefaultRequestContext()); + fetcher->Start(); ui_test_utils::RunMessageLoop(); return delegate.running(); } diff --git a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc index bcef282..cf4be2c 100644 --- a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc +++ b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.cc @@ -17,7 +17,6 @@ #include "chrome/common/net/gaia/google_service_auth_error.h" #include "chrome/common/net/http_return.h" #include "chrome/test/base/testing_profile.h" -#include "content/common/net/url_fetcher.h" #include "content/public/common/url_fetcher_delegate.h" #include "content/test/test_url_fetcher_factory.h" #include "googleurl/src/gurl.h" @@ -185,7 +184,7 @@ TEST_F(GaiaAuthFetcherTest, LoginNetFailure) { MockFetcher mock_fetcher( client_login_source_, status, 0, net::ResponseCookies(), std::string(), - URLFetcher::GET, &auth); + content::URLFetcher::GET, &auth); auth.OnURLFetchComplete(&mock_fetcher); } @@ -205,7 +204,7 @@ TEST_F(GaiaAuthFetcherTest, TokenNetFailure) { MockFetcher mock_fetcher( issue_auth_token_source_, status, 0, cookies_, std::string(), - URLFetcher::GET, &auth); + content::URLFetcher::GET, &auth); auth.OnURLFetchComplete(&mock_fetcher); } @@ -226,7 +225,7 @@ TEST_F(GaiaAuthFetcherTest, LoginDenied) { MockFetcher mock_fetcher( client_login_source_, status, RC_FORBIDDEN, cookies_, data, - URLFetcher::GET, &auth); + content::URLFetcher::GET, &auth); auth.OnURLFetchComplete(&mock_fetcher); } @@ -274,7 +273,7 @@ TEST_F(GaiaAuthFetcherTest, OnlineLogin) { net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); MockFetcher mock_fetcher( client_login_source_, status, RC_REQUEST_OK, cookies_, data, - URLFetcher::GET, &auth); + content::URLFetcher::GET, &auth); auth.OnURLFetchComplete(&mock_fetcher); } @@ -288,7 +287,7 @@ TEST_F(GaiaAuthFetcherTest, WorkingIssueAuthToken) { net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); MockFetcher mock_fetcher( issue_auth_token_source_, status, RC_REQUEST_OK, cookies_, "token", - URLFetcher::GET, &auth); + content::URLFetcher::GET, &auth); auth.OnURLFetchComplete(&mock_fetcher); } @@ -320,7 +319,7 @@ TEST_F(GaiaAuthFetcherTest, TwoFactorLogin) { net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0); MockFetcher mock_fetcher( client_login_source_, status, RC_FORBIDDEN, cookies_, response, - URLFetcher::GET, &auth); + content::URLFetcher::GET, &auth); auth.OnURLFetchComplete(&mock_fetcher); } @@ -476,7 +475,7 @@ TEST_F(GaiaAuthFetcherTest, ClientFetchPending) { client_login_source_, net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), RC_REQUEST_OK, cookies_, "SID=sid\nLSID=lsid\nAuth=auth\n", - URLFetcher::GET, &auth); + content::URLFetcher::GET, &auth); auth.OnURLFetchComplete(&mock_fetcher); EXPECT_FALSE(auth.HasPendingFetch()); } @@ -498,7 +497,7 @@ TEST_F(GaiaAuthFetcherTest, FullTokenSuccess) { issue_auth_token_source_, net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), RC_REQUEST_OK, cookies_, "token", - URLFetcher::GET, &auth); + content::URLFetcher::GET, &auth); auth.OnURLFetchComplete(&mock_fetcher); EXPECT_FALSE(auth.HasPendingFetch()); } @@ -519,7 +518,7 @@ TEST_F(GaiaAuthFetcherTest, FullTokenFailure) { MockFetcher mock_fetcher( issue_auth_token_source_, net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), - RC_FORBIDDEN, cookies_, "", URLFetcher::GET, &auth); + RC_FORBIDDEN, cookies_, "", content::URLFetcher::GET, &auth); auth.OnURLFetchComplete(&mock_fetcher); EXPECT_FALSE(auth.HasPendingFetch()); } @@ -540,7 +539,8 @@ TEST_F(GaiaAuthFetcherTest, TokenAuthSuccess) { MockFetcher mock_fetcher( token_auth_source_, net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), - RC_REQUEST_OK, cookies_, "<html></html>", URLFetcher::GET, &auth); + RC_REQUEST_OK, cookies_, "<html></html>", content::URLFetcher::GET, + &auth); auth.OnURLFetchComplete(&mock_fetcher); EXPECT_FALSE(auth.HasPendingFetch()); } @@ -561,7 +561,7 @@ TEST_F(GaiaAuthFetcherTest, TokenAuthUnauthorizedFailure) { MockFetcher mock_fetcher( token_auth_source_, net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), - RC_UNAUTHORIZED, cookies_, "", URLFetcher::GET, &auth); + RC_UNAUTHORIZED, cookies_, "", content::URLFetcher::GET, &auth); auth.OnURLFetchComplete(&mock_fetcher); EXPECT_FALSE(auth.HasPendingFetch()); } @@ -582,7 +582,7 @@ TEST_F(GaiaAuthFetcherTest, TokenAuthNetFailure) { MockFetcher mock_fetcher( token_auth_source_, net::URLRequestStatus(net::URLRequestStatus::FAILED, 0), - RC_REQUEST_OK, cookies_, "", URLFetcher::GET, &auth); + RC_REQUEST_OK, cookies_, "", content::URLFetcher::GET, &auth); auth.OnURLFetchComplete(&mock_fetcher); EXPECT_FALSE(auth.HasPendingFetch()); } @@ -603,7 +603,8 @@ TEST_F(GaiaAuthFetcherTest, MergeSessionSuccess) { MockFetcher mock_fetcher( merge_session_source_, net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), - RC_REQUEST_OK, cookies_, "<html></html>", URLFetcher::GET, &auth); + RC_REQUEST_OK, cookies_, "<html></html>", content::URLFetcher::GET, + &auth); auth.OnURLFetchComplete(&mock_fetcher); EXPECT_FALSE(auth.HasPendingFetch()); } diff --git a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.h b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.h index 3e6173f..837063c 100644 --- a/chrome/common/net/gaia/gaia_auth_fetcher_unittest.h +++ b/chrome/common/net/gaia/gaia_auth_fetcher_unittest.h @@ -13,7 +13,6 @@ #include "chrome/common/net/gaia/gaia_auth_fetcher.h" #include "chrome/common/net/http_return.h" -#include "content/common/net/url_fetcher.h" #include "content/test/test_url_fetcher_factory.h" #include "net/url_request/url_request_status.h" diff --git a/chrome/common/net/gaia/gaia_oauth_client_unittest.cc b/chrome/common/net/gaia/gaia_oauth_client_unittest.cc index 593917f..20e41c0 100644 --- a/chrome/common/net/gaia/gaia_oauth_client_unittest.cc +++ b/chrome/common/net/gaia/gaia_oauth_client_unittest.cc @@ -12,7 +12,6 @@ #include "chrome/common/net/gaia/gaia_oauth_client.h" #include "chrome/common/net/http_return.h" #include "chrome/test/base/testing_profile.h" -#include "content/common/net/url_fetcher.h" #include "content/public/common/url_fetcher_delegate.h" #include "content/test/test_url_fetcher_factory.h" #include "googleurl/src/gurl.h" diff --git a/chrome/service/cloud_print/cloud_print_helpers.cc b/chrome/service/cloud_print/cloud_print_helpers.cc index 2477e66..492c46a 100644 --- a/chrome/service/cloud_print/cloud_print_helpers.cc +++ b/chrome/service/cloud_print/cloud_print_helpers.cc @@ -15,7 +15,6 @@ #include "base/values.h" #include "chrome/service/cloud_print/cloud_print_consts.h" #include "chrome/service/service_process.h" -#include "content/common/net/url_fetcher.h" std::string StringFromJobStatus(cloud_print::PrintJobStatus status) { std::string ret; diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher.cc b/chrome/service/cloud_print/cloud_print_url_fetcher.cc index 7dbaac9..d0cd004 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher.cc +++ b/chrome/service/cloud_print/cloud_print_url_fetcher.cc @@ -26,7 +26,7 @@ void CloudPrintURLFetcher::StartGetRequest( int max_retries, const std::string& additional_headers) { StartRequestHelper(url, - URLFetcher::GET, + content::URLFetcher::GET, delegate, max_retries, std::string(), @@ -42,7 +42,7 @@ void CloudPrintURLFetcher::StartPostRequest( const std::string& post_data, const std::string& additional_headers) { StartRequestHelper(url, - URLFetcher::POST, + content::URLFetcher::POST, delegate, max_retries, post_data_mime_type, @@ -131,14 +131,14 @@ void CloudPrintURLFetcher::StartRequestHelper( DCHECK(delegate); // Persist the additional headers in case we need to retry the request. additional_headers_ = additional_headers; - request_.reset(new URLFetcher(url, request_type, this)); + request_.reset(content::URLFetcher::Create(url, request_type, this)); request_->SetRequestContext(GetRequestContextGetter()); // Since we implement our own retry logic, disable the retry in URLFetcher. request_->SetAutomaticallyRetryOn5xx(false); request_->SetMaxRetries(max_retries); SetupRequestHeaders(); delegate_ = delegate; - if (request_type == URLFetcher::POST) { + if (request_type == content::URLFetcher::POST) { request_->SetUploadData(post_data_mime_type, post_data); } diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher.h b/chrome/service/cloud_print/cloud_print_url_fetcher.h index f76ba4c..17e538d 100644 --- a/chrome/service/cloud_print/cloud_print_url_fetcher.h +++ b/chrome/service/cloud_print/cloud_print_url_fetcher.h @@ -10,7 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "content/common/net/url_fetcher.h" +#include "content/public/common/url_fetcher.h" #include "content/public/common/url_fetcher_delegate.h" class GURL; diff --git a/chrome/service/gaia/service_gaia_authenticator.cc b/chrome/service/gaia/service_gaia_authenticator.cc index e743db4..5967729 100644 --- a/chrome/service/gaia/service_gaia_authenticator.cc +++ b/chrome/service/gaia/service_gaia_authenticator.cc @@ -7,7 +7,7 @@ #include "base/message_loop_proxy.h" #include "chrome/service/net/service_url_request_context.h" #include "chrome/service/service_process.h" -#include "content/common/net/url_fetcher.h" +#include "content/public/common/url_fetcher.h" #include "googleurl/src/gurl.h" ServiceGaiaAuthenticator::ServiceGaiaAuthenticator( @@ -64,7 +64,8 @@ int ServiceGaiaAuthenticator::GetBackoffDelaySeconds( void ServiceGaiaAuthenticator::DoPost(const GURL& post_url, const std::string& post_body) { DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); - URLFetcher* request = new URLFetcher(post_url, URLFetcher::POST, this); + content::URLFetcher* request = content::URLFetcher::Create( + post_url, content::URLFetcher::POST, this); request->SetRequestContext( g_service_process->GetServiceURLRequestContextGetter()); request->SetUploadData("application/x-www-form-urlencoded", post_body); diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index e763948..03c6296 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -25,7 +25,7 @@ #include "chrome/service/net/service_url_request_context.h" #include "chrome/service/service_ipc_server.h" #include "chrome/service/service_process_prefs.h" -#include "content/common/net/url_fetcher.h" +#include "content/public/common/url_fetcher.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "net/base/network_change_notifier.h" @@ -68,7 +68,7 @@ ServiceIOThread::~ServiceIOThread() { } void ServiceIOThread::CleanUp() { - URLFetcher::CancelAll(); + content::URLFetcher::CancelAll(); } // Prepares the localized strings that are going to be displayed to diff --git a/content/browser/geolocation/network_location_request.cc b/content/browser/geolocation/network_location_request.cc index eaefcf6..16fc446 100644 --- a/content/browser/geolocation/network_location_request.cc +++ b/content/browser/geolocation/network_location_request.cc @@ -12,7 +12,7 @@ #include "base/utf_string_conversions.h" #include "base/values.h" #include "content/common/geoposition.h" -#include "content/common/net/url_fetcher.h" +#include "content/common/net/url_fetcher_impl.h" #include "net/base/escape.h" #include "net/base/load_flags.h" #include "net/url_request/url_request_context_getter.h" @@ -87,8 +87,8 @@ bool NetworkLocationRequest::MakeRequest(const std::string& host_name, GURL request_url = FormRequestURL(url_.spec(), access_token, wifi_data, timestamp_); - url_fetcher_.reset(URLFetcher::Create( - url_fetcher_id_for_tests, request_url, URLFetcher::GET, this)); + url_fetcher_.reset(URLFetcherImpl::Create( + url_fetcher_id_for_tests, request_url, URLFetcherImpl::GET, this)); url_fetcher_->SetRequestContext(url_context_); url_fetcher_->SetLoadFlags( net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE | diff --git a/content/browser/speech/speech_recognition_request.cc b/content/browser/speech/speech_recognition_request.cc index e04b490..76e9cb2 100644 --- a/content/browser/speech/speech_recognition_request.cc +++ b/content/browser/speech/speech_recognition_request.cc @@ -10,7 +10,7 @@ #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/values.h" -#include "content/common/net/url_fetcher.h" +#include "content/common/net/url_fetcher_impl.h" #include "net/base/escape.h" #include "net/base/load_flags.h" #include "net/url_request/url_request_context.h" @@ -182,10 +182,10 @@ void SpeechRecognitionRequest::Start(const std::string& language, GURL url(std::string(kDefaultSpeechRecognitionUrl) + JoinString(parts, '&')); - url_fetcher_.reset(URLFetcher::Create(url_fetcher_id_for_tests, - url, - URLFetcher::POST, - this)); + url_fetcher_.reset(URLFetcherImpl::Create(url_fetcher_id_for_tests, + url, + URLFetcherImpl::POST, + this)); url_fetcher_->SetChunkedUpload(content_type); url_fetcher_->SetRequestContext(url_context_); url_fetcher_->SetReferrer(origin_url); diff --git a/content/common/net/url_fetcher.cc b/content/common/net/url_fetcher_impl.cc index 237f648..a7d2f52 100644 --- a/content/common/net/url_fetcher.cc +++ b/content/common/net/url_fetcher_impl.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/common/net/url_fetcher.h" +#include "content/common/net/url_fetcher_impl.h" #include <set> @@ -34,15 +34,15 @@ static const int kBufferSize = 4096; -class URLFetcher::Core - : public base::RefCountedThreadSafe<URLFetcher::Core>, +class URLFetcherImpl::Core + : public base::RefCountedThreadSafe<URLFetcherImpl::Core>, public net::URLRequest::Delegate { public: // For POST requests, set |content_type| to the MIME type of the content // and set |content| to the data to upload. |flags| are flags to apply to // the load operation--these should be one or more of the LOAD_* flags // defined in net/base/load_flags.h. - Core(URLFetcher* fetcher, + Core(URLFetcherImpl* fetcher, const GURL& original_url, RequestType request_type, content::URLFetcherDelegate* d); @@ -75,7 +75,7 @@ class URLFetcher::Core static void CancelAll(); private: - friend class base::RefCountedThreadSafe<URLFetcher::Core>; + friend class base::RefCountedThreadSafe<URLFetcherImpl::Core>; class Registry { public: @@ -106,7 +106,7 @@ class URLFetcher::Core class TempFileWriter { public: TempFileWriter( - URLFetcher::Core* core, + URLFetcherImpl::Core* core, scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy); ~TempFileWriter(); @@ -141,15 +141,15 @@ class URLFetcher::Core // Callback which gets the result of closing the temp file. void DidCloseTempFile(base::PlatformFileError error); - // The URLFetcher::Core which instantiated this class. - URLFetcher::Core* core_; + // The URLFetcherImpl::Core which instantiated this class. + URLFetcherImpl::Core* core_; // The last error encountered on a file operation. base::PLATFORM_FILE_OK // if no error occurred. base::PlatformFileError error_code_; // Callbacks are created for use with base::FileUtilProxy. - base::WeakPtrFactory<URLFetcher::Core::TempFileWriter> weak_factory_; + base::WeakPtrFactory<URLFetcherImpl::Core::TempFileWriter> weak_factory_; // Message loop on which file operations should happen. scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy_; @@ -216,7 +216,7 @@ class URLFetcher::Core // Drop ownership of any temp file managed by |temp_file_|. void DisownTempFile(); - URLFetcher* fetcher_; // Corresponding fetcher object + URLFetcherImpl* fetcher_; // Corresponding fetcher object GURL original_url_; // The URL we were asked to fetch GURL url_; // The URL we eventually wound up at RequestType request_type_; // What type of request is this? @@ -291,34 +291,34 @@ class URLFetcher::Core static base::LazyInstance<Registry> g_registry; - friend class URLFetcher; + friend class URLFetcherImpl; DISALLOW_COPY_AND_ASSIGN(Core); }; -URLFetcher::Core::Registry::Registry() {} -URLFetcher::Core::Registry::~Registry() {} +URLFetcherImpl::Core::Registry::Registry() {} +URLFetcherImpl::Core::Registry::~Registry() {} -void URLFetcher::Core::Registry::AddURLFetcherCore(Core* core) { +void URLFetcherImpl::Core::Registry::AddURLFetcherCore(Core* core) { DCHECK(!ContainsKey(fetchers_, core)); fetchers_.insert(core); } -void URLFetcher::Core::Registry::RemoveURLFetcherCore(Core* core) { +void URLFetcherImpl::Core::Registry::RemoveURLFetcherCore(Core* core) { DCHECK(ContainsKey(fetchers_, core)); fetchers_.erase(core); } -void URLFetcher::Core::Registry::CancelAll() { +void URLFetcherImpl::Core::Registry::CancelAll() { while (!fetchers_.empty()) (*fetchers_.begin())->CancelURLRequest(); } // static -base::LazyInstance<URLFetcher::Core::Registry> - URLFetcher::Core::g_registry(base::LINKER_INITIALIZED); +base::LazyInstance<URLFetcherImpl::Core::Registry> + URLFetcherImpl::Core::g_registry(base::LINKER_INITIALIZED); -URLFetcher::Core::TempFileWriter::TempFileWriter( - URLFetcher::Core* core, +URLFetcherImpl::Core::TempFileWriter::TempFileWriter( + URLFetcherImpl::Core* core, scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy) : core_(core), error_code_(base::PLATFORM_FILE_OK), @@ -327,21 +327,21 @@ URLFetcher::Core::TempFileWriter::TempFileWriter( temp_file_handle_(base::kInvalidPlatformFileValue) { } -URLFetcher::Core::TempFileWriter::~TempFileWriter() { +URLFetcherImpl::Core::TempFileWriter::~TempFileWriter() { RemoveTempFile(); } -void URLFetcher::Core::TempFileWriter::CreateTempFile() { +void URLFetcherImpl::Core::TempFileWriter::CreateTempFile() { DCHECK(core_->io_message_loop_proxy_->BelongsToCurrentThread()); CHECK(file_message_loop_proxy_.get()); base::FileUtilProxy::CreateTemporary( file_message_loop_proxy_, 0, // No additional file flags. - base::Bind(&URLFetcher::Core::TempFileWriter::DidCreateTempFile, + base::Bind(&URLFetcherImpl::Core::TempFileWriter::DidCreateTempFile, weak_factory_.GetWeakPtr())); } -void URLFetcher::Core::TempFileWriter::DidCreateTempFile( +void URLFetcherImpl::Core::TempFileWriter::DidCreateTempFile( base::PlatformFileError error_code, base::PassPlatformFile file_handle, FilePath file_path) { @@ -363,7 +363,7 @@ void URLFetcher::Core::TempFileWriter::DidCreateTempFile( FROM_HERE, base::Bind(&Core::StartURLRequestWhenAppropriate, core_)); } -void URLFetcher::Core::TempFileWriter::WriteBuffer(int num_bytes) { +void URLFetcherImpl::Core::TempFileWriter::WriteBuffer(int num_bytes) { DCHECK(core_->io_message_loop_proxy_->BelongsToCurrentThread()); // Start writing to the temp file by setting the initial state @@ -374,7 +374,7 @@ void URLFetcher::Core::TempFileWriter::WriteBuffer(int num_bytes) { ContinueWrite(base::PLATFORM_FILE_OK, 0); } -void URLFetcher::Core::TempFileWriter::ContinueWrite( +void URLFetcherImpl::Core::TempFileWriter::ContinueWrite( base::PlatformFileError error_code, int bytes_written) { DCHECK(core_->io_message_loop_proxy_->BelongsToCurrentThread()); @@ -396,7 +396,7 @@ void URLFetcher::Core::TempFileWriter::ContinueWrite( file_message_loop_proxy_, temp_file_handle_, total_bytes_written_, // Append to the end (core_->buffer_->data() + buffer_offset_), pending_bytes_, - base::Bind(&URLFetcher::Core::TempFileWriter::ContinueWrite, + base::Bind(&URLFetcherImpl::Core::TempFileWriter::ContinueWrite, weak_factory_.GetWeakPtr())); } else { // Finished writing core_->buffer_ to the file. Read some more. @@ -404,7 +404,7 @@ void URLFetcher::Core::TempFileWriter::ContinueWrite( } } -void URLFetcher::Core::TempFileWriter::DisownTempFile() { +void URLFetcherImpl::Core::TempFileWriter::DisownTempFile() { DCHECK(core_->io_message_loop_proxy_->BelongsToCurrentThread()); // Disowning is done by the delegate's OnURLFetchComplete method. @@ -415,19 +415,19 @@ void URLFetcher::Core::TempFileWriter::DisownTempFile() { temp_file_ = FilePath(); } -void URLFetcher::Core::TempFileWriter::CloseTempFileAndCompleteRequest() { +void URLFetcherImpl::Core::TempFileWriter::CloseTempFileAndCompleteRequest() { DCHECK(core_->io_message_loop_proxy_->BelongsToCurrentThread()); if (temp_file_handle_ != base::kInvalidPlatformFileValue) { base::FileUtilProxy::Close( file_message_loop_proxy_, temp_file_handle_, - base::Bind(&URLFetcher::Core::TempFileWriter::DidCloseTempFile, + base::Bind(&URLFetcherImpl::Core::TempFileWriter::DidCloseTempFile, weak_factory_.GetWeakPtr())); temp_file_handle_ = base::kInvalidPlatformFileValue; } } -void URLFetcher::Core::TempFileWriter::DidCloseTempFile( +void URLFetcherImpl::Core::TempFileWriter::DidCloseTempFile( base::PlatformFileError error_code) { DCHECK(core_->io_message_loop_proxy_->BelongsToCurrentThread()); @@ -443,7 +443,7 @@ void URLFetcher::Core::TempFileWriter::DidCloseTempFile( core_->RetryOrCompleteUrlFetch(); } -void URLFetcher::Core::TempFileWriter::RemoveTempFile() { +void URLFetcherImpl::Core::TempFileWriter::RemoveTempFile() { DCHECK(core_->io_message_loop_proxy_->BelongsToCurrentThread()); // Close the temp file if it is open. @@ -471,7 +471,7 @@ content::URLFetcher* content::URLFetcher::Create( const GURL& url, RequestType request_type, content::URLFetcherDelegate* d) { - return new ::URLFetcher(url, request_type, d); + return new URLFetcherImpl(url, request_type, d); } // static @@ -481,12 +481,12 @@ content::URLFetcher* content::URLFetcher::Create( RequestType request_type, content::URLFetcherDelegate* d) { return g_factory ? g_factory->CreateURLFetcher(id, url, request_type, d) : - new ::URLFetcher(url, request_type, d); + new URLFetcherImpl(url, request_type, d); } // static void content::URLFetcher::CancelAll() { - ::URLFetcher::CancelAll(); + URLFetcherImpl::CancelAll(); } // static @@ -495,21 +495,21 @@ void content::URLFetcher::SetEnableInterceptionForTests(bool enabled) { } -URLFetcher::URLFetcher(const GURL& url, - RequestType request_type, - content::URLFetcherDelegate* d) +URLFetcherImpl::URLFetcherImpl(const GURL& url, + RequestType request_type, + content::URLFetcherDelegate* d) : ALLOW_THIS_IN_INITIALIZER_LIST( core_(new Core(this, url, request_type, d))) { } -URLFetcher::~URLFetcher() { +URLFetcherImpl::~URLFetcherImpl() { core_->Stop(); } -URLFetcher::Core::Core(URLFetcher* fetcher, - const GURL& original_url, - RequestType request_type, - content::URLFetcherDelegate* d) +URLFetcherImpl::Core::Core(URLFetcherImpl* fetcher, + const GURL& original_url, + RequestType request_type, + content::URLFetcherDelegate* d) : fetcher_(fetcher), original_url_(original_url), request_type_(request_type), @@ -529,13 +529,13 @@ URLFetcher::Core::Core(URLFetcher* fetcher, max_retries_(0) { } -URLFetcher::Core::~Core() { +URLFetcherImpl::Core::~Core() { // |request_| should be NULL. If not, it's unsafe to delete it here since we // may not be on the IO thread. DCHECK(!request_.get()); } -void URLFetcher::Core::Start() { +void URLFetcherImpl::Core::Start() { DCHECK(delegate_loop_proxy_); CHECK(request_context_getter_) << "We need an URLRequestContext!"; if (io_message_loop_proxy_) { @@ -550,7 +550,7 @@ void URLFetcher::Core::Start() { FROM_HERE, base::Bind(&Core::StartOnIOThread, this)); } -void URLFetcher::Core::StartOnIOThread() { +void URLFetcherImpl::Core::StartOnIOThread() { DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); switch (response_destination_) { @@ -575,7 +575,7 @@ void URLFetcher::Core::StartOnIOThread() { } } -void URLFetcher::Core::Stop() { +void URLFetcherImpl::Core::Stop() { if (delegate_loop_proxy_) { // May be NULL in tests. DCHECK(delegate_loop_proxy_->BelongsToCurrentThread()); } @@ -587,7 +587,7 @@ void URLFetcher::Core::Stop() { } } -void URLFetcher::Core::ReceivedContentWasMalformed() { +void URLFetcherImpl::Core::ReceivedContentWasMalformed() { DCHECK(delegate_loop_proxy_->BelongsToCurrentThread()); if (io_message_loop_proxy_.get()) { io_message_loop_proxy_->PostTask( @@ -595,11 +595,11 @@ void URLFetcher::Core::ReceivedContentWasMalformed() { } } -void URLFetcher::Core::CancelAll() { +void URLFetcherImpl::Core::CancelAll() { g_registry.Get().CancelAll(); } -void URLFetcher::Core::OnResponseStarted(net::URLRequest* request) { +void URLFetcherImpl::Core::OnResponseStarted(net::URLRequest* request) { DCHECK_EQ(request, request_.get()); DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); if (request_->status().is_success()) { @@ -612,7 +612,7 @@ void URLFetcher::Core::OnResponseStarted(net::URLRequest* request) { ReadResponse(); } -void URLFetcher::Core::CompleteAddingUploadDataChunk( +void URLFetcherImpl::Core::CompleteAddingUploadDataChunk( const std::string& content, bool is_last_chunk) { DCHECK(is_chunked_upload_); DCHECK(request_.get()); @@ -622,7 +622,7 @@ void URLFetcher::Core::CompleteAddingUploadDataChunk( is_last_chunk); } -void URLFetcher::Core::AppendChunkToUpload(const std::string& content, +void URLFetcherImpl::Core::AppendChunkToUpload(const std::string& content, bool is_last_chunk) { DCHECK(delegate_loop_proxy_); CHECK(io_message_loop_proxy_.get()); @@ -635,7 +635,7 @@ void URLFetcher::Core::AppendChunkToUpload(const std::string& content, // Return true if the write was done and reading may continue. // Return false if the write is pending, and the next read will // be done later. -bool URLFetcher::Core::WriteBuffer(int num_bytes) { +bool URLFetcherImpl::Core::WriteBuffer(int num_bytes) { bool write_complete = false; switch (response_destination_) { case STRING: @@ -656,7 +656,7 @@ bool URLFetcher::Core::WriteBuffer(int num_bytes) { return write_complete; } -void URLFetcher::Core::OnReadCompleted(net::URLRequest* request, +void URLFetcherImpl::Core::OnReadCompleted(net::URLRequest* request, int bytes_read) { DCHECK(request == request_); DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); @@ -701,7 +701,7 @@ void URLFetcher::Core::OnReadCompleted(net::URLRequest* request, } } -void URLFetcher::Core::RetryOrCompleteUrlFetch() { +void URLFetcherImpl::Core::RetryOrCompleteUrlFetch() { DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); base::TimeDelta backoff_delay; @@ -737,7 +737,7 @@ void URLFetcher::Core::RetryOrCompleteUrlFetch() { DCHECK(posted || !delegate_); } -void URLFetcher::Core::ReadResponse() { +void URLFetcherImpl::Core::ReadResponse() { // Some servers may treat HEAD requests as GET requests. To free up the // network connection as soon as possible, signal that the request has // completed immediately, without trying to read any data back (all we care @@ -748,11 +748,11 @@ void URLFetcher::Core::ReadResponse() { OnReadCompleted(request_.get(), bytes_read); } -void URLFetcher::Core::DisownTempFile() { +void URLFetcherImpl::Core::DisownTempFile() { temp_file_writer_->DisownTempFile(); } -void URLFetcher::Core::StartURLRequest() { +void URLFetcherImpl::Core::StartURLRequest() { DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); if (was_cancelled_) { @@ -815,7 +815,7 @@ void URLFetcher::Core::StartURLRequest() { request_->Start(); } -void URLFetcher::Core::StartURLRequestWhenAppropriate() { +void URLFetcherImpl::Core::StartURLRequestWhenAppropriate() { DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); if (was_cancelled_) @@ -837,7 +837,7 @@ void URLFetcher::Core::StartURLRequestWhenAppropriate() { } } -void URLFetcher::Core::CancelURLRequest() { +void URLFetcherImpl::Core::CancelURLRequest() { DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); if (request_.get()) { @@ -853,7 +853,7 @@ void URLFetcher::Core::CancelURLRequest() { temp_file_writer_.reset(); } -void URLFetcher::Core::OnCompletedURLRequest( +void URLFetcherImpl::Core::OnCompletedURLRequest( base::TimeDelta backoff_delay) { DCHECK(delegate_loop_proxy_->BelongsToCurrentThread()); @@ -864,14 +864,14 @@ void URLFetcher::Core::OnCompletedURLRequest( } } -void URLFetcher::Core::InformDelegateFetchIsComplete() { +void URLFetcherImpl::Core::InformDelegateFetchIsComplete() { CHECK(delegate_loop_proxy_->BelongsToCurrentThread()); if (delegate_) { delegate_->OnURLFetchComplete(fetcher_); } } -void URLFetcher::Core::NotifyMalformedContent() { +void URLFetcherImpl::Core::NotifyMalformedContent() { DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); if (url_throttler_entry_ != NULL) { int status_code = response_code_; @@ -887,12 +887,12 @@ void URLFetcher::Core::NotifyMalformedContent() { } } -void URLFetcher::Core::ReleaseRequest() { +void URLFetcherImpl::Core::ReleaseRequest() { request_.reset(); g_registry.Get().RemoveURLFetcherCore(this); } -base::TimeTicks URLFetcher::Core::GetBackoffReleaseTime() { +base::TimeTicks URLFetcherImpl::Core::GetBackoffReleaseTime() { DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); DCHECK(original_url_throttler_entry_ != NULL); @@ -909,14 +909,14 @@ base::TimeTicks URLFetcher::Core::GetBackoffReleaseTime() { original_url_backoff : destination_url_backoff; } -void URLFetcher::SetUploadData(const std::string& upload_content_type, - const std::string& upload_content) { +void URLFetcherImpl::SetUploadData(const std::string& upload_content_type, + const std::string& upload_content) { DCHECK(!core_->is_chunked_upload_); core_->upload_content_type_ = upload_content_type; core_->upload_content_ = upload_content; } -void URLFetcher::SetChunkedUpload(const std::string& content_type) { +void URLFetcherImpl::SetChunkedUpload(const std::string& content_type) { DCHECK(core_->is_chunked_upload_ || (core_->upload_content_type_.empty() && core_->upload_content_.empty())); @@ -925,72 +925,72 @@ void URLFetcher::SetChunkedUpload(const std::string& content_type) { core_->is_chunked_upload_ = true; } -void URLFetcher::AppendChunkToUpload(const std::string& data, - bool is_last_chunk) { +void URLFetcherImpl::AppendChunkToUpload(const std::string& data, + bool is_last_chunk) { DCHECK(data.length()); core_->AppendChunkToUpload(data, is_last_chunk); } -const std::string& URLFetcher::upload_data() const { +const std::string& URLFetcherImpl::upload_data() const { return core_->upload_content_; } -void URLFetcher::SetReferrer(const std::string& referrer) { +void URLFetcherImpl::SetReferrer(const std::string& referrer) { core_->referrer_ = referrer; } -void URLFetcher::SetLoadFlags(int load_flags) { +void URLFetcherImpl::SetLoadFlags(int load_flags) { core_->load_flags_ = load_flags; } -int URLFetcher::GetLoadFlags() const { +int URLFetcherImpl::GetLoadFlags() const { return core_->load_flags_; } -void URLFetcher::SetExtraRequestHeaders( +void URLFetcherImpl::SetExtraRequestHeaders( const std::string& extra_request_headers) { core_->extra_request_headers_.Clear(); core_->extra_request_headers_.AddHeadersFromString(extra_request_headers); } -void URLFetcher::GetExtraRequestHeaders(net::HttpRequestHeaders* headers) { +void URLFetcherImpl::GetExtraRequestHeaders(net::HttpRequestHeaders* headers) { headers->CopyFrom(core_->extra_request_headers_); } -void URLFetcher::SetRequestContext( +void URLFetcherImpl::SetRequestContext( net::URLRequestContextGetter* request_context_getter) { DCHECK(!core_->request_context_getter_); core_->request_context_getter_ = request_context_getter; } -void URLFetcher::SetAutomaticallyRetryOn5xx(bool retry) { +void URLFetcherImpl::SetAutomaticallyRetryOn5xx(bool retry) { core_->automatically_retry_on_5xx_ = retry; } -void URLFetcher::SetMaxRetries(int max_retries) { +void URLFetcherImpl::SetMaxRetries(int max_retries) { core_->max_retries_ = max_retries; } -int URLFetcher::GetMaxRetries() const { +int URLFetcherImpl::GetMaxRetries() const { return core_->max_retries_; } -base::TimeDelta URLFetcher::GetBackoffDelay() const { +base::TimeDelta URLFetcherImpl::GetBackoffDelay() const { return core_->backoff_delay_; } -void URLFetcher::SaveResponseToTemporaryFile( +void URLFetcherImpl::SaveResponseToTemporaryFile( scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy) { core_->file_message_loop_proxy_ = file_message_loop_proxy; core_->response_destination_ = TEMP_FILE; } -net::HttpResponseHeaders* URLFetcher::GetResponseHeaders() const { +net::HttpResponseHeaders* URLFetcherImpl::GetResponseHeaders() const { return core_->response_headers_; } -void URLFetcher::set_response_headers( +void URLFetcherImpl::set_response_headers( scoped_refptr<net::HttpResponseHeaders> headers) { core_->response_headers_ = headers; } @@ -998,49 +998,49 @@ void URLFetcher::set_response_headers( // TODO(panayiotis): socket_address_ is written in the IO thread, // if this is accessed in the UI thread, this could result in a race. // Same for response_headers_ above and was_fetched_via_proxy_ below. -net::HostPortPair URLFetcher::GetSocketAddress() const { +net::HostPortPair URLFetcherImpl::GetSocketAddress() const { return core_->socket_address_; } -bool URLFetcher::WasFetchedViaProxy() const { +bool URLFetcherImpl::WasFetchedViaProxy() const { return core_->was_fetched_via_proxy_; } -void URLFetcher::set_was_fetched_via_proxy(bool flag) { +void URLFetcherImpl::set_was_fetched_via_proxy(bool flag) { core_->was_fetched_via_proxy_ = flag; } -void URLFetcher::Start() { +void URLFetcherImpl::Start() { core_->Start(); } -void URLFetcher::StartWithRequestContextGetter( +void URLFetcherImpl::StartWithRequestContextGetter( net::URLRequestContextGetter* request_context_getter) { SetRequestContext(request_context_getter); core_->Start(); } -const GURL& URLFetcher::GetOriginalUrl() const { +const GURL& URLFetcherImpl::GetOriginalUrl() const { return core_->original_url_; } -const GURL& URLFetcher::GetUrl() const { +const GURL& URLFetcherImpl::GetUrl() const { return core_->url_; } -const net::URLRequestStatus& URLFetcher::GetStatus() const { +const net::URLRequestStatus& URLFetcherImpl::GetStatus() const { return core_->status_; } -int URLFetcher::GetResponseCode() const { +int URLFetcherImpl::GetResponseCode() const { return core_->response_code_; } -const net::ResponseCookies& URLFetcher::GetCookies() const { +const net::ResponseCookies& URLFetcherImpl::GetCookies() const { return core_->cookies_; } -bool URLFetcher::FileErrorOccurred( +bool URLFetcherImpl::FileErrorOccurred( base::PlatformFileError* out_error_code) const { // Can't have a file error if no file is being created or written to. @@ -1056,11 +1056,12 @@ bool URLFetcher::FileErrorOccurred( return true; } -void URLFetcher::ReceivedContentWasMalformed() { +void URLFetcherImpl::ReceivedContentWasMalformed() { core_->ReceivedContentWasMalformed(); } -bool URLFetcher::GetResponseAsString(std::string* out_response_string) const { +bool URLFetcherImpl::GetResponseAsString( + std::string* out_response_string) const { if (core_->response_destination_ != STRING) return false; @@ -1068,8 +1069,8 @@ bool URLFetcher::GetResponseAsString(std::string* out_response_string) const { return true; } -bool URLFetcher::GetResponseAsFilePath(bool take_ownership, - FilePath* out_response_path) const { +bool URLFetcherImpl::GetResponseAsFilePath(bool take_ownership, + FilePath* out_response_path) const { DCHECK(core_->delegate_loop_proxy_->BelongsToCurrentThread()); if (core_->response_destination_ != TEMP_FILE || !core_->temp_file_writer_.get()) @@ -1085,25 +1086,25 @@ bool URLFetcher::GetResponseAsFilePath(bool take_ownership, } // static -void URLFetcher::CancelAll() { +void URLFetcherImpl::CancelAll() { Core::CancelAll(); } // static -int URLFetcher::GetNumFetcherCores() { +int URLFetcherImpl::GetNumFetcherCores() { return Core::g_registry.Get().size(); } -content::URLFetcherDelegate* URLFetcher::delegate() const { +content::URLFetcherDelegate* URLFetcherImpl::delegate() const { return core_->delegate(); } // static -content::URLFetcherFactory* URLFetcher::factory() { +content::URLFetcherFactory* URLFetcherImpl::factory() { return g_factory; } // static -void URLFetcher::set_factory(content::URLFetcherFactory* factory) { +void URLFetcherImpl::set_factory(content::URLFetcherFactory* factory) { g_factory = factory; } diff --git a/content/common/net/url_fetcher.h b/content/common/net/url_fetcher_impl.h index 3c48cba..ac7160ac 100644 --- a/content/common/net/url_fetcher.h +++ b/content/common/net/url_fetcher_impl.h @@ -11,8 +11,8 @@ // temporary situation. We will work on allowing support for multiple "io" // threads per process. -#ifndef CONTENT_COMMON_NET_URL_FETCHER_H_ -#define CONTENT_COMMON_NET_URL_FETCHER_H_ +#ifndef CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ +#define CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ #pragma once #include "base/compiler_specific.h" @@ -24,15 +24,15 @@ namespace content { class URLFetcherFactory; } -class CONTENT_EXPORT URLFetcher : public content::URLFetcher{ +class CONTENT_EXPORT URLFetcherImpl : public content::URLFetcher{ public: // |url| is the URL to send the request to. // |request_type| is the type of request to make. // |d| the object that will receive the callback on fetch completion. - URLFetcher(const GURL& url, - RequestType request_type, - content::URLFetcherDelegate* d); - virtual ~URLFetcher(); + URLFetcherImpl(const GURL& url, + RequestType request_type, + content::URLFetcherDelegate* d); + virtual ~URLFetcherImpl(); // content::URLFetcher implementation: virtual void SetUploadData(const std::string& upload_content_type, @@ -118,7 +118,7 @@ class CONTENT_EXPORT URLFetcher : public content::URLFetcher{ class Core; scoped_refptr<Core> core_; - DISALLOW_COPY_AND_ASSIGN(URLFetcher); + DISALLOW_COPY_AND_ASSIGN(URLFetcherImpl); }; -#endif // CONTENT_COMMON_NET_URL_FETCHER_H_ +#endif // CONTENT_COMMON_NET_URL_FETCHER_IMPL_H_ diff --git a/content/common/net/url_fetcher_unittest.cc b/content/common/net/url_fetcher_impl_unittest.cc index 0e9c7b8..709b54b 100644 --- a/content/common/net/url_fetcher_unittest.cc +++ b/content/common/net/url_fetcher_impl_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/common/net/url_fetcher.h" +#include "content/common/net/url_fetcher_impl.h" #include "base/bind.h" #include "base/message_loop_proxy.h" @@ -64,7 +64,7 @@ class URLFetcherTest : public testing::Test, URLFetcherTest() : fetcher_(NULL) { } static int GetNumFetcherCores() { - return URLFetcher::GetNumFetcherCores(); + return URLFetcherImpl::GetNumFetcherCores(); } // Creates a URLFetcher, using the program's main thread to do IO. @@ -102,11 +102,11 @@ class URLFetcherTest : public testing::Test, MessageLoopForIO io_loop_; scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; - URLFetcher* fetcher_; + URLFetcherImpl* fetcher_; }; void URLFetcherTest::CreateFetcher(const GURL& url) { - fetcher_ = new URLFetcher(url, URLFetcher::GET, this); + fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this); fetcher_->SetRequestContext(new TestURLRequestContextGetter( io_message_loop_proxy())); fetcher_->Start(); @@ -270,7 +270,7 @@ class URLFetcherTempFileTest : public URLFetcherTest { }; void URLFetcherTempFileTest::CreateFetcher(const GURL& url) { - fetcher_ = new URLFetcher(url, URLFetcher::GET, this); + fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this); fetcher_->SetRequestContext(new TestURLRequestContextGetter( io_message_loop_proxy())); @@ -345,7 +345,7 @@ class FetcherWrapperTask : public Task { }; void URLFetcherPostTest::CreateFetcher(const GURL& url) { - fetcher_ = new URLFetcher(url, URLFetcher::POST, this); + fetcher_ = new URLFetcherImpl(url, content::URLFetcher::POST, this); fetcher_->SetRequestContext(new TestURLRequestContextGetter( io_message_loop_proxy())); fetcher_->SetUploadData("application/x-www-form-urlencoded", @@ -360,7 +360,8 @@ void URLFetcherPostTest::OnURLFetchComplete(const content::URLFetcher* source) { URLFetcherTest::OnURLFetchComplete(source); } -void URLFetcherHeadersTest::OnURLFetchComplete(const content::URLFetcher* source) { +void URLFetcherHeadersTest::OnURLFetchComplete( + const content::URLFetcher* source) { std::string header; EXPECT_TRUE(source->GetResponseHeaders()->GetNormalizedHeader("cache-control", &header)); @@ -376,7 +377,7 @@ void URLFetcherSocketAddressTest::OnURLFetchComplete( } void URLFetcherProtectTest::CreateFetcher(const GURL& url) { - fetcher_ = new URLFetcher(url, URLFetcher::GET, this); + fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this); fetcher_->SetRequestContext(new TestURLRequestContextGetter( io_message_loop_proxy())); start_time_ = Time::Now(); @@ -414,7 +415,7 @@ void URLFetcherProtectTest::OnURLFetchComplete( } void URLFetcherProtectTestPassedThrough::CreateFetcher(const GURL& url) { - fetcher_ = new URLFetcher(url, URLFetcher::GET, this); + fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this); fetcher_->SetRequestContext(new TestURLRequestContextGetter( io_message_loop_proxy())); fetcher_->SetAutomaticallyRetryOn5xx(false); @@ -477,7 +478,7 @@ void URLFetcherBadHTTPSTest::OnURLFetchComplete( } void URLFetcherCancelTest::CreateFetcher(const GURL& url) { - fetcher_ = new URLFetcher(url, URLFetcher::GET, this); + fetcher_ = new URLFetcherImpl(url, content::URLFetcher::GET, this); CancelTestURLRequestContextGetter* context_getter = new CancelTestURLRequestContextGetter(io_message_loop_proxy()); fetcher_->SetRequestContext(context_getter); @@ -777,7 +778,7 @@ TEST_F(URLFetcherMultipleAttemptTest, SameData) { void CancelAllOnIO() { EXPECT_EQ(1, URLFetcherTest::GetNumFetcherCores()); - URLFetcher::CancelAll(); + URLFetcherImpl::CancelAll(); EXPECT_EQ(0, URLFetcherTest::GetNumFetcherCores()); } diff --git a/content/content_common.gypi b/content/content_common.gypi index ed04a18..c600895 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -167,8 +167,8 @@ 'common/message_router.h', 'common/mime_registry_messages.h', 'common/navigation_gesture.h', - 'common/net/url_fetcher.cc', - 'common/net/url_fetcher.h', + 'common/net/url_fetcher_impl.cc', + 'common/net/url_fetcher_impl.h', 'common/np_channel_base.cc', 'common/np_channel_base.h', 'common/npobject_base.h', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 46e94de..5b5219b 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -184,7 +184,7 @@ 'common/gpu/gpu_feature_flags_unittest.cc', 'common/gpu/gpu_info_unittest.cc', 'common/hi_res_timer_manager_unittest.cc', - 'common/net/url_fetcher_unittest.cc', + 'common/net/url_fetcher_impl_unittest.cc', 'common/process_watcher_unittest.cc', 'common/property_bag_unittest.cc', 'common/resource_dispatcher_unittest.cc', diff --git a/content/test/test_url_fetcher_factory.cc b/content/test/test_url_fetcher_factory.cc index 62cf94e..13678ab 100644 --- a/content/test/test_url_fetcher_factory.cc +++ b/content/test/test_url_fetcher_factory.cc @@ -8,7 +8,7 @@ #include "base/compiler_specific.h" #include "base/message_loop.h" -#include "content/common/net/url_fetcher.h" +#include "content/common/net/url_fetcher_impl.h" #include "content/public/common/url_fetcher_delegate.h" #include "net/base/host_port_pair.h" #include "net/http/http_response_headers.h" @@ -16,13 +16,13 @@ ScopedURLFetcherFactory::ScopedURLFetcherFactory( content::URLFetcherFactory* factory) { - DCHECK(!URLFetcher::factory()); - URLFetcher::set_factory(factory); + DCHECK(!URLFetcherImpl::factory()); + URLFetcherImpl::set_factory(factory); } ScopedURLFetcherFactory::~ScopedURLFetcherFactory() { - DCHECK(URLFetcher::factory()); - URLFetcher::set_factory(NULL); + DCHECK(URLFetcherImpl::factory()); + URLFetcherImpl::set_factory(NULL); } TestURLFetcher::TestURLFetcher(int id, @@ -320,5 +320,5 @@ content::URLFetcher* URLFetcherFactory::CreateURLFetcher( const GURL& url, content::URLFetcher::RequestType request_type, content::URLFetcherDelegate* d) { - return new URLFetcher(url, request_type, d); + return new URLFetcherImpl(url, request_type, d); } |