diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-30 21:34:02 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-30 21:34:02 +0000 |
commit | 6981d96328621a75557dbf843c5aab83bf4f55a3 (patch) | |
tree | 8a95daea7aad9b8bce1ced62fda4068ed296125a /webkit/appcache | |
parent | d4e04a67c7f529bc8137c2dc5618e5a8c2123a13 (diff) | |
download | chromium_src-6981d96328621a75557dbf843c5aab83bf4f55a3.zip chromium_src-6981d96328621a75557dbf843c5aab83bf4f55a3.tar.gz chromium_src-6981d96328621a75557dbf843c5aab83bf4f55a3.tar.bz2 |
net: Remove typedef net::URLRequest URLRequest;
BUG=64263
TEST=compiled locally, trybots
Review URL: http://codereview.chromium.org/5384002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67762 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r-- | webkit/appcache/appcache_host.cc | 4 | ||||
-rw-r--r-- | webkit/appcache/appcache_interceptor.cc | 21 | ||||
-rw-r--r-- | webkit/appcache/appcache_interceptor.h | 8 | ||||
-rw-r--r-- | webkit/appcache/appcache_interfaces.cc | 4 | ||||
-rw-r--r-- | webkit/appcache/appcache_request_handler.cc | 10 | ||||
-rw-r--r-- | webkit/appcache/appcache_request_handler.h | 4 | ||||
-rw-r--r-- | webkit/appcache/appcache_request_handler_unittest.cc | 14 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job.cc | 47 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job.h | 40 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job_unittest.cc | 43 | ||||
-rw-r--r-- | webkit/appcache/appcache_url_request_job.cc | 2 | ||||
-rw-r--r-- | webkit/appcache/appcache_url_request_job_unittest.cc | 40 | ||||
-rw-r--r-- | webkit/appcache/view_appcache_internals_job.cc | 2 |
13 files changed, 122 insertions, 117 deletions
diff --git a/webkit/appcache/appcache_host.cc b/webkit/appcache/appcache_host.cc index e954e80..5e8e4db 100644 --- a/webkit/appcache/appcache_host.cc +++ b/webkit/appcache/appcache_host.cc @@ -255,8 +255,8 @@ AppCacheHost* AppCacheHost::GetParentAppCacheHost() const { } AppCacheRequestHandler* AppCacheHost::CreateRequestHandler( - URLRequest* request, - ResourceType::Type resource_type) { + net::URLRequest* request, + ResourceType::Type resource_type) { if (is_for_dedicated_worker()) { AppCacheHost* parent_host = GetParentAppCacheHost(); if (parent_host) diff --git a/webkit/appcache/appcache_interceptor.cc b/webkit/appcache/appcache_interceptor.cc index 6fcd322..3f61e71 100644 --- a/webkit/appcache/appcache_interceptor.cc +++ b/webkit/appcache/appcache_interceptor.cc @@ -14,17 +14,18 @@ namespace appcache { void AppCacheInterceptor::SetHandler( - URLRequest* request, AppCacheRequestHandler* handler) { + net::URLRequest* request, AppCacheRequestHandler* handler) { request->SetUserData(instance(), handler); // request takes ownership } -AppCacheRequestHandler* AppCacheInterceptor::GetHandler(URLRequest* request) { +AppCacheRequestHandler* AppCacheInterceptor::GetHandler( + net::URLRequest* request) { return reinterpret_cast<AppCacheRequestHandler*>( request->GetUserData(instance())); } void AppCacheInterceptor::SetExtraRequestInfo( - URLRequest* request, AppCacheService* service, int process_id, + net::URLRequest* request, AppCacheService* service, int process_id, int host_id, ResourceType::Type resource_type) { if (!service || (host_id == kNoHostId)) return; @@ -46,7 +47,7 @@ void AppCacheInterceptor::SetExtraRequestInfo( SetHandler(request, handler); } -void AppCacheInterceptor::GetExtraResponseInfo(URLRequest* request, +void AppCacheInterceptor::GetExtraResponseInfo(net::URLRequest* request, int64* cache_id, GURL* manifest_url) { DCHECK(*cache_id == kNoCacheId); @@ -57,14 +58,14 @@ void AppCacheInterceptor::GetExtraResponseInfo(URLRequest* request, } AppCacheInterceptor::AppCacheInterceptor() { - URLRequest::RegisterRequestInterceptor(this); + net::URLRequest::RegisterRequestInterceptor(this); } AppCacheInterceptor::~AppCacheInterceptor() { - URLRequest::UnregisterRequestInterceptor(this); + net::URLRequest::UnregisterRequestInterceptor(this); } -URLRequestJob* AppCacheInterceptor::MaybeIntercept(URLRequest* request) { +URLRequestJob* AppCacheInterceptor::MaybeIntercept(net::URLRequest* request) { AppCacheRequestHandler* handler = GetHandler(request); if (!handler) return NULL; @@ -72,8 +73,8 @@ URLRequestJob* AppCacheInterceptor::MaybeIntercept(URLRequest* request) { } URLRequestJob* AppCacheInterceptor::MaybeInterceptRedirect( - URLRequest* request, - const GURL& location) { + net::URLRequest* request, + const GURL& location) { AppCacheRequestHandler* handler = GetHandler(request); if (!handler) return NULL; @@ -81,7 +82,7 @@ URLRequestJob* AppCacheInterceptor::MaybeInterceptRedirect( } URLRequestJob* AppCacheInterceptor::MaybeInterceptResponse( - URLRequest* request) { + net::URLRequest* request) { AppCacheRequestHandler* handler = GetHandler(request); if (!handler) return NULL; diff --git a/webkit/appcache/appcache_interceptor.h b/webkit/appcache/appcache_interceptor.h index 519d89b..5a7acfd 100644 --- a/webkit/appcache/appcache_interceptor.h +++ b/webkit/appcache/appcache_interceptor.h @@ -17,7 +17,7 @@ class AppCacheService; // An interceptor to hijack requests and potentially service them out of // the appcache. -class AppCacheInterceptor : public URLRequest::Interceptor { +class AppCacheInterceptor : public net::URLRequest::Interceptor { public: // Registers a singleton instance with the net library. // Should be called early in the IO thread prior to initiating requests. @@ -26,7 +26,7 @@ class AppCacheInterceptor : public URLRequest::Interceptor { } // Must be called to make a request eligible for retrieval from an appcache. - static void SetExtraRequestInfo(URLRequest* request, + static void SetExtraRequestInfo(net::URLRequest* request, AppCacheService* service, int process_id, int host_id, @@ -34,12 +34,12 @@ class AppCacheInterceptor : public URLRequest::Interceptor { // May be called after response headers are complete to retrieve extra // info about the response. - static void GetExtraResponseInfo(URLRequest* request, + static void GetExtraResponseInfo(net::URLRequest* request, int64* cache_id, GURL* manifest_url); protected: - // URLRequest::Interceptor overrides + // Overridde from net::URLRequest::Interceptor: virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request); virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request); virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request, diff --git a/webkit/appcache/appcache_interfaces.cc b/webkit/appcache/appcache_interfaces.cc index 4ed0f09..be8cef5 100644 --- a/webkit/appcache/appcache_interfaces.cc +++ b/webkit/appcache/appcache_interfaces.cc @@ -52,7 +52,7 @@ bool IsSchemeSupported(const GURL& url) { // TODO(michaeln): It would be really nice if this could optionally work for // file urls too to help web developers experiment and test their apps, // perhaps enabled via a cmd line flag or some other developer tool setting. - // Unfortunately file scheme URLRequest don't produce the same signalling + // Unfortunately file scheme net::URLRequest don't produce the same signalling // (200 response codes, headers) as http URLRequests, so this doesn't work // just yet. // supported |= url.SchemeIsFile(); @@ -64,7 +64,7 @@ bool IsMethodSupported(const std::string& method) { return (method == kHttpGETMethod) || (method == kHttpHEADMethod); } -bool IsSchemeAndMethodSupported(const URLRequest* request) { +bool IsSchemeAndMethodSupported(const net::URLRequest* request) { return IsSchemeSupported(request->url()) && IsMethodSupported(request->method()); } diff --git a/webkit/appcache/appcache_request_handler.cc b/webkit/appcache/appcache_request_handler.cc index 8cbb805..72e6beb 100644 --- a/webkit/appcache/appcache_request_handler.cc +++ b/webkit/appcache/appcache_request_handler.cc @@ -41,7 +41,7 @@ void AppCacheRequestHandler::GetExtraResponseInfo( } AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadResource( - URLRequest* request) { + net::URLRequest* request) { if (!host_ || !IsSchemeAndMethodSupported(request) || cache_entry_not_found_) return NULL; @@ -86,7 +86,7 @@ AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadResource( } AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForRedirect( - URLRequest* request, const GURL& location) { + net::URLRequest* request, const GURL& location) { if (!host_ || !IsSchemeAndMethodSupported(request) || cache_entry_not_found_) return NULL; if (is_main_resource()) @@ -115,7 +115,7 @@ AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForRedirect( } AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForResponse( - URLRequest* request) { + net::URLRequest* request) { if (!host_ || !IsSchemeAndMethodSupported(request) || cache_entry_not_found_) return NULL; if (!found_fallback_entry_.has_response_id()) @@ -186,7 +186,7 @@ void AppCacheRequestHandler::DeliverNetworkResponse() { // Main-resource handling ---------------------------------------------- -void AppCacheRequestHandler::MaybeLoadMainResource(URLRequest* request) { +void AppCacheRequestHandler::MaybeLoadMainResource(net::URLRequest* request) { DCHECK(!job_); // We may have to wait for our storage query to complete, but @@ -244,7 +244,7 @@ void AppCacheRequestHandler::OnMainResponseFound( // Sub-resource handling ---------------------------------------------- void AppCacheRequestHandler::MaybeLoadSubResource( - URLRequest* request) { + net::URLRequest* request) { DCHECK(!job_); if (host_->is_selection_pending()) { diff --git a/webkit/appcache/appcache_request_handler.h b/webkit/appcache/appcache_request_handler.h index fcf7f8f..e07a77c 100644 --- a/webkit/appcache/appcache_request_handler.h +++ b/webkit/appcache/appcache_request_handler.h @@ -19,8 +19,8 @@ namespace appcache { class AppCacheURLRequestJob; -// An instance is created for each URLRequest. The instance survives all -// http transactions involved in the processing of its URLRequest, and is +// An instance is created for each net::URLRequest. The instance survives all +// http transactions involved in the processing of its net::URLRequest, and is // given the opportunity to hijack the request along the way. Callers // should use AppCacheHost::CreateRequestHandler to manufacture instances // that can retrieve resources for a particular host. diff --git a/webkit/appcache/appcache_request_handler_unittest.cc b/webkit/appcache/appcache_request_handler_unittest.cc index ae0be75..3556d51 100644 --- a/webkit/appcache/appcache_request_handler_unittest.cc +++ b/webkit/appcache/appcache_request_handler_unittest.cc @@ -73,16 +73,16 @@ class AppCacheRequestHandlerTest : public testing::Test { class MockURLRequestJob : public URLRequestJob { public: - MockURLRequestJob(URLRequest* request, int response_code) + MockURLRequestJob(net::URLRequest* request, int response_code) : URLRequestJob(request), response_code_(response_code) {} virtual void Start() {} virtual int GetResponseCode() const { return response_code_; } int response_code_; }; - class MockURLRequest : public URLRequest { + class MockURLRequest : public net::URLRequest { public: - explicit MockURLRequest(const GURL& url) : URLRequest(url, NULL) {} + explicit MockURLRequest(const GURL& url) : net::URLRequest(url, NULL) {} void SimulateResponseCode(int http_response_code) { mock_factory_job_ = new MockURLRequestJob(this, http_response_code); @@ -94,7 +94,7 @@ class AppCacheRequestHandlerTest : public testing::Test { } }; - static URLRequestJob* MockHttpJobFactory(URLRequest* request, + static URLRequestJob* MockHttpJobFactory(net::URLRequest* request, const std::string& scheme) { if (mock_factory_job_) { URLRequestJob* temp = mock_factory_job_; @@ -133,7 +133,7 @@ class AppCacheRequestHandlerTest : public testing::Test { void SetUpTest() { DCHECK(MessageLoop::current() == io_thread_->message_loop()); - orig_http_factory_ = URLRequest::RegisterProtocolFactory( + orig_http_factory_ = net::URLRequest::RegisterProtocolFactory( "http", MockHttpJobFactory); mock_service_.reset(new MockAppCacheService); mock_frontend_.reset(new MockFrontend); @@ -148,7 +148,7 @@ class AppCacheRequestHandlerTest : public testing::Test { void TearDownTest() { DCHECK(MessageLoop::current() == io_thread_->message_loop()); DCHECK(!mock_factory_job_); - URLRequest::RegisterProtocolFactory("http", orig_http_factory_); + net::URLRequest::RegisterProtocolFactory("http", orig_http_factory_); orig_http_factory_ = NULL; job_ = NULL; handler_.reset(); @@ -665,7 +665,7 @@ class AppCacheRequestHandlerTest : public testing::Test { scoped_ptr<MockURLRequest> request_; scoped_ptr<AppCacheRequestHandler> handler_; scoped_refptr<AppCacheURLRequestJob> job_; - URLRequest::ProtocolFactory* orig_http_factory_; + net::URLRequest::ProtocolFactory* orig_http_factory_; static scoped_ptr<base::Thread> io_thread_; static URLRequestJob* mock_factory_job_; diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc index d34017a..2578fd3 100644 --- a/webkit/appcache/appcache_update_job.cc +++ b/webkit/appcache/appcache_update_job.cc @@ -23,8 +23,8 @@ static const size_t kMaxConcurrentUrlFetches = 2; static const int kMax503Retries = 3; // Extra info associated with requests for use during response processing. -// This info is deleted when the URLRequest is deleted. -class UpdateJobInfo : public URLRequest::UserData { +// This info is deleted when the net::URLRequest is deleted. +class UpdateJobInfo : public net::URLRequest::UserData { public: enum RequestType { MANIFEST_FETCH, @@ -45,7 +45,7 @@ class UpdateJobInfo : public URLRequest::UserData { void SetUpResponseWriter(AppCacheResponseWriter* writer, AppCacheUpdateJob* update, - URLRequest* request) { + net::URLRequest* request) { DCHECK(!response_writer_.get()); response_writer_.reset(writer); update_job_ = update; @@ -67,7 +67,7 @@ class UpdateJobInfo : public URLRequest::UserData { // Info needed to write responses to storage and process callbacks. scoped_ptr<AppCacheResponseWriter> response_writer_; AppCacheUpdateJob* update_job_; - URLRequest* request_; + net::URLRequest* request_; net::CompletionCallbackImpl<UpdateJobInfo> write_callback_; }; @@ -174,7 +174,7 @@ AppCacheUpdateJob::~AppCacheUpdateJob() { policy_callback_->Cancel(); } -UpdateJobInfo* AppCacheUpdateJob::GetUpdateJobInfo(URLRequest* request) { +UpdateJobInfo* AppCacheUpdateJob::GetUpdateJobInfo(net::URLRequest* request) { return static_cast<UpdateJobInfo*>(request->GetUserData(this)); } @@ -287,7 +287,7 @@ void AppCacheUpdateJob::HandleCacheFailure(const std::string& error_message) { void AppCacheUpdateJob::FetchManifest(bool is_first_fetch) { DCHECK(!manifest_url_request_); - manifest_url_request_ = new URLRequest(manifest_url_, this); + manifest_url_request_ = new net::URLRequest(manifest_url_, this); UpdateJobInfo::RequestType fetch_type = is_first_fetch ? UpdateJobInfo::MANIFEST_FETCH : UpdateJobInfo::MANIFEST_REFETCH; manifest_url_request_->SetUserData(this, new UpdateJobInfo(fetch_type)); @@ -316,7 +316,7 @@ void AppCacheUpdateJob::FetchManifest(bool is_first_fetch) { } void AppCacheUpdateJob::AddConditionalHeaders( - URLRequest* request, const net::HttpResponseInfo* info) { + net::URLRequest* request, const net::HttpResponseInfo* info) { DCHECK(request && info); net::HttpRequestHeaders extra_headers; @@ -341,7 +341,7 @@ void AppCacheUpdateJob::AddConditionalHeaders( request->SetExtraRequestHeaders(extra_headers); } -void AppCacheUpdateJob::OnResponseStarted(URLRequest *request) { +void AppCacheUpdateJob::OnResponseStarted(net::URLRequest *request) { if (request->status().is_success() && (request->GetResponseCode() / 100) == 2) { // Write response info to storage for URL fetches. Wait for async write @@ -365,7 +365,7 @@ void AppCacheUpdateJob::OnResponseStarted(URLRequest *request) { } } -void AppCacheUpdateJob::ReadResponseData(URLRequest* request) { +void AppCacheUpdateJob::ReadResponseData(net::URLRequest* request) { if (internal_state_ == CACHE_FAILURE || internal_state_ == CANCELLED || internal_state_ == COMPLETED) { return; @@ -377,7 +377,8 @@ void AppCacheUpdateJob::ReadResponseData(URLRequest* request) { OnReadCompleted(request, bytes_read); } -void AppCacheUpdateJob::OnReadCompleted(URLRequest* request, int bytes_read) { +void AppCacheUpdateJob::OnReadCompleted(net::URLRequest* request, + int bytes_read) { bool data_consumed = true; if (request->status().is_success() && bytes_read > 0) { UpdateJobInfo* info = GetUpdateJobInfo(request); @@ -400,7 +401,7 @@ void AppCacheUpdateJob::OnReadCompleted(URLRequest* request, int bytes_read) { OnResponseCompleted(request); } -bool AppCacheUpdateJob::ConsumeResponseData(URLRequest* request, +bool AppCacheUpdateJob::ConsumeResponseData(net::URLRequest* request, UpdateJobInfo* info, int bytes_read) { DCHECK_GT(bytes_read, 0); @@ -424,7 +425,7 @@ bool AppCacheUpdateJob::ConsumeResponseData(URLRequest* request, } void AppCacheUpdateJob::OnWriteResponseComplete(int result, - URLRequest* request, + net::URLRequest* request, UpdateJobInfo* info) { if (result < 0) { request->Cancel(); @@ -435,7 +436,7 @@ void AppCacheUpdateJob::OnWriteResponseComplete(int result, ReadResponseData(request); } -void AppCacheUpdateJob::OnReceivedRedirect(URLRequest* request, +void AppCacheUpdateJob::OnReceivedRedirect(net::URLRequest* request, const GURL& new_url, bool* defer_redirect) { // Redirect is not allowed by the update process. @@ -443,7 +444,7 @@ void AppCacheUpdateJob::OnReceivedRedirect(URLRequest* request, OnResponseCompleted(request); } -void AppCacheUpdateJob::OnResponseCompleted(URLRequest* request) { +void AppCacheUpdateJob::OnResponseCompleted(net::URLRequest* request) { // Retry for 503s where retry-after is 0. if (request->status().is_success() && request->GetResponseCode() == 503 && @@ -472,7 +473,7 @@ void AppCacheUpdateJob::OnResponseCompleted(URLRequest* request) { delete request; } -bool AppCacheUpdateJob::RetryRequest(URLRequest* request) { +bool AppCacheUpdateJob::RetryRequest(net::URLRequest* request) { UpdateJobInfo* info = GetUpdateJobInfo(request); if (info->retry_503_attempts_ >= kMax503Retries) { return false; @@ -482,7 +483,7 @@ bool AppCacheUpdateJob::RetryRequest(URLRequest* request) { return false; const GURL& url = request->original_url(); - URLRequest* retry = new URLRequest(url, this); + net::URLRequest* retry = new net::URLRequest(url, this); UpdateJobInfo* retry_info = new UpdateJobInfo(info->type_); retry_info->retry_503_attempts_ = info->retry_503_attempts_ + 1; retry_info->existing_entry_ = info->existing_entry_; @@ -514,7 +515,7 @@ bool AppCacheUpdateJob::RetryRequest(URLRequest* request) { return true; } -void AppCacheUpdateJob::HandleManifestFetchCompleted(URLRequest* request) { +void AppCacheUpdateJob::HandleManifestFetchCompleted(net::URLRequest* request) { DCHECK(internal_state_ == FETCH_MANIFEST); manifest_url_request_ = NULL; @@ -621,7 +622,7 @@ void AppCacheUpdateJob::ContinueHandleManifestFetchCompleted(bool changed) { MaybeCompleteUpdate(); // if not done, continues when async fetches complete } -void AppCacheUpdateJob::HandleUrlFetchCompleted(URLRequest* request) { +void AppCacheUpdateJob::HandleUrlFetchCompleted(net::URLRequest* request) { DCHECK(internal_state_ == DOWNLOADING); UpdateJobInfo* info = GetUpdateJobInfo(request); @@ -684,7 +685,8 @@ void AppCacheUpdateJob::HandleUrlFetchCompleted(URLRequest* request) { MaybeCompleteUpdate(); } -void AppCacheUpdateJob::HandleMasterEntryFetchCompleted(URLRequest* request) { +void AppCacheUpdateJob::HandleMasterEntryFetchCompleted( + net::URLRequest* request) { DCHECK(internal_state_ == NO_UPDATE || internal_state_ == DOWNLOADING); // TODO(jennb): Handle downloads completing during cache failure when update @@ -767,7 +769,8 @@ void AppCacheUpdateJob::HandleMasterEntryFetchCompleted(URLRequest* request) { MaybeCompleteUpdate(); } -void AppCacheUpdateJob::HandleManifestRefetchCompleted(URLRequest* request) { +void AppCacheUpdateJob::HandleManifestRefetchCompleted( + net::URLRequest* request) { DCHECK(internal_state_ == REFETCH_MANIFEST); manifest_url_request_ = NULL; @@ -1021,7 +1024,7 @@ void AppCacheUpdateJob::FetchUrls() { } // Send URL request for the resource. - URLRequest* request = new URLRequest(url_to_fetch.url, this); + net::URLRequest* request = new net::URLRequest(url_to_fetch.url, this); request->SetUserData(this, info); request->set_context(service_->request_context()); request->set_load_flags( @@ -1136,7 +1139,7 @@ void AppCacheUpdateJob::FetchMasterEntries() { } } else { // Send URL request for the master entry. - URLRequest* request = new URLRequest(url, this); + net::URLRequest* request = new net::URLRequest(url, this); request->SetUserData(this, new UpdateJobInfo(UpdateJobInfo::MASTER_ENTRY_FETCH)); request->set_context(service_->request_context()); diff --git a/webkit/appcache/appcache_update_job.h b/webkit/appcache/appcache_update_job.h index b0a683c..dacff44 100644 --- a/webkit/appcache/appcache_update_job.h +++ b/webkit/appcache/appcache_update_job.h @@ -29,7 +29,7 @@ class UpdateJobInfo; class HostNotifier; // Application cache Update algorithm and state. -class AppCacheUpdateJob : public URLRequest::Delegate, +class AppCacheUpdateJob : public net::URLRequest::Delegate, public AppCacheStorage::Delegate, public AppCacheHost::Observer { public: @@ -49,7 +49,7 @@ class AppCacheUpdateJob : public URLRequest::Delegate, // in different tabs. typedef std::vector<AppCacheHost*> PendingHosts; typedef std::map<GURL, PendingHosts> PendingMasters; - typedef std::map<GURL, URLRequest*> PendingUrlFetches; + typedef std::map<GURL, net::URLRequest*> PendingUrlFetches; typedef std::map<int64, GURL> LoadingResponses; static const int kRerunDelayMs = 1000; @@ -91,14 +91,14 @@ class AppCacheUpdateJob : public URLRequest::Delegate, scoped_refptr<AppCacheResponseInfo> existing_response_info; }; - UpdateJobInfo* GetUpdateJobInfo(URLRequest* request); + UpdateJobInfo* GetUpdateJobInfo(net::URLRequest* request); - // Methods for URLRequest::Delegate. - void OnResponseStarted(URLRequest* request); - void OnReadCompleted(URLRequest* request, int bytes_read); - void OnReceivedRedirect(URLRequest* request, - const GURL& new_url, - bool* defer_redirect); + // Overridden from net::URLRequest::Delegate: + virtual void OnResponseStarted(net::URLRequest* request); + virtual void OnReadCompleted(net::URLRequest* request, int bytes_read); + virtual void OnReceivedRedirect(net::URLRequest* request, + const GURL& new_url, + bool* defer_redirect); // TODO(jennb): any other delegate callbacks to handle? certificate? // Methods for AppCacheStorage::Delegate. @@ -121,33 +121,33 @@ class AppCacheUpdateJob : public URLRequest::Delegate, // Add extra conditional HTTP headers to the request based on the // currently cached response headers. - void AddConditionalHeaders(URLRequest* request, + void AddConditionalHeaders(net::URLRequest* request, const net::HttpResponseInfo* info); - void OnResponseCompleted(URLRequest* request); + void OnResponseCompleted(net::URLRequest* request); // Retries a 503 request with retry-after header of 0. // Returns true if request should be retried and deletes original request. - bool RetryRequest(URLRequest* request); + bool RetryRequest(net::URLRequest* request); - void ReadResponseData(URLRequest* request); + void ReadResponseData(net::URLRequest* request); // Returns false if response data is processed asynchronously, in which // case ReadResponseData will be invoked when it is safe to continue // reading more response data from the request. - bool ConsumeResponseData(URLRequest* request, + bool ConsumeResponseData(net::URLRequest* request, UpdateJobInfo* info, int bytes_read); - void OnWriteResponseComplete(int result, URLRequest* request, + void OnWriteResponseComplete(int result, net::URLRequest* request, UpdateJobInfo* info); - void HandleManifestFetchCompleted(URLRequest* request); + void HandleManifestFetchCompleted(net::URLRequest* request); void ContinueHandleManifestFetchCompleted(bool changed); - void HandleUrlFetchCompleted(URLRequest* request); - void HandleMasterEntryFetchCompleted(URLRequest* request); + void HandleUrlFetchCompleted(net::URLRequest* request); + void HandleMasterEntryFetchCompleted(net::URLRequest* request); - void HandleManifestRefetchCompleted(URLRequest* request); + void HandleManifestRefetchCompleted(net::URLRequest* request); void OnManifestInfoWriteComplete(int result); void OnManifestDataWriteComplete(int result); @@ -252,7 +252,7 @@ class AppCacheUpdateJob : public URLRequest::Delegate, LoadingResponses loading_responses_; // Keep track of pending URL requests so we can cancel them if necessary. - URLRequest* manifest_url_request_; + net::URLRequest* manifest_url_request_; PendingUrlFetches pending_url_fetches_; // Temporary storage of manifest response data for parsing and comparison. diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index defe9f7..543ece5 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -41,7 +41,7 @@ class MockHttpServer { return GURL("http://mockhost/" + path); } - static URLRequestJob* JobFactory(URLRequest* request, + static URLRequestJob* JobFactory(net::URLRequest* request, const std::string& scheme) { if (request->url().host() != "mockhost") return new URLRequestErrorJob(request, -1); @@ -287,7 +287,7 @@ class MockFrontend : public AppCacheFrontend { }; // Helper factories to simulate redirected URL responses for tests. -static URLRequestJob* RedirectFactory(URLRequest* request, +static URLRequestJob* RedirectFactory(net::URLRequest* request, const std::string& scheme) { return new URLRequestTestJob(request, URLRequestTestJob::test_redirect_headers(), @@ -322,7 +322,7 @@ class RetryRequestTestJob : public URLRequestTestJob { expected_requests_ = 0; } - static URLRequestJob* RetryFactory(URLRequest* request, + static URLRequestJob* RetryFactory(net::URLRequest* request, const std::string& scheme) { ++num_requests_; if (num_retries_ > 0 && request->original_url() == kRetryUrl) { @@ -377,7 +377,8 @@ class RetryRequestTestJob : public URLRequestTestJob { "http://retry\r"); // must be same as kRetryUrl } - explicit RetryRequestTestJob(URLRequest* request, const std::string& headers, + explicit RetryRequestTestJob(net::URLRequest* request, + const std::string& headers, int response_code) : URLRequestTestJob(request, headers, data(), true), response_code_(response_code) { @@ -423,7 +424,7 @@ class HttpHeadersRequestTestJob : public URLRequestTestJob { already_checked_ = false; } - static URLRequestJob* IfModifiedSinceFactory(URLRequest* request, + static URLRequestJob* IfModifiedSinceFactory(net::URLRequest* request, const std::string& scheme) { if (!already_checked_) { already_checked_ = true; // only check once for a test @@ -477,17 +478,17 @@ class IOThread : public base::Thread { } virtual void Init() { - old_factory_ = URLRequest::RegisterProtocolFactory( + old_factory_ = net::URLRequest::RegisterProtocolFactory( "http", MockHttpServer::JobFactory); request_context_ = new TestURLRequestContext(); } virtual void CleanUp() { - URLRequest::RegisterProtocolFactory("http", old_factory_); + net::URLRequest::RegisterProtocolFactory("http", old_factory_); request_context_ = NULL; } - URLRequest::ProtocolFactory* old_factory_; + net::URLRequest::ProtocolFactory* old_factory_; scoped_refptr<URLRequestContext> request_context_; }; @@ -790,7 +791,7 @@ class AppCacheUpdateJobTest : public testing::Test, ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); old_factory_ = - URLRequest::RegisterProtocolFactory("http", RedirectFactory); + net::URLRequest::RegisterProtocolFactory("http", RedirectFactory); registered_factory_ = true; MakeService(); @@ -1581,7 +1582,7 @@ class AppCacheUpdateJobTest : public testing::Test, // Set some large number of times to return retry. // Expect 1 manifest fetch and 3 retries. RetryRequestTestJob::Initialize(5, RetryRequestTestJob::RETRY_AFTER_0, 4); - old_factory_ = URLRequest::RegisterProtocolFactory( + old_factory_ = net::URLRequest::RegisterProtocolFactory( "http", RetryRequestTestJob::RetryFactory); registered_factory_ = true; @@ -1612,7 +1613,7 @@ class AppCacheUpdateJobTest : public testing::Test, // Set some large number of times to return retry. // Expect 1 manifest fetch and 0 retries. RetryRequestTestJob::Initialize(5, RetryRequestTestJob::NO_RETRY_AFTER, 1); - old_factory_ = URLRequest::RegisterProtocolFactory( + old_factory_ = net::URLRequest::RegisterProtocolFactory( "http", RetryRequestTestJob::RetryFactory); registered_factory_ = true; @@ -1644,7 +1645,7 @@ class AppCacheUpdateJobTest : public testing::Test, // Expect 1 request and 0 retry attempts. RetryRequestTestJob::Initialize( 5, RetryRequestTestJob::NONZERO_RETRY_AFTER, 1); - old_factory_ = URLRequest::RegisterProtocolFactory( + old_factory_ = net::URLRequest::RegisterProtocolFactory( "http", RetryRequestTestJob::RetryFactory); registered_factory_ = true; @@ -1675,7 +1676,7 @@ class AppCacheUpdateJobTest : public testing::Test, // Set 2 as the retry limit (does not exceed the max). // Expect 1 manifest fetch, 2 retries, 1 url fetch, 1 manifest refetch. RetryRequestTestJob::Initialize(2, RetryRequestTestJob::RETRY_AFTER_0, 5); - old_factory_ = URLRequest::RegisterProtocolFactory( + old_factory_ = net::URLRequest::RegisterProtocolFactory( "http", RetryRequestTestJob::RetryFactory); registered_factory_ = true; @@ -1706,7 +1707,7 @@ class AppCacheUpdateJobTest : public testing::Test, // Set 1 as the retry limit (does not exceed the max). // Expect 1 manifest fetch, 1 url fetch, 1 url retry, 1 manifest refetch. RetryRequestTestJob::Initialize(1, RetryRequestTestJob::RETRY_AFTER_0, 4); - old_factory_ = URLRequest::RegisterProtocolFactory( + old_factory_ = net::URLRequest::RegisterProtocolFactory( "http", RetryRequestTestJob::RetryFactory); registered_factory_ = true; @@ -2547,7 +2548,7 @@ class AppCacheUpdateJobTest : public testing::Test, void IfModifiedSinceTest() { ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); - old_factory_ = URLRequest::RegisterProtocolFactory( + old_factory_ = net::URLRequest::RegisterProtocolFactory( "http", HttpHeadersRequestTestJob::IfModifiedSinceFactory); registered_factory_ = true; @@ -2613,7 +2614,7 @@ class AppCacheUpdateJobTest : public testing::Test, ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); HttpHeadersRequestTestJob::Initialize("Sat, 29 Oct 1994 19:43:31 GMT", ""); - old_factory_ = URLRequest::RegisterProtocolFactory( + old_factory_ = net::URLRequest::RegisterProtocolFactory( "http", HttpHeadersRequestTestJob::IfModifiedSinceFactory); registered_factory_ = true; @@ -2671,7 +2672,7 @@ class AppCacheUpdateJobTest : public testing::Test, ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\""); - old_factory_ = URLRequest::RegisterProtocolFactory( + old_factory_ = net::URLRequest::RegisterProtocolFactory( "http", HttpHeadersRequestTestJob::IfModifiedSinceFactory); registered_factory_ = true; @@ -2729,7 +2730,7 @@ class AppCacheUpdateJobTest : public testing::Test, ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()); HttpHeadersRequestTestJob::Initialize("", "\"LadeDade\""); - old_factory_ = URLRequest::RegisterProtocolFactory( + old_factory_ = net::URLRequest::RegisterProtocolFactory( "http", HttpHeadersRequestTestJob::IfModifiedSinceFactory); registered_factory_ = true; @@ -2764,7 +2765,7 @@ class AppCacheUpdateJobTest : public testing::Test, // Verify that code is correct when building multiple extra headers. HttpHeadersRequestTestJob::Initialize( "Sat, 29 Oct 1994 19:43:31 GMT", "\"LadeDade\""); - old_factory_ = URLRequest::RegisterProtocolFactory( + old_factory_ = net::URLRequest::RegisterProtocolFactory( "http", HttpHeadersRequestTestJob::IfModifiedSinceFactory); registered_factory_ = true; @@ -2831,7 +2832,7 @@ class AppCacheUpdateJobTest : public testing::Test, response_infos_.clear(); service_.reset(NULL); if (registered_factory_) - URLRequest::RegisterProtocolFactory("http", old_factory_); + net::URLRequest::RegisterProtocolFactory("http", old_factory_); event_->Signal(); } @@ -3180,7 +3181,7 @@ class AppCacheUpdateJobTest : public testing::Test, std::map<GURL, int64> expect_response_ids_; bool registered_factory_; - URLRequest::ProtocolFactory* old_factory_; + net::URLRequest::ProtocolFactory* old_factory_; }; // static diff --git a/webkit/appcache/appcache_url_request_job.cc b/webkit/appcache/appcache_url_request_job.cc index 88b19d2..c70cd7a 100644 --- a/webkit/appcache/appcache_url_request_job.cc +++ b/webkit/appcache/appcache_url_request_job.cc @@ -20,7 +20,7 @@ namespace appcache { AppCacheURLRequestJob::AppCacheURLRequestJob( - URLRequest* request, AppCacheStorage* storage) + net::URLRequest* request, AppCacheStorage* storage) : URLRequestJob(request), storage_(storage), has_been_started_(false), has_been_killed_(false), delivery_type_(AWAITING_DELIVERY_ORDERS), diff --git a/webkit/appcache/appcache_url_request_job_unittest.cc b/webkit/appcache/appcache_url_request_job_unittest.cc index 2475c79..b64f079b 100644 --- a/webkit/appcache/appcache_url_request_job_unittest.cc +++ b/webkit/appcache/appcache_url_request_job_unittest.cc @@ -56,7 +56,7 @@ class AppCacheURLRequestJobTest : public testing::Test { AppCacheURLRequestJobTest* test_; }; - class MockURLRequestDelegate : public URLRequest::Delegate { + class MockURLRequestDelegate : public net::URLRequest::Delegate { public: explicit MockURLRequestDelegate(AppCacheURLRequestJobTest* test) : test_(test), @@ -65,7 +65,7 @@ class AppCacheURLRequestJobTest : public testing::Test { kill_after_amount_received_(0), kill_with_io_pending_(false) { } - virtual void OnResponseStarted(URLRequest* request) { + virtual void OnResponseStarted(net::URLRequest* request) { amount_received_ = 0; did_receive_headers_ = false; if (request->status().is_success()) { @@ -78,7 +78,7 @@ class AppCacheURLRequestJobTest : public testing::Test { } } - virtual void OnReadCompleted(URLRequest* request, int bytes_read) { + virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) { if (bytes_read > 0) { amount_received_ += bytes_read; @@ -102,7 +102,7 @@ class AppCacheURLRequestJobTest : public testing::Test { } } - void ReadSome(URLRequest* request) { + void ReadSome(net::URLRequest* request) { DCHECK(amount_received_ + kBlockSize <= kNumBlocks * kBlockSize); scoped_refptr<IOBuffer> wrapped_buffer( new net::WrappedIOBuffer(received_data_->data() + amount_received_)); @@ -124,7 +124,7 @@ class AppCacheURLRequestJobTest : public testing::Test { bool kill_with_io_pending_; }; - static URLRequestJob* MockHttpJobFactory(URLRequest* request, + static URLRequestJob* MockHttpJobFactory(net::URLRequest* request, const std::string& scheme) { if (mock_factory_job_) { URLRequestJob* temp = mock_factory_job_; @@ -186,7 +186,7 @@ class AppCacheURLRequestJobTest : public testing::Test { void SetUpTest() { DCHECK(MessageLoop::current() == io_thread_->message_loop()); DCHECK(task_stack_.empty()); - orig_http_factory_ = URLRequest::RegisterProtocolFactory( + orig_http_factory_ = net::URLRequest::RegisterProtocolFactory( "http", MockHttpJobFactory); url_request_delegate_.reset(new MockURLRequestDelegate(this)); storage_delegate_.reset(new MockStorageDelegate(this)); @@ -204,7 +204,7 @@ class AppCacheURLRequestJobTest : public testing::Test { void TearDownTest() { DCHECK(MessageLoop::current() == io_thread_->message_loop()); - URLRequest::RegisterProtocolFactory("http", orig_http_factory_); + net::URLRequest::RegisterProtocolFactory("http", orig_http_factory_); orig_http_factory_ = NULL; request_.reset(); url_request_delegate_.reset(); @@ -393,7 +393,7 @@ class AppCacheURLRequestJobTest : public testing::Test { // Basic ------------------------------------------------------------------- void Basic() { AppCacheStorage* storage = service_->storage(); - URLRequest request(GURL("http://blah/"), NULL); + net::URLRequest request(GURL("http://blah/"), NULL); scoped_refptr<AppCacheURLRequestJob> job; // Create an instance and see that it looks as expected. @@ -415,7 +415,7 @@ class AppCacheURLRequestJobTest : public testing::Test { // DeliveryOrders ----------------------------------------------------- void DeliveryOrders() { AppCacheStorage* storage = service_->storage(); - URLRequest request(GURL("http://blah/"), NULL); + net::URLRequest request(GURL("http://blah/"), NULL); scoped_refptr<AppCacheURLRequestJob> job; // Create an instance, give it a delivery order and see that @@ -456,7 +456,7 @@ class AppCacheURLRequestJobTest : public testing::Test { AppCacheStorage* storage = service_->storage(); request_.reset( - new URLRequest(GURL("http://blah/"), url_request_delegate_.get())); + new net::URLRequest(GURL("http://blah/"), url_request_delegate_.get())); // Setup to create an AppCacheURLRequestJob with orders to deliver // a network response. @@ -488,7 +488,7 @@ class AppCacheURLRequestJobTest : public testing::Test { AppCacheStorage* storage = service_->storage(); request_.reset( - new URLRequest(GURL("http://blah/"), url_request_delegate_.get())); + new net::URLRequest(GURL("http://blah/"), url_request_delegate_.get())); // Setup to create an AppCacheURLRequestJob with orders to deliver // a network response. @@ -517,7 +517,7 @@ class AppCacheURLRequestJobTest : public testing::Test { void DeliverSmallAppCachedResponse() { // This test has several async steps. // 1. Write a small response to response storage. - // 2. Use URLRequest to retrieve it. + // 2. Use net::URLRequest to retrieve it. // 3. Verify we received what we expected to receive. PushNextTask(NewRunnableMethod( @@ -534,7 +534,7 @@ class AppCacheURLRequestJobTest : public testing::Test { void RequestAppCachedResource(bool start_after_delivery_orders) { AppCacheStorage* storage = service_->storage(); request_.reset( - new URLRequest(GURL("http://blah/"), url_request_delegate_.get())); + new net::URLRequest(GURL("http://blah/"), url_request_delegate_.get())); // Setup to create an AppCacheURLRequestJob with orders to deliver // a network response. @@ -585,7 +585,7 @@ class AppCacheURLRequestJobTest : public testing::Test { void DeliverLargeAppCachedResponse() { // This test has several async steps. // 1. Write a large response to response storage. - // 2. Use URLRequest to retrieve it. + // 2. Use net::URLRequest to retrieve it. // 3. Verify we received what we expected to receive. PushNextTask(NewRunnableMethod( @@ -628,7 +628,7 @@ class AppCacheURLRequestJobTest : public testing::Test { void DeliverPartialResponse() { // This test has several async steps. // 1. Write a small response to response storage. - // 2. Use URLRequest to retrieve it a subset using a range request + // 2. Use net::URLRequest to retrieve it a subset using a range request // 3. Verify we received what we expected to receive. PushNextTask(NewRunnableMethod( this, &AppCacheURLRequestJobTest::VerifyDeliverPartialResponse)); @@ -643,7 +643,7 @@ class AppCacheURLRequestJobTest : public testing::Test { void MakeRangeRequest() { AppCacheStorage* storage = service_->storage(); request_.reset( - new URLRequest(GURL("http://blah/"), url_request_delegate_.get())); + new net::URLRequest(GURL("http://blah/"), url_request_delegate_.get())); // Request a range, the 3 middle chars out of 'Hello' net::HttpRequestHeaders extra_headers; @@ -692,7 +692,7 @@ class AppCacheURLRequestJobTest : public testing::Test { void CancelRequest() { // This test has several async steps. // 1. Write a large response to response storage. - // 2. Use URLRequest to retrieve it. + // 2. Use net::URLRequest to retrieve it. // 3. Cancel the request after data starts coming in. PushNextTask(NewRunnableMethod( @@ -720,7 +720,7 @@ class AppCacheURLRequestJobTest : public testing::Test { void CancelRequestWithIOPending() { // This test has several async steps. // 1. Write a large response to response storage. - // 2. Use URLRequest to retrieve it. + // 2. Use net::URLRequest to retrieve it. // 3. Cancel the request after data starts coming in. PushNextTask(NewRunnableMethod( @@ -766,8 +766,8 @@ class AppCacheURLRequestJobTest : public testing::Test { int writer_deletion_count_down_; bool write_callback_was_called_; - URLRequest::ProtocolFactory* orig_http_factory_; - scoped_ptr<URLRequest> request_; + net::URLRequest::ProtocolFactory* orig_http_factory_; + scoped_ptr<net::URLRequest> request_; scoped_ptr<MockURLRequestDelegate> url_request_delegate_; static scoped_ptr<base::Thread> io_thread_; diff --git a/webkit/appcache/view_appcache_internals_job.cc b/webkit/appcache/view_appcache_internals_job.cc index 0819cd7..7679dc8 100644 --- a/webkit/appcache/view_appcache_internals_job.cc +++ b/webkit/appcache/view_appcache_internals_job.cc @@ -152,7 +152,7 @@ struct ManifestURLComparator { namespace appcache { ViewAppCacheInternalsJob::ViewAppCacheInternalsJob( - URLRequest* request, + net::URLRequest* request, AppCacheService* service) : URLRequestSimpleJob(request), appcache_service_(service) { } |