Commit 9981685f authored by jam@chromium.org's avatar jam@chromium.org

Get rid of resource_messages.h include from chrome, since that's an internal detail of content.

BUG=98716
Review URL: http://codereview.chromium.org/8511080

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110324 0039d316-1c4b-4281-b951-d872f2087c98
parent ea433b5a
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h" #include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/browser/resource_context.h" #include "content/browser/resource_context.h"
#include "content/common/resource_messages.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "net/base/load_flags.h" #include "net/base/load_flags.h"
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/browser/renderer_host/resource_message_filter.h" #include "content/browser/renderer_host/resource_message_filter.h"
#include "content/browser/resource_context.h" #include "content/browser/resource_context.h"
#include "content/common/resource_messages.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h" #include "content/public/browser/notification_service.h"
#include "net/base/load_flags.h" #include "net/base/load_flags.h"
...@@ -103,17 +102,20 @@ ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() { ...@@ -103,17 +102,20 @@ ChromeResourceDispatcherHostDelegate::~ChromeResourceDispatcherHostDelegate() {
} }
bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest( bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest(
int child_id, int route_id, int child_id,
const ResourceHostMsg_Request& request_data, int route_id,
const std::string& method,
const GURL& url,
ResourceType::Type resource_type,
const content::ResourceContext& resource_context, const content::ResourceContext& resource_context,
const GURL& referrer) { const GURL& referrer) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// Handle a PREFETCH resource type. If prefetch is disabled, squelch the // Handle a PREFETCH resource type. If prefetch is disabled, squelch the
// request. Otherwise, do a normal request to warm the cache. // request. Otherwise, do a normal request to warm the cache.
if (request_data.resource_type == ResourceType::PREFETCH) { if (resource_type == ResourceType::PREFETCH) {
// All PREFETCH requests should be GETs, but be defensive about it. // All PREFETCH requests should be GETs, but be defensive about it.
if (request_data.method != "GET") if (method != "GET")
return false; return false;
// If prefetch is disabled, kill the request. // If prefetch is disabled, kill the request.
...@@ -123,14 +125,10 @@ bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest( ...@@ -123,14 +125,10 @@ bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest(
// Handle a PRERENDER motivated request. Very similar to rel=prefetch, these // Handle a PRERENDER motivated request. Very similar to rel=prefetch, these
// rel=prerender requests instead launch an early render of the entire page. // rel=prerender requests instead launch an early render of the entire page.
if (request_data.resource_type == ResourceType::PRERENDER) { if (resource_type == ResourceType::PRERENDER) {
if (prerender::PrerenderManager::IsPrerenderingPossible()) { if (prerender::PrerenderManager::IsPrerenderingPossible()) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&AddPrerenderOnUI, base::Bind(&AddPrerenderOnUI, child_id, route_id, url, referrer));
child_id,
route_id,
request_data.url,
referrer));
} }
// Prerendering or not, this request should be aborted. // Prerendering or not, this request should be aborted.
return false; return false;
...@@ -138,10 +136,9 @@ bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest( ...@@ -138,10 +136,9 @@ bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest(
// Abort any prerenders that spawn requests that use invalid HTTP methods. // Abort any prerenders that spawn requests that use invalid HTTP methods.
if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id) && if (prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id) &&
!prerender::PrerenderManager::IsValidHttpMethod(request_data.method)) { !prerender::PrerenderManager::IsValidHttpMethod(method)) {
prerender_tracker_->TryCancelOnIOThread( prerender_tracker_->TryCancelOnIOThread(
child_id, route_id, child_id, route_id, prerender::FINAL_STATUS_INVALID_HTTP_METHOD);
prerender::FINAL_STATUS_INVALID_HTTP_METHOD);
return false; return false;
} }
......
...@@ -34,8 +34,11 @@ class ChromeResourceDispatcherHostDelegate ...@@ -34,8 +34,11 @@ class ChromeResourceDispatcherHostDelegate
// ResourceDispatcherHostDelegate implementation. // ResourceDispatcherHostDelegate implementation.
virtual bool ShouldBeginRequest( virtual bool ShouldBeginRequest(
int child_id, int route_id, int child_id,
const ResourceHostMsg_Request& request_data, int route_id,
const std::string& method,
const GURL& url,
ResourceType::Type resource_type,
const content::ResourceContext& resource_context, const content::ResourceContext& resource_context,
const GURL& referrer) OVERRIDE; const GURL& referrer) OVERRIDE;
virtual ResourceHandler* RequestBeginning( virtual ResourceHandler* RequestBeginning(
......
...@@ -484,8 +484,11 @@ void ResourceDispatcherHost::BeginRequest( ...@@ -484,8 +484,11 @@ void ResourceDispatcherHost::BeginRequest(
const GURL referrer = MaybeStripReferrer(request_data.referrer); const GURL referrer = MaybeStripReferrer(request_data.referrer);
// Allow the observer to block/handle the request. // Allow the observer to block/handle the request.
if (delegate_ && !delegate_->ShouldBeginRequest(child_id, route_id, if (delegate_ && !delegate_->ShouldBeginRequest(child_id,
request_data, route_id,
request_data.method,
request_data.url,
request_data.resource_type,
resource_context, resource_context,
referrer)) { referrer)) {
AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id); AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id);
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
#include <string> #include <string>
#include "base/basictypes.h" #include "base/basictypes.h"
#include "webkit/glue/resource_type.h"
class GURL; class GURL;
class ResourceDispatcherHostLoginDelegate; class ResourceDispatcherHostLoginDelegate;
class ResourceHandler; class ResourceHandler;
class ResourceMessageFilter; class ResourceMessageFilter;
struct ResourceHostMsg_Request;
struct ResourceResponse; struct ResourceResponse;
namespace content { namespace content {
...@@ -35,8 +35,11 @@ class ResourceDispatcherHostDelegate { ...@@ -35,8 +35,11 @@ class ResourceDispatcherHostDelegate {
public: public:
// Called when a request begins. Return false to abort the request. // Called when a request begins. Return false to abort the request.
virtual bool ShouldBeginRequest( virtual bool ShouldBeginRequest(
int child_id, int route_id, int child_id,
const ResourceHostMsg_Request& request_data, int route_id,
const std::string& method,
const GURL& url,
ResourceType::Type resource_type,
const content::ResourceContext& resource_context, const content::ResourceContext& resource_context,
const GURL& referrer) = 0; const GURL& referrer) = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment