diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-06 09:53:55 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-06 09:53:55 +0000 |
commit | d18720ad3e1ade562630746980bf25dd760e9574 (patch) | |
tree | 099d51c9d98985a971509bc0ef960e8391a6d23b /content | |
parent | e96322d2c8b894f74cea00a48b4c98dee14e5968 (diff) | |
download | chromium_src-d18720ad3e1ade562630746980bf25dd760e9574.zip chromium_src-d18720ad3e1ade562630746980bf25dd760e9574.tar.gz chromium_src-d18720ad3e1ade562630746980bf25dd760e9574.tar.bz2 |
Add LayeredResourceHandler for eliminating duplication of code in
ResourceHandler subclasses that just delegate to the next handler.
Review URL: http://codereview.chromium.org/9113032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
11 files changed, 177 insertions, 140 deletions
diff --git a/content/browser/renderer_host/buffered_resource_handler.cc b/content/browser/renderer_host/buffered_resource_handler.cc index e1ecc9b..1990941 100644 --- a/content/browser/renderer_host/buffered_resource_handler.cc +++ b/content/browser/renderer_host/buffered_resource_handler.cc @@ -29,6 +29,8 @@ #include "net/http/http_response_headers.h" #include "webkit/plugins/webplugininfo.h" +namespace content { + namespace { void RecordSnifferMetrics(bool sniffing_blocked, @@ -61,7 +63,7 @@ void RecordSnifferMetrics(bool sniffing_blocked, BufferedResourceHandler::BufferedResourceHandler(ResourceHandler* handler, ResourceDispatcherHost* host, net::URLRequest* request) - : real_handler_(handler), + : LayeredResourceHandler(handler), host_(host), request_(request), read_buffer_size_(0), @@ -72,46 +74,18 @@ BufferedResourceHandler::BufferedResourceHandler(ResourceHandler* handler, finished_(false) { } -bool BufferedResourceHandler::OnUploadProgress(int request_id, - uint64 position, - uint64 size) { - return real_handler_->OnUploadProgress(request_id, position, size); -} - -bool BufferedResourceHandler::OnRequestRedirected( - int request_id, - const GURL& new_url, - content::ResourceResponse* response, - bool* defer) { - return real_handler_->OnRequestRedirected( - request_id, new_url, response, defer); -} - bool BufferedResourceHandler::OnResponseStarted( int request_id, - content::ResourceResponse* response) { + ResourceResponse* response) { response_ = response; if (!DelayResponse()) return CompleteResponseStarted(request_id); return true; } -bool BufferedResourceHandler::OnResponseCompleted( - int request_id, - const net::URLRequestStatus& status, - const std::string& security_info) { - return real_handler_->OnResponseCompleted(request_id, status, security_info); -} - void BufferedResourceHandler::OnRequestClosed() { request_ = NULL; - real_handler_->OnRequestClosed(); -} - -bool BufferedResourceHandler::OnWillStart(int request_id, - const GURL& url, - bool* defer) { - return real_handler_->OnWillStart(request_id, url, defer); + next_handler_->OnRequestClosed(); } // We'll let the original event handler provide a buffer, and reuse it for @@ -129,7 +103,7 @@ bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, if (finished_) return false; - if (!real_handler_->OnWillRead(request_id, buf, buf_size, min_size)) { + if (!next_handler_->OnWillRead(request_id, buf, buf_size, min_size)) { return false; } read_buffer_ = *buf; @@ -161,7 +135,7 @@ bool BufferedResourceHandler::OnReadCompleted(int request_id, int* bytes_read) { // Release the reference that we acquired at OnWillRead. read_buffer_ = NULL; - return real_handler_->OnReadCompleted(request_id, bytes_read); + return next_handler_->OnReadCompleted(request_id, bytes_read); } BufferedResourceHandler::~BufferedResourceHandler() {} @@ -342,7 +316,7 @@ bool BufferedResourceHandler::CompleteResponseStarted(int request_id) { UseAlternateResourceHandler(request_id, handler); } - return real_handler_->OnResponseStarted(request_id, response_); + return next_handler_->OnResponseStarted(request_id, response_); } bool BufferedResourceHandler::ShouldWaitForPlugins() { @@ -449,9 +423,9 @@ void BufferedResourceHandler::UseAlternateResourceHandler( // Inform the original ResourceHandler that this will be handled entirely by // the new ResourceHandler. - real_handler_->OnResponseStarted(info->request_id(), response_); + next_handler_->OnResponseStarted(info->request_id(), response_); net::URLRequestStatus status(net::URLRequestStatus::HANDLED_EXTERNALLY, 0); - real_handler_->OnResponseCompleted(info->request_id(), status, std::string()); + next_handler_->OnResponseCompleted(info->request_id(), status, std::string()); // Remove the non-owning pointer to the CrossSiteResourceHandler, if any, // from the extra request info because the CrossSiteResourceHandler (part of @@ -460,7 +434,7 @@ void BufferedResourceHandler::UseAlternateResourceHandler( // This is handled entirely within the new ResourceHandler, so just reset the // original ResourceHandler. - real_handler_ = handler; + next_handler_ = handler; } void BufferedResourceHandler::OnPluginsLoaded( @@ -475,3 +449,5 @@ void BufferedResourceHandler::OnPluginsLoaded( if (!CompleteResponseStarted(info->request_id())) host_->CancelRequest(info->child_id(), info->request_id(), false); } + +} // namespace content diff --git a/content/browser/renderer_host/buffered_resource_handler.h b/content/browser/renderer_host/buffered_resource_handler.h index 3e2f3c1..e53794d 100644 --- a/content/browser/renderer_host/buffered_resource_handler.h +++ b/content/browser/renderer_host/buffered_resource_handler.h @@ -8,7 +8,7 @@ #include <string> -#include "content/browser/renderer_host/resource_handler.h" +#include "content/browser/renderer_host/layered_resource_handler.h" class ResourceDispatcherHost; @@ -20,34 +20,23 @@ namespace webkit { struct WebPluginInfo; } +namespace content { + // Used to buffer a request until enough data has been received. -class BufferedResourceHandler : public ResourceHandler { +class BufferedResourceHandler : public LayeredResourceHandler { public: BufferedResourceHandler(ResourceHandler* handler, ResourceDispatcherHost* host, net::URLRequest* request); // ResourceHandler implementation: - virtual bool OnUploadProgress(int request_id, - uint64 position, - uint64 size) OVERRIDE; - virtual bool OnRequestRedirected(int request_id, - const GURL& new_url, - content::ResourceResponse* response, - bool* defer) OVERRIDE; virtual bool OnResponseStarted(int request_id, content::ResourceResponse* response) OVERRIDE; - virtual bool OnWillStart(int request_id, - const GURL& url, - bool* defer) OVERRIDE; virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, int min_size) OVERRIDE; virtual bool OnReadCompleted(int request_id, int* bytes_read) OVERRIDE; - virtual bool OnResponseCompleted(int request_id, - const net::URLRequestStatus& status, - const std::string& security_info) OVERRIDE; virtual void OnRequestClosed() OVERRIDE; private: @@ -83,7 +72,6 @@ class BufferedResourceHandler : public ResourceHandler { // Called on the IO thread once the list of plugins has been loaded. void OnPluginsLoaded(const std::vector<webkit::WebPluginInfo>& plugins); - scoped_refptr<ResourceHandler> real_handler_; scoped_refptr<content::ResourceResponse> response_; ResourceDispatcherHost* host_; net::URLRequest* request_; @@ -99,4 +87,6 @@ class BufferedResourceHandler : public ResourceHandler { DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); }; +} // namespace content + #endif // CONTENT_BROWSER_RENDERER_HOST_BUFFERED_RESOURCE_HANDLER_H_ diff --git a/content/browser/renderer_host/cross_site_resource_handler.cc b/content/browser/renderer_host/cross_site_resource_handler.cc index b93ea22..a1950f2 100644 --- a/content/browser/renderer_host/cross_site_resource_handler.cc +++ b/content/browser/renderer_host/cross_site_resource_handler.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,7 +18,7 @@ #include "net/base/io_buffer.h" #include "net/http/http_response_headers.h" -using content::GlobalRequestID; +namespace content { namespace { @@ -40,7 +40,7 @@ CrossSiteResourceHandler::CrossSiteResourceHandler( int render_process_host_id, int render_view_id, ResourceDispatcherHost* resource_dispatcher_host) - : next_handler_(handler), + : LayeredResourceHandler(handler), render_process_host_id_(render_process_host_id), render_view_id_(render_view_id), has_started_response_(false), @@ -49,18 +49,13 @@ CrossSiteResourceHandler::CrossSiteResourceHandler( completed_during_transition_(false), completed_status_(), response_(NULL), - rdh_(resource_dispatcher_host) {} - -bool CrossSiteResourceHandler::OnUploadProgress(int request_id, - uint64 position, - uint64 size) { - return next_handler_->OnUploadProgress(request_id, position, size); + rdh_(resource_dispatcher_host) { } bool CrossSiteResourceHandler::OnRequestRedirected( int request_id, const GURL& new_url, - content::ResourceResponse* response, + ResourceResponse* response, bool* defer) { // We should not have started the transition before being redirected. DCHECK(!in_cross_site_transition_); @@ -70,7 +65,7 @@ bool CrossSiteResourceHandler::OnRequestRedirected( bool CrossSiteResourceHandler::OnResponseStarted( int request_id, - content::ResourceResponse* response) { + ResourceResponse* response) { // At this point, we know that the response is safe to send back to the // renderer: it is not a download, and it has passed the SSL and safe // browsing checks. @@ -110,17 +105,6 @@ bool CrossSiteResourceHandler::OnResponseStarted( return true; } -bool CrossSiteResourceHandler::OnWillStart(int request_id, - const GURL& url, - bool* defer) { - return next_handler_->OnWillStart(request_id, url, defer); -} - -bool CrossSiteResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, - int* buf_size, int min_size) { - return next_handler_->OnWillRead(request_id, buf, buf_size, min_size); -} - bool CrossSiteResourceHandler::OnReadCompleted(int request_id, int* bytes_read) { if (!in_cross_site_transition_) { @@ -160,10 +144,6 @@ bool CrossSiteResourceHandler::OnResponseCompleted( return false; } -void CrossSiteResourceHandler::OnRequestClosed() { - next_handler_->OnRequestClosed(); -} - // We can now send the response to the new renderer, which will cause // TabContents to swap in the new renderer and destroy the old one. void CrossSiteResourceHandler::ResumeResponse() { @@ -209,7 +189,7 @@ CrossSiteResourceHandler::~CrossSiteResourceHandler() {} // telling the old RenderViewHost to run its onunload handler. void CrossSiteResourceHandler::StartCrossSiteTransition( int request_id, - content::ResourceResponse* response, + ResourceResponse* response, const GlobalRequestID& global_id) { in_cross_site_transition_ = true; request_id_ = request_id; @@ -238,8 +218,8 @@ void CrossSiteResourceHandler::StartCrossSiteTransition( // Tell the tab responsible for this request that a cross-site response is // starting, so that it can tell its old renderer to run its onunload // handler now. We will wait to hear the corresponding ClosePage_ACK. - content::BrowserThread::PostTask( - content::BrowserThread::UI, + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, base::Bind( &OnCrossSiteResponseHelper, @@ -250,3 +230,5 @@ void CrossSiteResourceHandler::StartCrossSiteTransition( // TODO(creis): If the above call should fail, then we need to notify the IO // thread to proceed anyway, using ResourceDispatcherHost::OnClosePageACK. } + +} // namespace content diff --git a/content/browser/renderer_host/cross_site_resource_handler.h b/content/browser/renderer_host/cross_site_resource_handler.h index 45e3d15..7a25d80 100644 --- a/content/browser/renderer_host/cross_site_resource_handler.h +++ b/content/browser/renderer_host/cross_site_resource_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,21 +6,20 @@ #define CONTENT_BROWSER_RENDERER_HOST_CROSS_SITE_RESOURCE_HANDLER_H_ #pragma once -#include "content/browser/renderer_host/resource_handler.h" +#include "content/browser/renderer_host/layered_resource_handler.h" #include "net/url_request/url_request_status.h" class ResourceDispatcherHost; namespace content { struct GlobalRequestID; -} // Ensures that cross-site responses are delayed until the onunload handler of // the previous page is allowed to run. This handler wraps an // AsyncEventHandler, and it sits inside SafeBrowsing and Buffered event // handlers. This is important, so that it can intercept OnResponseStarted // after we determine that a response is safe and not a download. -class CrossSiteResourceHandler : public ResourceHandler { +class CrossSiteResourceHandler : public LayeredResourceHandler { public: CrossSiteResourceHandler(ResourceHandler* handler, int render_process_host_id, @@ -28,28 +27,17 @@ class CrossSiteResourceHandler : public ResourceHandler { ResourceDispatcherHost* resource_dispatcher_host); // ResourceHandler implementation: - virtual bool OnUploadProgress(int request_id, - uint64 position, - uint64 size) OVERRIDE; virtual bool OnRequestRedirected(int request_id, const GURL& new_url, content::ResourceResponse* response, bool* defer) OVERRIDE; virtual bool OnResponseStarted(int request_id, content::ResourceResponse* response) OVERRIDE; - virtual bool OnWillStart(int request_id, - const GURL& url, - bool* defer) OVERRIDE; - virtual bool OnWillRead(int request_id, - net::IOBuffer** buf, - int* buf_size, - int min_size) OVERRIDE; virtual bool OnReadCompleted(int request_id, int* bytes_read) OVERRIDE; virtual bool OnResponseCompleted(int request_id, const net::URLRequestStatus& status, const std::string& security_info) OVERRIDE; - virtual void OnRequestClosed() OVERRIDE; // We can now send the response to the new renderer, which will cause // TabContents to swap in the new renderer and destroy the old one. @@ -65,7 +53,6 @@ class CrossSiteResourceHandler : public ResourceHandler { content::ResourceResponse* response, const content::GlobalRequestID& global_id); - scoped_refptr<ResourceHandler> next_handler_; int render_process_host_id_; int render_view_id_; bool has_started_response_; @@ -80,4 +67,6 @@ class CrossSiteResourceHandler : public ResourceHandler { DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler); }; +} // namespace content + #endif // CONTENT_BROWSER_RENDERER_HOST_CROSS_SITE_RESOURCE_HANDLER_H_ diff --git a/content/browser/renderer_host/layered_resource_handler.cc b/content/browser/renderer_host/layered_resource_handler.cc new file mode 100644 index 0000000..47b86dd --- /dev/null +++ b/content/browser/renderer_host/layered_resource_handler.cc @@ -0,0 +1,64 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/renderer_host/layered_resource_handler.h" + +namespace content { + +LayeredResourceHandler::LayeredResourceHandler(ResourceHandler* next_handler) + : next_handler_(next_handler) { + DCHECK(next_handler_); +} + +bool LayeredResourceHandler::OnUploadProgress(int request_id, uint64 position, + uint64 size) { + return next_handler_->OnUploadProgress(request_id, position, size); +} + +bool LayeredResourceHandler::OnRequestRedirected(int request_id, + const GURL& url, + ResourceResponse* response, + bool* defer) { + return next_handler_->OnRequestRedirected(request_id, url, response, defer); +} + +bool LayeredResourceHandler::OnResponseStarted(int request_id, + ResourceResponse* response) { + return next_handler_->OnResponseStarted(request_id, response); +} + +bool LayeredResourceHandler::OnWillStart(int request_id, const GURL& url, + bool* defer) { + return next_handler_->OnWillStart(request_id, url, defer); +} + +bool LayeredResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf, + int* buf_size, int min_size) { + return next_handler_->OnWillRead(request_id, buf, buf_size, min_size); +} + +bool LayeredResourceHandler::OnReadCompleted(int request_id, int* bytes_read) { + return next_handler_->OnReadCompleted(request_id, bytes_read); +} + +bool LayeredResourceHandler::OnResponseCompleted( + int request_id, + const net::URLRequestStatus& status, + const std::string& security_info) { + return next_handler_->OnResponseCompleted(request_id, status, security_info); +} + +void LayeredResourceHandler::OnRequestClosed() { + next_handler_->OnRequestClosed(); +} + +void LayeredResourceHandler::OnDataDownloaded(int request_id, + int bytes_downloaded) { + next_handler_->OnDataDownloaded(request_id, bytes_downloaded); +} + +LayeredResourceHandler::~LayeredResourceHandler() { +} + +} // namespace content diff --git a/content/browser/renderer_host/layered_resource_handler.h b/content/browser/renderer_host/layered_resource_handler.h new file mode 100644 index 0000000..860f68c --- /dev/null +++ b/content/browser/renderer_host/layered_resource_handler.h @@ -0,0 +1,46 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_RENDERER_HOST_LAYERED_RESOURCE_HANDLER_H_ +#define CONTENT_BROWSER_RENDERER_HOST_LAYERED_RESOURCE_HANDLER_H_ +#pragma once + +#include "content/browser/renderer_host/resource_handler.h" + +namespace content { + +// A ResourceHandler that simply delegates all calls to a next handler. This +// class is intended to be subclassed. +class LayeredResourceHandler : public ResourceHandler { + public: + LayeredResourceHandler(ResourceHandler* next_handler); + + // ResourceHandler implementation: + virtual bool OnUploadProgress(int request_id, uint64 position, + uint64 size) OVERRIDE; + virtual bool OnRequestRedirected(int request_id, const GURL& url, + ResourceResponse* response, + bool* defer) OVERRIDE; + virtual bool OnResponseStarted(int request_id, + ResourceResponse* response) OVERRIDE; + virtual bool OnWillStart(int request_id, const GURL& url, + bool* defer) OVERRIDE; + virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, + int min_size) OVERRIDE; + virtual bool OnReadCompleted(int request_id, int* bytes_read) OVERRIDE; + virtual bool OnResponseCompleted(int request_id, + const net::URLRequestStatus& status, + const std::string& security_info) OVERRIDE; + virtual void OnRequestClosed() OVERRIDE; + virtual void OnDataDownloaded(int request_id, int bytes_downloaded) OVERRIDE; + + protected: + virtual ~LayeredResourceHandler(); + + scoped_refptr<ResourceHandler> next_handler_; +}; + +} // namespace content + +#endif // CONTENT_BROWSER_RENDERER_HOST_LAYERED_RESOURCE_HANDLER_H_ diff --git a/content/browser/renderer_host/redirect_to_file_resource_handler.cc b/content/browser/renderer_host/redirect_to_file_resource_handler.cc index 9b16495..b24ed44 100644 --- a/content/browser/renderer_host/redirect_to_file_resource_handler.cc +++ b/content/browser/renderer_host/redirect_to_file_resource_handler.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,9 +19,10 @@ #include "net/base/net_errors.h" #include "webkit/blob/deletable_file_reference.h" -using content::BrowserThread; using webkit_blob::DeletableFileReference; +namespace content { + // TODO(darin): Use the buffer sizing algorithm from AsyncResourceHandler. static const int kReadBufSize = 32768; @@ -29,9 +30,9 @@ RedirectToFileResourceHandler::RedirectToFileResourceHandler( ResourceHandler* next_handler, int process_id, ResourceDispatcherHost* host) - : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), + : LayeredResourceHandler(next_handler), + ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), host_(host), - next_handler_(next_handler), process_id_(process_id), request_id_(-1), buf_(new net::GrowableIOBuffer()), @@ -42,21 +43,6 @@ RedirectToFileResourceHandler::RedirectToFileResourceHandler( completed_during_write_(false) { } -bool RedirectToFileResourceHandler::OnUploadProgress(int request_id, - uint64 position, - uint64 size) { - return next_handler_->OnUploadProgress(request_id, position, size); -} - -bool RedirectToFileResourceHandler::OnRequestRedirected( - int request_id, - const GURL& new_url, - content::ResourceResponse* response, - bool* defer) { - return next_handler_->OnRequestRedirected(request_id, new_url, response, - defer); -} - bool RedirectToFileResourceHandler::OnResponseStarted( int request_id, content::ResourceResponse* response) { @@ -246,3 +232,5 @@ bool RedirectToFileResourceHandler::BufIsFull() const { // TODO(darin): Fix this retardation! return buf_->RemainingCapacity() <= (2 * net::kMaxBytesToSniff); } + +} // namespace content diff --git a/content/browser/renderer_host/redirect_to_file_resource_handler.h b/content/browser/renderer_host/redirect_to_file_resource_handler.h index b810b05..285980e 100644 --- a/content/browser/renderer_host/redirect_to_file_resource_handler.h +++ b/content/browser/renderer_host/redirect_to_file_resource_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,7 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/platform_file.h" -#include "content/browser/renderer_host/resource_handler.h" +#include "content/browser/renderer_host/layered_resource_handler.h" #include "net/url_request/url_request_status.h" class ResourceDispatcherHost; @@ -24,9 +24,11 @@ namespace webkit_blob { class DeletableFileReference; } +namespace content { + // Redirects network data to a file. This is intended to be layered in front // of either the AsyncResourceHandler or the SyncResourceHandler. -class RedirectToFileResourceHandler : public ResourceHandler { +class RedirectToFileResourceHandler : public LayeredResourceHandler { public: RedirectToFileResourceHandler( ResourceHandler* next_handler, @@ -34,15 +36,8 @@ class RedirectToFileResourceHandler : public ResourceHandler { ResourceDispatcherHost* resource_dispatcher_host); // ResourceHandler implementation: - virtual bool OnUploadProgress(int request_id, - uint64 position, - uint64 size) OVERRIDE; - virtual bool OnRequestRedirected(int request_id, - const GURL& new_url, - content::ResourceResponse* response, - bool* defer) OVERRIDE; virtual bool OnResponseStarted(int request_id, - content::ResourceResponse* response) OVERRIDE; + ResourceResponse* response) OVERRIDE; virtual bool OnWillStart(int request_id, const GURL& url, bool* defer) OVERRIDE; @@ -69,7 +64,6 @@ class RedirectToFileResourceHandler : public ResourceHandler { base::WeakPtrFactory<RedirectToFileResourceHandler> weak_factory_; ResourceDispatcherHost* host_; - scoped_refptr<ResourceHandler> next_handler_; int process_id_; int request_id_; @@ -101,4 +95,6 @@ class RedirectToFileResourceHandler : public ResourceHandler { DISALLOW_COPY_AND_ASSIGN(RedirectToFileResourceHandler); }; +} // namespace content + #endif // CONTENT_BROWSER_RENDERER_HOST_REDIRECT_TO_FILE_RESOURCE_HANDLER_H_ diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc index a210f8d..0589208 100644 --- a/content/browser/renderer_host/resource_dispatcher_host.cc +++ b/content/browser/renderer_host/resource_dispatcher_host.cc @@ -527,7 +527,8 @@ void ResourceDispatcherHost::BeginRequest( // The RedirectToFileResourceHandler depends on being next in the chain. if (request_data.download_to_file) - handler = new RedirectToFileResourceHandler(handler, child_id, this); + handler = new content::RedirectToFileResourceHandler(handler, child_id, + this); if (HandleExternalProtocol(request_id, child_id, route_id, request_data.url, request_data.resource_type, @@ -608,14 +609,14 @@ void ResourceDispatcherHost::BeginRequest( HasPendingCrossSiteRequest(child_id, route_id)) { // Wrap the event handler to be sure the current page's onunload handler // has a chance to run before we render the new page. - handler = new CrossSiteResourceHandler(handler, - child_id, - route_id, - this); + handler = new content::CrossSiteResourceHandler(handler, + child_id, + route_id, + this); } // Insert a buffered event handler before the actual one. - handler = new BufferedResourceHandler(handler, this, request); + handler = new content::BufferedResourceHandler(handler, this, request); if (delegate_) { bool sub = request_data.resource_type != ResourceType::MAIN_FRAME; diff --git a/content/browser/renderer_host/resource_dispatcher_host_request_info.h b/content/browser/renderer_host/resource_dispatcher_host_request_info.h index 870345e..ed2ab09 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_request_info.h +++ b/content/browser/renderer_host/resource_dispatcher_host_request_info.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,13 +18,13 @@ #include "net/url_request/url_request.h" #include "webkit/glue/resource_type.h" -class CrossSiteResourceHandler; class ResourceDispatcherHost; class ResourceDispatcherHostLoginDelegate; class ResourceHandler; class SSLClientAuthHandler; namespace content { +class CrossSiteResourceHandler; class ResourceContext; } @@ -64,10 +64,10 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData { // CrossSiteResourceHandler for this request, if it is a cross-site request. // (NULL otherwise.) This handler is part of the chain of ResourceHandlers // pointed to by resource_handler, and is not owned by this class. - CrossSiteResourceHandler* cross_site_handler() { + content::CrossSiteResourceHandler* cross_site_handler() { return cross_site_handler_; } - void set_cross_site_handler(CrossSiteResourceHandler* h) { + void set_cross_site_handler(content::CrossSiteResourceHandler* h) { cross_site_handler_ = h; } @@ -222,7 +222,10 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData { void set_paused_read_bytes(int bytes) { paused_read_bytes_ = bytes; } scoped_refptr<ResourceHandler> resource_handler_; - CrossSiteResourceHandler* cross_site_handler_; // Non-owning, may be NULL. + + // Non-owning, may be NULL. + content::CrossSiteResourceHandler* cross_site_handler_; + scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; scoped_refptr<SSLClientAuthHandler> ssl_client_auth_handler_; content::ProcessType process_type_; diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 96b1f40..69db33a 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -432,6 +432,8 @@ 'browser/renderer_host/java/java_method.h', 'browser/renderer_host/java/java_type.cc', 'browser/renderer_host/java/java_type.h', + 'browser/renderer_host/layered_resource_handler.cc', + 'browser/renderer_host/layered_resource_handler.h', 'browser/renderer_host/media/audio_common.cc', 'browser/renderer_host/media/audio_common.h', 'browser/renderer_host/media/audio_input_device_manager.cc', |