summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/DEPS3
-rw-r--r--chrome/browser/automation/url_request_automation_job.cc29
-rw-r--r--chrome/browser/chromeos/gview_request_interceptor.cc11
-rw-r--r--chrome/browser/chromeos/gview_request_interceptor_unittest.cc30
-rw-r--r--chrome/browser/extensions/api/webrequest/webrequest_api.cc24
-rw-r--r--chrome/browser/extensions/extension_protocols.cc10
-rw-r--r--chrome/browser/extensions/user_script_listener.cc1
-rw-r--r--chrome/browser/external_tab_container_win.cc1
-rw-r--r--chrome/browser/plugin_installer.cc4
-rw-r--r--chrome/browser/profiles/profile_io_data.cc6
-rw-r--r--chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc27
-rw-r--r--chrome/browser/renderer_host/offline_resource_throttle.cc2
-rw-r--r--chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc23
-rw-r--r--chrome/browser/ssl/ssl_add_cert_handler.cc8
-rw-r--r--chrome/browser/task_manager/task_manager.cc16
-rw-r--r--chrome/browser/ui/login/login_prompt.cc14
-rw-r--r--content/browser/download/download_resource_handler.cc7
-rw-r--r--content/browser/renderer_host/async_resource_handler.cc9
-rw-r--r--content/browser/renderer_host/buffered_resource_handler.cc39
-rw-r--r--content/browser/renderer_host/buffered_resource_handler.h4
-rw-r--r--content/browser/renderer_host/cross_site_resource_handler.cc8
-rw-r--r--content/browser/renderer_host/dummy_resource_handler.cc56
-rw-r--r--content/browser/renderer_host/dummy_resource_handler.h46
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host.cc231
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host.h21
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host_request_info.cc84
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host_uitest.cc2
-rw-r--r--content/browser/renderer_host/resource_dispatcher_host_unittest.cc3
-rw-r--r--content/browser/renderer_host/resource_request_details.cc13
-rw-r--r--content/browser/renderer_host/resource_request_info_impl.cc196
-rw-r--r--content/browser/renderer_host/resource_request_info_impl.h (renamed from content/browser/renderer_host/resource_dispatcher_host_request_info.h)119
-rw-r--r--content/browser/renderer_host/x509_user_cert_resource_handler.cc2
-rw-r--r--content/browser/ssl/ssl_client_auth_handler.cc7
-rw-r--r--content/browser/ssl/ssl_error_handler.cc13
-rw-r--r--content/browser/ssl/ssl_manager.cc9
-rw-r--r--content/browser/worker_host/worker_service_impl.cc4
-rw-r--r--content/content_browser.gypi5
-rw-r--r--content/content_tests.gypi2
-rw-r--r--content/public/browser/resource_request_info.h86
39 files changed, 598 insertions, 577 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index e3e0253..5e25505 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -49,14 +49,13 @@ include_rules = [
"+content/browser/net/url_request_slow_download_job.h",
"+content/browser/net/url_request_slow_http_job.h",
"+content/browser/plugin_service_filter.h",
- "+content/browser/renderer_host/dummy_resource_handler.h",
"+content/browser/renderer_host/mock_render_process_host.h",
"+content/browser/renderer_host/render_process_host_browsertest.h",
"+content/browser/renderer_host/render_view_host_factory.h",
"+content/browser/renderer_host/render_widget_host_view_mac_delegate.h",
"+content/browser/renderer_host/resource_dispatcher_host.h",
- "+content/browser/renderer_host/resource_dispatcher_host_request_info.h",
"+content/browser/renderer_host/resource_request_details.h",
+ "+content/browser/renderer_host/resource_request_info_impl.h",
"+content/browser/renderer_host/test_render_view_host.h",
"+content/browser/tab_contents/provisional_load_details.h",
"+content/browser/tab_contents/tab_contents_view_win.h",
diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc
index 231a4c5..8118483 100644
--- a/chrome/browser/automation/url_request_automation_job.cc
+++ b/chrome/browser/automation/url_request_automation_job.cc
@@ -10,10 +10,9 @@
#include "base/time.h"
#include "chrome/browser/automation/automation_resource_message_filter.h"
#include "chrome/common/automation_messages.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/resource_request_info.h"
#include "net/base/cookie_monster.h"
#include "net/base/host_port_pair.h"
#include "net/base/io_buffer.h"
@@ -26,6 +25,7 @@
using base::Time;
using base::TimeDelta;
using content::BrowserThread;
+using content::ResourceRequestInfo;
// The list of filtered headers that are removed from requests sent via
// StartAsync(). These must be lower case.
@@ -100,16 +100,15 @@ net::URLRequestJob* URLRequestAutomationJob::Factory(
// Returning null here just means that the built-in handler will be used.
if (scheme_is_http || scheme_is_https) {
- ResourceDispatcherHostRequestInfo* request_info =
- ResourceDispatcherHost::InfoForRequest(request);
- if (request_info) {
- int child_id = request_info->child_id();
- int route_id = request_info->route_id();
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
+ if (info) {
+ int child_id = info->GetChildID();
+ int route_id = info->GetRouteID();
AutomationResourceMessageFilter::AutomationDetails details;
if (AutomationResourceMessageFilter::LookupRegisteredRenderView(
child_id, route_id, &details)) {
URLRequestAutomationJob* job = new URLRequestAutomationJob(request,
- details.tab_handle, request_info->request_id(), details.filter,
+ details.tab_handle, info->GetRequestID(), details.filter,
details.is_pending_render_view);
return job;
}
@@ -234,10 +233,9 @@ uint64 URLRequestAutomationJob::GetUploadProgress() const {
// We don't support incremental progress notifications in ChromeFrame. When
// we receive a response for the POST request from Chromeframe, it means
// that the upload is fully complete.
- ResourceDispatcherHostRequestInfo* request_info =
- ResourceDispatcherHost::InfoForRequest(request_);
- if (request_info) {
- return request_info->upload_size();
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_);
+ if (info) {
+ return info->GetUploadSize();
}
}
return 0;
@@ -446,11 +444,10 @@ void URLRequestAutomationJob::StartAsync() {
}
// Get the resource type (main_frame/script/image/stylesheet etc.
- ResourceDispatcherHostRequestInfo* request_info =
- ResourceDispatcherHost::InfoForRequest(request_);
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_);
ResourceType::Type resource_type = ResourceType::MAIN_FRAME;
- if (request_info) {
- resource_type = request_info->resource_type();
+ if (info) {
+ resource_type = info->GetResourceType();
}
// Ask automation to start this request.
diff --git a/chrome/browser/chromeos/gview_request_interceptor.cc b/chrome/browser/chromeos/gview_request_interceptor.cc
index 996426f..67aa267 100644
--- a/chrome/browser/chromeos/gview_request_interceptor.cc
+++ b/chrome/browser/chromeos/gview_request_interceptor.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.
@@ -9,9 +9,8 @@
#include "chrome/browser/chrome_plugin_service_filter.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/plugin_service.h"
+#include "content/public/browser/resource_request_info.h"
#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
@@ -20,6 +19,7 @@
#include "webkit/plugins/webplugininfo.h"
using content::PluginService;
+using content::ResourceRequestInfo;
namespace chromeos {
@@ -67,8 +67,7 @@ bool GViewRequestInterceptor::ShouldUsePdfPlugin(
net::URLRequest* request) const {
FilePath pdf_path;
PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path);
- ResourceDispatcherHostRequestInfo* info =
- ResourceDispatcherHost::InfoForRequest(request);
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
if (!info)
return false;
@@ -78,7 +77,7 @@ bool GViewRequestInterceptor::ShouldUsePdfPlugin(
}
return ChromePluginServiceFilter::GetInstance()->ShouldUsePlugin(
- info->child_id(), info->route_id(), info->context(),
+ info->GetChildID(), info->GetRouteID(), info->GetContext(),
request->url(), GURL(), &plugin);
}
diff --git a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
index 5f0518b..00dfd38 100644
--- a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
+++ b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
@@ -13,12 +13,10 @@
#include "chrome/browser/plugin_prefs_factory.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/testing_pref_service.h"
-#include "content/browser/renderer_host/dummy_resource_handler.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/plugin_service.h"
+#include "content/public/browser/resource_request_info.h"
#include "content/test/mock_resource_context.h"
#include "content/test/test_browser_thread.h"
-#include "ipc/ipc_message.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job.h"
@@ -111,8 +109,6 @@ class GViewRequestInterceptorTest : public testing::Test {
ASSERT_TRUE(PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path_));
- handler_ = new content::DummyResourceHandler();
-
PluginService::GetInstance()->SetPluginListForTesting(&plugin_list_);
PluginService::GetInstance()->Init();
}
@@ -158,27 +154,8 @@ class GViewRequestInterceptorTest : public testing::Test {
}
void SetupRequest(net::URLRequest* request) {
- ResourceDispatcherHostRequestInfo* info =
- new ResourceDispatcherHostRequestInfo(
- handler_,
- content::PROCESS_TYPE_RENDERER,
- -1, // child_id
- MSG_ROUTING_NONE,
- 0, // origin_pid
- request->identifier(),
- false, // is_main_frame
- -1, // frame_id
- false, // parent_is_main_frame
- -1, // parent_frame_id
- ResourceType::MAIN_FRAME,
- content::PAGE_TRANSITION_LINK,
- 0, // upload_size
- false, // is_download
- true, // allow_download
- false, // has_user_gesture
- WebKit::WebReferrerPolicyDefault,
- &resource_context_);
- request->SetUserData(NULL, info);
+ content::ResourceRequestInfo::AllocateForTesting(request,
+ &resource_context_);
request->set_context(resource_context_.GetRequestContext());
}
@@ -193,7 +170,6 @@ class GViewRequestInterceptorTest : public testing::Test {
scoped_refptr<PluginPrefs> plugin_prefs_;
net::URLRequestJobFactory job_factory_;
const net::URLRequestJobFactory* old_factory_;
- scoped_refptr<ResourceHandler> handler_;
TestDelegate test_delegate_;
FilePath pdf_path_;
content::MockResourceContext resource_context_;
diff --git a/chrome/browser/extensions/api/webrequest/webrequest_api.cc b/chrome/browser/extensions/api/webrequest/webrequest_api.cc
index e4c49aa..01ad3aa 100644
--- a/chrome/browser/extensions/api/webrequest/webrequest_api.cc
+++ b/chrome/browser/extensions/api/webrequest/webrequest_api.cc
@@ -34,11 +34,10 @@
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/resource_request_info.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "net/base/auth.h"
@@ -50,6 +49,7 @@
using content::BrowserMessageFilter;
using content::BrowserThread;
+using content::ResourceRequestInfo;
namespace helpers = extension_webrequest_api_helpers;
namespace keys = extension_webrequest_api_constants;
@@ -126,15 +126,14 @@ bool IsRequestFromExtension(const net::URLRequest* request,
if (!extension_info_map)
return false;
- const ResourceDispatcherHostRequestInfo* info =
- ResourceDispatcherHost::InfoForRequest(request);
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
// If this request was not created by the ResourceDispatcher, |info| is NULL.
// All requests from extensions are created by the ResourceDispatcher.
if (!info)
return false;
- return extension_info_map->process_map().Contains(info->child_id());
+ return extension_info_map->process_map().Contains(info->GetChildID());
}
// Returns true if the URL is sensitive and requests to this URL must not be
@@ -209,19 +208,18 @@ void ExtractRequestInfoDetails(net::URLRequest* request,
if (!request->GetUserData(NULL))
return;
- ResourceDispatcherHostRequestInfo* info =
- ResourceDispatcherHost::InfoForRequest(request);
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
ExtensionTabIdMap::GetInstance()->GetTabAndWindowId(
- info->child_id(), info->route_id(), tab_id, window_id);
- *frame_id = info->frame_id();
- *is_main_frame = info->is_main_frame();
- *parent_frame_id = info->parent_frame_id();
- *parent_is_main_frame = info->parent_is_main_frame();
+ info->GetChildID(), info->GetRouteID(), tab_id, window_id);
+ *frame_id = info->GetFrameID();
+ *is_main_frame = info->IsMainFrame();
+ *parent_frame_id = info->GetParentFrameID();
+ *parent_is_main_frame = info->ParentIsMainFrame();
// Restrict the resource type to the values we care about.
ResourceType::Type* iter =
std::find(kResourceTypeValues, ARRAYEND(kResourceTypeValues),
- info->resource_type());
+ info->GetResourceType());
*resource_type = (iter != ARRAYEND(kResourceTypeValues)) ?
*iter : ResourceType::LAST_TYPE;
}
diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc
index e2dc94f..55f4354 100644
--- a/chrome/browser/extensions/extension_protocols.cc
+++ b/chrome/browser/extensions/extension_protocols.cc
@@ -22,8 +22,7 @@
#include "chrome/common/extensions/extension_file_util.h"
#include "chrome/common/extensions/extension_resource.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
+#include "content/public/browser/resource_request_info.h"
#include "googleurl/src/url_util.h"
#include "grit/component_extension_resources_map.h"
#include "net/base/mime_util.h"
@@ -35,6 +34,8 @@
#include "net/url_request/url_request_simple_job.h"
#include "ui/base/resource/resource_bundle.h"
+using content::ResourceRequestInfo;
+
namespace {
net::HttpResponseHeaders* BuildHttpHeaders(
@@ -178,8 +179,7 @@ bool ExtensionCanLoadInIncognito(const std::string& extension_id,
bool AllowExtensionResourceLoad(net::URLRequest* request,
bool is_incognito,
ExtensionInfoMap* extension_info_map) {
- const ResourceDispatcherHostRequestInfo* info =
- ResourceDispatcherHost::InfoForRequest(request);
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
// We have seen crashes where info is NULL: crbug.com/52374.
if (!info) {
@@ -193,7 +193,7 @@ bool AllowExtensionResourceLoad(net::URLRequest* request,
// This is because an extension must run in a single process, and an
// incognito tab prevents that.
if (is_incognito &&
- info->resource_type() == ResourceType::MAIN_FRAME &&
+ info->GetResourceType() == ResourceType::MAIN_FRAME &&
!ExtensionCanLoadInIncognito(request->url().host(), extension_info_map)) {
LOG(ERROR) << "Denying load of " << request->url().spec() << " from "
<< "incognito tab.";
diff --git a/chrome/browser/extensions/user_script_listener.cc b/chrome/browser/extensions/user_script_listener.cc
index 105a0a7..689e7e2 100644
--- a/chrome/browser/extensions/user_script_listener.cc
+++ b/chrome/browser/extensions/user_script_listener.cc
@@ -10,7 +10,6 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/url_pattern.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/resource_throttle.h"
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 53a3a1b..c12884d 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -41,7 +41,6 @@
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "content/browser/load_notification_details.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/browser/tab_contents/provisional_load_details.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/navigation_details.h"
diff --git a/chrome/browser/plugin_installer.cc b/chrome/browser/plugin_installer.cc
index 9af1e40..3c19056 100644
--- a/chrome/browser/plugin_installer.cc
+++ b/chrome/browser/plugin_installer.cc
@@ -31,13 +31,13 @@ using content::DownloadItem;
namespace {
void BeginDownload(const GURL& url,
- ResourceDispatcherHost* rdh,
content::ResourceContext* resource_context,
int render_process_host_id,
int render_view_host_routing_id,
const DownloadResourceHandler::OnStartedCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ ResourceDispatcherHost* rdh = ResourceDispatcherHost::Get();
scoped_ptr<net::URLRequest> request(
new net::URLRequest(url, rdh));
net::Error error = rdh->BeginDownload(
@@ -145,7 +145,7 @@ void PluginInstaller::StartInstalling(TabContentsWrapper* wrapper) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&BeginDownload,
- plugin_url_, ResourceDispatcherHost::Get(),
+ plugin_url_,
wrapper->profile()->GetResourceContext(),
web_contents->GetRenderProcessHost()->GetID(),
web_contents->GetRenderViewHost()->GetRoutingID(),
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index be8ae72..2d950c9 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -42,7 +42,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
+#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/notification_service.h"
@@ -66,6 +66,7 @@
using content::BrowserContext;
using content::BrowserThread;
using content::ResourceContext;
+using content::ResourceRequestInfoImpl;
namespace {
@@ -147,6 +148,7 @@ class ProtocolHandlerRegistryInterceptor
DISALLOW_COPY_AND_ASSIGN(ProtocolHandlerRegistryInterceptor);
};
+// TODO(darin): Move this class to src/content
class ChromeBlobProtocolHandler : public webkit_blob::BlobProtocolHandler {
public:
ChromeBlobProtocolHandler(
@@ -160,7 +162,7 @@ class ChromeBlobProtocolHandler : public webkit_blob::BlobProtocolHandler {
private:
virtual scoped_refptr<webkit_blob::BlobData>
LookupBlobData(net::URLRequest* request) const {
- ResourceDispatcherHostRequestInfo* info =
+ const ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request);
if (!info)
return NULL;
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
index b217056..86eeee2 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
@@ -30,11 +30,11 @@
#include "chrome/common/extensions/user_script.h"
#include "chrome/common/render_messages.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_context.h"
+#include "content/public/browser/resource_request_info.h"
#include "net/base/load_flags.h"
#include "net/base/ssl_config_service.h"
@@ -46,6 +46,7 @@
using content::BrowserThread;
using content::RenderViewHost;
using content::ResourceDispatcherHostLoginDelegate;
+using content::ResourceRequestInfo;
namespace {
@@ -215,8 +216,8 @@ bool ChromeResourceDispatcherHostDelegate::AcceptSSLClientCertificateRequest(
ChromeURLRequestUserData* user_data = ChromeURLRequestUserData::Get(request);
if (user_data && user_data->is_prerender()) {
int child_id, route_id;
- if (ResourceDispatcherHost::RenderViewForRequest(
- request, &child_id, &route_id)) {
+ if (ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView(
+ &child_id, &route_id)) {
if (prerender_tracker_->TryCancel(
child_id, route_id,
prerender::FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED)) {
@@ -236,8 +237,8 @@ bool ChromeResourceDispatcherHostDelegate::AcceptAuthRequest(
return true;
int child_id, route_id;
- if (!ResourceDispatcherHost::RenderViewForRequest(
- request, &child_id, &route_id)) {
+ if (!ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView(
+ &child_id, &route_id)) {
NOTREACHED();
return true;
}
@@ -311,8 +312,7 @@ void ChromeResourceDispatcherHostDelegate::OnResponseStarted(
IPC::Message::Sender* sender) {
LoadTimingObserver::PopulateTimingInfo(request, response);
- ResourceDispatcherHostRequestInfo* info =
- resource_dispatcher_host_->InfoForRequest(request);
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
if (request->url().SchemeIsSecure()) {
const net::URLRequestContext* context = request->context();
@@ -324,7 +324,7 @@ void ChromeResourceDispatcherHostDelegate::OnResponseStarted(
if (state->GetDomainState(
&domain_state, request->url().host(), has_sni)) {
sender->Send(new ChromeViewMsg_AddStrictSecurityHost(
- info->route_id(), request->url().host()));
+ info->GetRouteID(), request->url().host()));
}
}
}
@@ -332,8 +332,8 @@ void ChromeResourceDispatcherHostDelegate::OnResponseStarted(
// See if the response contains the X-Auto-Login header. If so, this was
// a request for a login page, and the server is allowing the browser to
// suggest auto-login, if available.
- AutoLoginPrompter::ShowInfoBarIfPossible(request, info->child_id(),
- info->route_id());
+ AutoLoginPrompter::ShowInfoBarIfPossible(request, info->GetChildID(),
+ info->GetRouteID());
}
void ChromeResourceDispatcherHostDelegate::OnRequestRedirected(
@@ -342,13 +342,12 @@ void ChromeResourceDispatcherHostDelegate::OnRequestRedirected(
LoadTimingObserver::PopulateTimingInfo(request, response);
#if defined(ENABLE_ONE_CLICK_SIGNIN)
- ResourceDispatcherHostRequestInfo* info =
- resource_dispatcher_host_->InfoForRequest(request);
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
// See if the response contains the X-Google-Accounts-SignIn header. If so,
// then the user has just finished signing in, and the server is allowing the
// browser to suggest connecting the user's profile to the account.
- OneClickSigninHelper::ShowInfoBarIfPossible(request, info->child_id(),
- info->route_id());
+ OneClickSigninHelper::ShowInfoBarIfPossible(request, info->GetChildID(),
+ info->GetRouteID());
#endif
}
diff --git a/chrome/browser/renderer_host/offline_resource_throttle.cc b/chrome/browser/renderer_host/offline_resource_throttle.cc
index 06d88b0..5de95a6 100644
--- a/chrome/browser/renderer_host/offline_resource_throttle.cc
+++ b/chrome/browser/renderer_host/offline_resource_throttle.cc
@@ -14,8 +14,6 @@
#include "chrome/browser/chromeos/offline/offline_load_page.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_view_host_delegate.h"
diff --git a/chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc b/chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc
index ee03ac3..d71ef19 100644
--- a/chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc
+++ b/chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc
@@ -9,13 +9,14 @@
#include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/common/extensions/extension_process_policy.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_view_host_delegate.h"
+#include "content/public/browser/resource_request_info.h"
#include "content/public/common/referrer.h"
using content::GlobalRequestID;
using content::RenderViewHostDelegate;
+using content::ResourceRequestInfo;
namespace {
@@ -25,7 +26,7 @@ void RequestTransferURLOnUIThread(int render_process_id,
const content::Referrer& referrer,
WindowOpenDisposition window_open_disposition,
int64 frame_id,
- const GlobalRequestID& request_id) {
+ const GlobalRequestID& global_request_id) {
content::RenderViewHost* rvh =
content::RenderViewHost::FromID(render_process_id, render_view_id);
if (!rvh)
@@ -36,8 +37,7 @@ void RequestTransferURLOnUIThread(int render_process_id,
return;
delegate->RequestTransferURL(
- new_url, referrer,
- window_open_disposition, frame_id, request_id);
+ new_url, referrer, window_open_disposition, frame_id, global_request_id);
}
} // namespace
@@ -55,24 +55,21 @@ void TransferNavigationResourceThrottle::WillRedirectRequest(
bool* defer) {
// TODO(darin): Move this logic into src/content.
- ResourceDispatcherHostRequestInfo* info =
- ResourceDispatcherHost::InfoForRequest(request_);
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_);
// If a toplevel request is redirecting across extension extents, we want to
// switch processes. We do this by deferring the redirect and resuming the
// request once the navigation controller properly assigns the right process
// to host the new URL.
// TODO(mpcomplete): handle for cases other than extensions (e.g. WebUI).
- content::ResourceContext* resource_context = info->context();
+ content::ResourceContext* resource_context = info->GetContext();
ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
if (extensions::CrossesExtensionProcessBoundary(
io_data->GetExtensionInfoMap()->extensions(),
ExtensionURLInfo(request_->url()), ExtensionURLInfo(new_url))) {
int render_process_id, render_view_id;
- if (ResourceDispatcherHost::RenderViewForRequest(
- request_, &render_process_id, &render_view_id)) {
-
- GlobalRequestID global_id(info->child_id(), info->request_id());
+ if (info->GetAssociatedRenderView(&render_process_id, &render_view_id)) {
+ GlobalRequestID global_id(info->GetChildID(), info->GetRequestID());
ResourceDispatcherHost::Get()->MarkAsTransferredNavigation(global_id,
request_);
@@ -83,8 +80,8 @@ void TransferNavigationResourceThrottle::WillRedirectRequest(
render_process_id, render_view_id,
new_url,
content::Referrer(GURL(request_->referrer()),
- info->referrer_policy()),
- CURRENT_TAB, info->frame_id(), global_id));
+ info->GetReferrerPolicy()),
+ CURRENT_TAB, info->GetFrameID(), global_id));
*defer = true;
}
diff --git a/chrome/browser/ssl/ssl_add_cert_handler.cc b/chrome/browser/ssl/ssl_add_cert_handler.cc
index 71084ed..740088f 100644
--- a/chrome/browser/ssl/ssl_add_cert_handler.cc
+++ b/chrome/browser/ssl/ssl_add_cert_handler.cc
@@ -8,9 +8,8 @@
#include "chrome/browser/tab_contents/tab_contents_ssl_helper.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/resource_request_info.h"
#include "content/public/browser/web_contents.h"
#include "net/base/cert_database.h"
#include "net/base/net_errors.h"
@@ -27,9 +26,8 @@ SSLAddCertHandler::SSLAddCertHandler(net::URLRequest* request,
: cert_(cert),
render_process_host_id_(render_process_host_id),
render_view_id_(render_view_id) {
- ResourceDispatcherHostRequestInfo* info =
- ResourceDispatcherHost::InfoForRequest(request);
- network_request_id_ = info->request_id();
+ network_request_id_
+ = content::ResourceRequestInfo::ForRequest(request)->GetRequestID();
// Stay alive until the process completes and Finished() is called.
AddRef();
// Delay adding the certificate until the next mainloop iteration.
diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc
index b10cf75..ad46354 100644
--- a/chrome/browser/task_manager/task_manager.cc
+++ b/chrome/browser/task_manager/task_manager.cc
@@ -29,12 +29,11 @@
#include "chrome/common/chrome_view_type.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/browser_child_process_host.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_view_host_delegate.h"
+#include "content/public/browser/resource_request_info.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/result_codes.h"
#include "grit/chromium_strings.h"
@@ -49,6 +48,7 @@
using content::BrowserThread;
using content::OpenURLParams;
using content::Referrer;
+using content::ResourceRequestInfo;
namespace {
@@ -972,22 +972,22 @@ void TaskManagerModel::BytesRead(BytesReadParam param) {
void TaskManagerModel::NotifyBytesRead(const net::URLRequest& request,
int byte_count) {
// Only net::URLRequestJob instances created by the ResourceDispatcherHost
+ // have an associated ResourceRequestInfo.
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(&request);
+
// have a render view associated. All other jobs will have -1 returned for
// the render process child and routing ids - the jobs may still match a
// resource based on their origin id, otherwise BytesRead() will attribute
// the activity to the Browser resource.
int render_process_host_child_id = -1, routing_id = -1;
- ResourceDispatcherHost::RenderViewForRequest(&request,
- &render_process_host_child_id,
- &routing_id);
+ if (info)
+ info->GetAssociatedRenderView(&render_process_host_child_id, &routing_id);
// Get the origin PID of the request's originator. This will only be set for
// plugins - for renderer or browser initiated requests it will be zero.
int origin_pid = 0;
- const ResourceDispatcherHostRequestInfo* info =
- ResourceDispatcherHost::InfoForRequest(&request);
if (info)
- origin_pid = info->origin_pid();
+ origin_pid = info->GetOriginPID();
// This happens in the IO thread, post it to the UI thread.
BrowserThread::PostTask(
diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc
index abf03fc..e30cfd4 100644
--- a/chrome/browser/ui/login/login_prompt.cc
+++ b/chrome/browser/ui/login/login_prompt.cc
@@ -16,12 +16,12 @@
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_view_host_delegate.h"
+#include "content/public/browser/resource_request_info.h"
#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
#include "net/base/auth.h"
@@ -36,6 +36,7 @@ using content::BrowserThread;
using content::NavigationController;
using content::RenderViewHost;
using content::RenderViewHostDelegate;
+using content::ResourceRequestInfo;
using content::WebContents;
using webkit::forms::PasswordForm;
@@ -45,12 +46,7 @@ class LoginHandlerImpl;
// Should only be called from the IO thread, since it accesses an
// net::URLRequest.
void ResetLoginHandlerForRequest(net::URLRequest* request) {
- ResourceDispatcherHostRequestInfo* info =
- ResourceDispatcherHost::InfoForRequest(request);
- if (!info)
- return;
-
- info->set_login_delegate(NULL);
+ ResourceDispatcherHost::ClearLoginDelegate(request);
}
// Get the signon_realm under which this auth info should be stored.
@@ -102,8 +98,8 @@ LoginHandler::LoginHandler(net::AuthChallengeInfo* auth_info,
BrowserThread::UI, FROM_HERE,
base::Bind(&LoginHandler::AddObservers, this));
- if (!ResourceDispatcherHost::RenderViewForRequest(
- request_, &render_process_host_id_, &tab_contents_id_)) {
+ if (!ResourceRequestInfo::ForRequest(request_)->GetAssociatedRenderView(
+ &render_process_host_id_, &tab_contents_id_)) {
NOTREACHED();
}
}
diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc
index 1227651..24d24e5 100644
--- a/content/browser/download/download_resource_handler.cc
+++ b/content/browser/download/download_resource_handler.cc
@@ -19,7 +19,7 @@
#include "content/browser/download/download_stats.h"
#include "content/browser/download/interrupt_reasons.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
+#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/download_manager_delegate.h"
@@ -33,6 +33,7 @@ using content::BrowserThread;
using content::DownloadId;
using content::DownloadItem;
using content::DownloadManager;
+using content::ResourceRequestInfoImpl;
DownloadResourceHandler::DownloadResourceHandler(
ResourceDispatcherHost* rdh,
@@ -92,8 +93,8 @@ bool DownloadResourceHandler::OnResponseStarted(
set_content_disposition(content_disposition);
set_content_length(response->content_length);
- const ResourceDispatcherHostRequestInfo* request_info =
- ResourceDispatcherHost::InfoForRequest(request_);
+ const ResourceRequestInfoImpl* request_info =
+ ResourceDispatcherHost::InfoForRequest(request_);
// Deleted in DownloadManager.
scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo(
diff --git a/content/browser/renderer_host/async_resource_handler.cc b/content/browser/renderer_host/async_resource_handler.cc
index d87737b..e31afe0 100644
--- a/content/browser/renderer_host/async_resource_handler.cc
+++ b/content/browser/renderer_host/async_resource_handler.cc
@@ -14,8 +14,8 @@
#include "content/browser/debugger/devtools_netlog_observer.h"
#include "content/browser/host_zoom_map_impl.h"
#include "content/browser/renderer_host/resource_dispatcher_host.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_request_info_impl.h"
#include "content/browser/resource_context_impl.h"
#include "content/common/resource_messages.h"
#include "content/common/view_messages.h"
@@ -30,6 +30,7 @@
using base::TimeTicks;
using content::GlobalRequestID;
using content::HostZoomMap;
+using content::ResourceRequestInfoImpl;
namespace {
@@ -138,11 +139,11 @@ bool AsyncResourceHandler::OnResponseStarted(
content::HostZoomMap* host_zoom_map =
content::GetHostZoomMapForResourceContext(resource_context);
- ResourceDispatcherHostRequestInfo* info = rdh_->InfoForRequest(request);
- if (info->resource_type() == ResourceType::MAIN_FRAME && host_zoom_map) {
+ ResourceRequestInfoImpl* info = rdh_->InfoForRequest(request);
+ if (info->GetResourceType() == ResourceType::MAIN_FRAME && host_zoom_map) {
GURL request_url(request->url());
filter_->Send(new ViewMsg_SetZoomLevelForLoadingURL(
- info->route_id(),
+ info->GetRouteID(),
request_url, host_zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(
request_url))));
}
diff --git a/content/browser/renderer_host/buffered_resource_handler.cc b/content/browser/renderer_host/buffered_resource_handler.cc
index 7feb154..e37d296 100644
--- a/content/browser/renderer_host/buffered_resource_handler.cc
+++ b/content/browser/renderer_host/buffered_resource_handler.cc
@@ -15,7 +15,7 @@
#include "content/browser/download/download_types.h"
#include "content/browser/plugin_service_impl.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
+#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/browser/renderer_host/x509_user_cert_resource_handler.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
@@ -117,7 +117,7 @@ bool BufferedResourceHandler::OnWillRead(int request_id, net::IOBuffer** buf,
}
bool BufferedResourceHandler::OnReadCompleted(int request_id, int* bytes_read) {
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request_);
if (sniff_content_) {
@@ -256,7 +256,7 @@ bool BufferedResourceHandler::KeepBuffering(int bytes_read) {
}
bool BufferedResourceHandler::CompleteResponseStarted(int request_id) {
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request_);
std::string mime_type;
request_->GetMimeType(&mime_type);
@@ -282,7 +282,7 @@ bool BufferedResourceHandler::CompleteResponseStarted(int request_id) {
X509UserCertResourceHandler* x509_cert_handler =
new X509UserCertResourceHandler(host_, request_,
- info->child_id(), info->route_id());
+ info->GetChildID(), info->GetRouteID());
if (!UseAlternateResourceHandler(request_id, x509_cert_handler))
return false;
}
@@ -307,10 +307,10 @@ bool BufferedResourceHandler::CompleteResponseStarted(int request_id) {
scoped_refptr<ResourceHandler> handler(
host_->CreateResourceHandlerForDownload(
request_,
- info->context(),
- info->child_id(),
- info->route_id(),
- info->request_id(),
+ info->GetContext(),
+ info->GetChildID(),
+ info->GetRouteID(),
+ info->GetRequestID(),
DownloadSaveInfo(),
DownloadResourceHandler::OnStartedCallback()));
@@ -330,9 +330,9 @@ bool BufferedResourceHandler::ShouldWaitForPlugins() {
return false;
// We don't want to keep buffering as our buffer will fill up.
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request_);
- host_->PauseRequest(info->child_id(), info->request_id(), true);
+ host_->PauseRequest(info->GetChildID(), info->GetRequestID(), true);
// Get the plugins asynchronously.
PluginServiceImpl::GetInstance()->GetPlugins(
@@ -366,12 +366,12 @@ bool BufferedResourceHandler::ShouldDownload(bool* need_plugin_list) {
// Finally, check the plugin list.
bool allow_wildcard = false;
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request_);
bool stale = false;
webkit::WebPluginInfo plugin;
bool found = PluginServiceImpl::GetInstance()->GetPluginInfo(
- info->child_id(), info->route_id(), info->context(),
+ info->GetChildID(), info->GetRouteID(), info->GetContext(),
request_->url(), GURL(), type, allow_wildcard,
&stale, &plugin, NULL);
@@ -400,7 +400,7 @@ bool BufferedResourceHandler::UseAlternateResourceHandler(
// Remove the non-owning pointer to the CrossSiteResourceHandler, if any,
// from the extra request info because the CrossSiteResourceHandler (part of
// the original ResourceHandler chain) will be deleted by the next statement.
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request_);
info->set_cross_site_handler(NULL);
@@ -416,7 +416,7 @@ bool BufferedResourceHandler::UseAlternateResourceHandler(
bool BufferedResourceHandler::ForwardPendingEventsToNextHandler(
int request_id) {
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request_);
if (info->pause_count())
return true;
@@ -460,11 +460,14 @@ void BufferedResourceHandler::OnPluginsLoaded(
if (!request_)
return;
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request_);
- host_->PauseRequest(info->child_id(), info->request_id(), false);
- if (!CompleteResponseStarted(info->request_id()))
- host_->CancelRequest(info->child_id(), info->request_id(), false);
+ int child_id = info->GetChildID();
+ int request_id = info->GetRequestID();
+
+ host_->PauseRequest(child_id, request_id, false);
+ if (!CompleteResponseStarted(request_id))
+ host_->CancelRequest(child_id, 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 ea6bb32..869d328 100644
--- a/content/browser/renderer_host/buffered_resource_handler.h
+++ b/content/browser/renderer_host/buffered_resource_handler.h
@@ -31,7 +31,7 @@ class BufferedResourceHandler : public LayeredResourceHandler {
// ResourceHandler implementation:
virtual bool OnResponseStarted(int request_id,
- content::ResourceResponse* response) OVERRIDE;
+ ResourceResponse* response) OVERRIDE;
virtual bool OnWillRead(int request_id,
net::IOBuffer** buf,
int* buf_size,
@@ -80,7 +80,7 @@ class BufferedResourceHandler : public LayeredResourceHandler {
// Called on the IO thread once the list of plugins has been loaded.
void OnPluginsLoaded(const std::vector<webkit::WebPluginInfo>& plugins);
- scoped_refptr<content::ResourceResponse> response_;
+ scoped_refptr<ResourceResponse> response_;
ResourceDispatcherHost* host_;
net::URLRequest* request_;
scoped_refptr<net::IOBuffer> read_buffer_;
diff --git a/content/browser/renderer_host/cross_site_resource_handler.cc b/content/browser/renderer_host/cross_site_resource_handler.cc
index 4ffc510..7f7cac7 100644
--- a/content/browser/renderer_host/cross_site_resource_handler.cc
+++ b/content/browser/renderer_host/cross_site_resource_handler.cc
@@ -10,7 +10,7 @@
#include "base/logging.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
+#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/global_request_id.h"
#include "content/public/browser/render_view_host_delegate.h"
@@ -80,7 +80,7 @@ bool CrossSiteResourceHandler::OnResponseStarted(
DLOG(WARNING) << "Request wasn't found";
return false;
}
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request);
// If this is a download, just pass the response through without doing a
@@ -170,7 +170,7 @@ void CrossSiteResourceHandler::ResumeResponse() {
}
// Remove ourselves from the ExtraRequestInfo.
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request);
info->set_cross_site_handler(NULL);
@@ -202,7 +202,7 @@ void CrossSiteResourceHandler::StartCrossSiteTransition(
DLOG(WARNING) << "Cross site response for a request that wasn't found";
return;
}
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request);
info->set_cross_site_handler(this);
diff --git a/content/browser/renderer_host/dummy_resource_handler.cc b/content/browser/renderer_host/dummy_resource_handler.cc
deleted file mode 100644
index 32c20c1..0000000
--- a/content/browser/renderer_host/dummy_resource_handler.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2011 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/dummy_resource_handler.h"
-
-namespace content {
-
-DummyResourceHandler::DummyResourceHandler() {}
-
-bool DummyResourceHandler::OnUploadProgress(int request_id,
- uint64 position,
- uint64 size) {
- return true;
-}
-
-bool DummyResourceHandler::OnRequestRedirected(int request_id,
- const GURL& url,
- ResourceResponse* response,
- bool* defer) {
- return true;
-}
-
-bool DummyResourceHandler::OnResponseStarted(int request_id,
- ResourceResponse* response) {
- return true;
-}
-
-bool DummyResourceHandler::OnWillStart(int request_id,
- const GURL& url,
- bool* defer) {
- return true;
-}
-
-bool DummyResourceHandler::OnWillRead(int request_id,
- net::IOBuffer** buf,
- int* buf_size,
- int min_size) {
- return true;
-}
-
-bool DummyResourceHandler::OnReadCompleted(int request_id, int* bytes_read) {
- return true;
-}
-
-bool DummyResourceHandler::OnResponseCompleted(
- int request_id,
- const net::URLRequestStatus& status,
- const std::string& info) {
- return true;
-}
-
-void DummyResourceHandler::OnRequestClosed() {}
-
-} // namespace content
-
diff --git a/content/browser/renderer_host/dummy_resource_handler.h b/content/browser/renderer_host/dummy_resource_handler.h
deleted file mode 100644
index faefd72..0000000
--- a/content/browser/renderer_host/dummy_resource_handler.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2011 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_DUMMY_RESOURCE_HANDLER_H_
-#define CONTENT_BROWSER_RENDERER_HOST_DUMMY_RESOURCE_HANDLER_H_
-#pragma once
-
-#include <string>
-
-#include "base/compiler_specific.h"
-#include "content/browser/renderer_host/resource_handler.h"
-
-namespace content {
-
-class DummyResourceHandler : public ResourceHandler {
- public:
- DummyResourceHandler();
-
- 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& info) OVERRIDE;
- virtual void OnRequestClosed() OVERRIDE;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DummyResourceHandler);
-};
-
-} // namespace content
-
-#endif // CONTENT_BROWSER_RENDERER_HOST_DUMMY_RESOURCE_HANDLER_H_
diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc
index 1f99041..0f26b2c 100644
--- a/content/browser/renderer_host/resource_dispatcher_host.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host.cc
@@ -38,7 +38,7 @@
#include "content/browser/renderer_host/doomed_resource_handler.h"
#include "content/browser/renderer_host/redirect_to_file_resource_handler.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
+#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/browser/renderer_host/resource_message_filter.h"
#include "content/browser/renderer_host/resource_request_details.h"
#include "content/browser/renderer_host/sync_resource_handler.h"
@@ -91,6 +91,8 @@ using content::BrowserThread;
using content::GlobalRequestID;
using content::RenderViewHostImpl;
using content::ResourceContext;
+using content::ResourceRequestInfo;
+using content::ResourceRequestInfoImpl;
using content::ResourceResponse;
using content::ResourceThrottle;
using content::ThrottlingResourceHandler;
@@ -381,10 +383,14 @@ ResourceDispatcherHost::CreateResourceHandlerForDownload(
return handler;
}
-void ResourceDispatcherHost::SetRequestInfo(
- net::URLRequest* request,
- ResourceDispatcherHostRequestInfo* info) {
- request->SetUserData(NULL, info);
+// static
+void ResourceDispatcherHost::ClearLoginDelegate(net::URLRequest* request) {
+ ResourceRequestInfoImpl* info =
+ ResourceDispatcherHost::InfoForRequest(request);
+ if (!info)
+ return;
+
+ info->set_login_delegate(NULL);
}
void ResourceDispatcherHost::OnShutdown() {
@@ -681,8 +687,8 @@ void ResourceDispatcherHost::BeginRequest(
}
// Make extra info and read footer (contains request ID).
- ResourceDispatcherHostRequestInfo* extra_info =
- new ResourceDispatcherHostRequestInfo(
+ ResourceRequestInfoImpl* extra_info =
+ new ResourceRequestInfoImpl(
handler,
process_type,
child_id,
@@ -701,7 +707,7 @@ void ResourceDispatcherHost::BeginRequest(
request_data.has_user_gesture,
request_data.referrer_policy,
resource_context);
- SetRequestInfo(request, extra_info); // Request takes ownership.
+ extra_info->AssociateWithRequest(request); // Request takes ownership.
if (request->url().SchemeIs(chrome::kBlobScheme)) {
// Hang on to a reference to ensure the blob is not released prior
@@ -721,7 +727,8 @@ void ResourceDispatcherHost::BeginRequest(
// This is a request that has been transferred from another process, so
// resume it rather than continuing the regular procedure for starting a
// request. Currently this is only done for redirects.
- GlobalRequestID global_id(extra_info->child_id(), extra_info->request_id());
+ GlobalRequestID global_id(extra_info->GetChildID(),
+ extra_info->GetRequestID());
pending_requests_[global_id] = request;
request->FollowDeferredRedirect();
} else {
@@ -747,7 +754,7 @@ void ResourceDispatcherHost::DataReceivedACK(int child_id,
if (i == pending_requests_.end())
return;
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second);
+ ResourceRequestInfoImpl* info = InfoForRequest(i->second);
// Decrement the number of pending data messages.
info->DecrementPendingDataCount();
@@ -811,7 +818,7 @@ void ResourceDispatcherHost::OnUploadProgressACK(int request_id) {
if (i == pending_requests_.end())
return;
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second);
+ ResourceRequestInfoImpl* info = InfoForRequest(i->second);
info->set_waiting_for_upload_progress_ack(false);
}
@@ -833,7 +840,7 @@ void ResourceDispatcherHost::OnTransferRequestToNewPage(int new_routing_id,
return;
}
net::URLRequest* request = i->second;
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
info->set_route_id(new_routing_id);
}
@@ -846,13 +853,13 @@ void ResourceDispatcherHost::OnFollowRedirect(
new_first_party_for_cookies);
}
-ResourceDispatcherHostRequestInfo* ResourceDispatcherHost::CreateRequestInfo(
+ResourceRequestInfoImpl* ResourceDispatcherHost::CreateRequestInfo(
ResourceHandler* handler,
int child_id,
int route_id,
bool download,
content::ResourceContext* context) {
- return new ResourceDispatcherHostRequestInfo(
+ return new ResourceRequestInfoImpl(
handler,
content::PROCESS_TYPE_RENDERER,
child_id,
@@ -882,7 +889,7 @@ void ResourceDispatcherHost::OnSwapOutACK(
PendingRequestList::iterator i = pending_requests_.find(global_id);
if (i != pending_requests_.end()) {
// The response we were meant to resume could have already been canceled.
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second);
+ ResourceRequestInfoImpl* info = InfoForRequest(i->second);
if (info->cross_site_handler())
info->cross_site_handler()->ResumeResponse();
}
@@ -962,9 +969,9 @@ net::Error ResourceDispatcherHost::BeginDownload(
return net::ERR_ACCESS_DENIED;
}
- ResourceDispatcherHostRequestInfo* extra_info =
+ ResourceRequestInfoImpl* extra_info =
CreateRequestInfo(handler, child_id, route_id, true, context);
- SetRequestInfo(request.get(), extra_info); // Request takes ownership.
+ extra_info->AssociateWithRequest(request.get()); // Request takes ownership.
BeginRequestInternal(request.release());
@@ -1008,9 +1015,9 @@ void ResourceDispatcherHost::BeginSaveFile(
request->set_context(context->GetRequestContext());
// Since we're just saving some resources we need, disallow downloading.
- ResourceDispatcherHostRequestInfo* extra_info =
+ ResourceRequestInfoImpl* extra_info =
CreateRequestInfo(handler, child_id, route_id, false, context);
- SetRequestInfo(request, extra_info); // Request takes ownership.
+ extra_info->AssociateWithRequest(request); // Request takes ownership.
BeginRequestInternal(request);
}
@@ -1058,7 +1065,7 @@ bool ResourceDispatcherHost::WillSendData(int child_id,
return false;
}
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second);
+ ResourceRequestInfoImpl* info = InfoForRequest(i->second);
info->IncrementPendingDataCount();
if (info->pending_data_count() > kMaxPendingDataMessages) {
@@ -1082,7 +1089,7 @@ void ResourceDispatcherHost::PauseRequest(int child_id,
return;
}
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second);
+ ResourceRequestInfoImpl* info = InfoForRequest(i->second);
int pause_count = info->pause_count() + (pause ? 1 : -1);
if (pause_count < 0) {
NOTREACHED(); // Unbalanced call to pause.
@@ -1130,7 +1137,7 @@ void ResourceDispatcherHost::CancelRequestsForRoute(int child_id,
for (PendingRequestList::const_iterator i = pending_requests_.begin();
i != pending_requests_.end(); ++i) {
if (i->first.child_id == child_id) {
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second);
+ ResourceRequestInfoImpl* info = InfoForRequest(i->second);
GlobalRequestID id(child_id, i->first.request_id);
DCHECK(id == i->first);
// Don't cancel navigations that are transferring to another process,
@@ -1138,7 +1145,7 @@ void ResourceDispatcherHost::CancelRequestsForRoute(int child_id,
if (!info->is_download() &&
(transferred_navigations_.find(id) ==
transferred_navigations_.end()) &&
- (route_id == -1 || route_id == info->route_id())) {
+ (route_id == -1 || route_id == info->GetRouteID())) {
matching_requests.push_back(
GlobalRequestID(child_id, i->first.request_id));
}
@@ -1198,8 +1205,8 @@ void ResourceDispatcherHost::CancelRequestsForContext(
std::vector<net::URLRequest*> requests_to_cancel;
for (PendingRequestList::iterator i = pending_requests_.begin();
i != pending_requests_.end();) {
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second);
- if (info->context() == context) {
+ ResourceRequestInfoImpl* info = InfoForRequest(i->second);
+ if (info->GetContext() == context) {
requests_to_cancel.push_back(i->second);
pending_requests_.erase(i++);
} else {
@@ -1216,9 +1223,9 @@ void ResourceDispatcherHost::CancelRequestsForContext(
++i;
continue;
}
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
InfoForRequest(requests->front());
- if (info->context() == context) {
+ if (info->GetContext() == context) {
blocked_requests_map_.erase(i++);
for (BlockedRequestsList::const_iterator it = requests->begin();
it != requests->end(); ++it) {
@@ -1226,9 +1233,9 @@ void ResourceDispatcherHost::CancelRequestsForContext(
info = InfoForRequest(request);
// We make the assumption that all requests on the list have the same
// ResourceContext.
- DCHECK_EQ(context, info->context());
+ DCHECK_EQ(context, info->GetContext());
IncrementOutstandingRequestsMemoryCost(-1 * info->memory_cost(),
- info->child_id());
+ info->GetChildID());
requests_to_cancel.push_back(request);
}
delete requests;
@@ -1240,13 +1247,13 @@ void ResourceDispatcherHost::CancelRequestsForContext(
for (std::vector<net::URLRequest*>::iterator i = requests_to_cancel.begin();
i != requests_to_cancel.end(); ++i) {
net::URLRequest* request = *i;
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
// There is no strict requirement that this be the case, but currently
// downloads and transferred requests are the only requests that aren't
// cancelled when the associated processes go away. It may be OK for this
// invariant to change in the future, but if this assertion fires without
// the invariant changing, then it's indicative of a leak.
- GlobalRequestID request_id(info->child_id(), info->request_id());
+ GlobalRequestID request_id(info->GetChildID(), info->GetRequestID());
bool is_transferred = IsTransferredNavigation(request_id);
DCHECK(info->is_download() || is_transferred);
if (is_transferred)
@@ -1257,17 +1264,17 @@ void ResourceDispatcherHost::CancelRequestsForContext(
// Validate that no more requests for this context were added.
for (PendingRequestList::const_iterator i = pending_requests_.begin();
i != pending_requests_.end(); ++i) {
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(i->second);
- DCHECK_NE(info->context(), context);
+ ResourceRequestInfoImpl* info = InfoForRequest(i->second);
+ DCHECK_NE(info->GetContext(), context);
}
for (BlockedRequestMap::const_iterator i = blocked_requests_map_.begin();
i != blocked_requests_map_.end(); ++i) {
BlockedRequestsList* requests = i->second;
if (!requests->empty()) {
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
InfoForRequest(requests->front());
- DCHECK_NE(info->context(), context);
+ DCHECK_NE(info->GetContext(), context);
}
}
}
@@ -1286,12 +1293,12 @@ void ResourceDispatcherHost::RemovePendingRequest(int child_id,
void ResourceDispatcherHost::RemovePendingRequest(
const PendingRequestList::iterator& iter) {
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(iter->second);
+ ResourceRequestInfoImpl* info = InfoForRequest(iter->second);
// Remove the memory credit that we added when pushing the request onto
// the pending list.
IncrementOutstandingRequestsMemoryCost(-1 * info->memory_cost(),
- info->child_id());
+ info->GetChildID());
// Notify interested parties that the request object is going away.
if (info->login_delegate())
@@ -1299,7 +1306,7 @@ void ResourceDispatcherHost::RemovePendingRequest(
if (info->ssl_client_auth_handler())
info->ssl_client_auth_handler()->OnRequestCancelled();
transferred_navigations_.erase(
- GlobalRequestID(info->child_id(), info->request_id()));
+ GlobalRequestID(info->GetChildID(), info->GetRequestID()));
delete iter->second;
pending_requests_.erase(iter);
@@ -1315,13 +1322,13 @@ void ResourceDispatcherHost::OnReceivedRedirect(net::URLRequest* request,
const GURL& new_url,
bool* defer_redirect) {
VLOG(1) << "OnReceivedRedirect: " << request->url().spec();
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
DCHECK(request->status().is_success());
if (info->process_type() != content::PROCESS_TYPE_PLUGIN &&
!ChildProcessSecurityPolicyImpl::GetInstance()->
- CanRequestURL(info->child_id(), new_url)) {
+ CanRequestURL(info->GetChildID(), new_url)) {
VLOG(1) << "Denied unauthorized request for "
<< new_url.possibly_invalid_spec();
@@ -1330,21 +1337,21 @@ void ResourceDispatcherHost::OnReceivedRedirect(net::URLRequest* request,
return;
}
- NotifyReceivedRedirect(request, info->child_id(), new_url);
+ NotifyReceivedRedirect(request, info->GetChildID(), new_url);
- if (HandleExternalProtocol(info->request_id(), info->child_id(),
- info->route_id(), new_url,
- info->resource_type(),
+ if (HandleExternalProtocol(info->GetRequestID(), info->GetChildID(),
+ info->GetRouteID(), new_url,
+ info->GetResourceType(),
*request->context()->job_factory(),
info->resource_handler())) {
// The request is complete so we can remove it.
- RemovePendingRequest(info->child_id(), info->request_id());
+ RemovePendingRequest(info->GetChildID(), info->GetRequestID());
return;
}
scoped_refptr<ResourceResponse> response(new ResourceResponse);
PopulateResourceResponse(request, response);
- if (!info->resource_handler()->OnRequestRedirected(info->request_id(),
+ if (!info->resource_handler()->OnRequestRedirected(info->GetRequestID(),
new_url,
response, defer_redirect))
CancelRequestInternal(request, false);
@@ -1385,7 +1392,7 @@ void ResourceDispatcherHost::OnAuthRequired(
// authentication.
// That would also solve the problem of the net::URLRequest being cancelled
// before we receive authentication.
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
DCHECK(!info->login_delegate()) <<
"OnAuthRequired called with login_delegate pending";
if (delegate_) {
@@ -1412,7 +1419,7 @@ void ResourceDispatcherHost::OnCertificateRequested(
return;
}
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
DCHECK(!info->ssl_client_auth_handler()) <<
"OnCertificateRequested called with ssl_client_auth_handler pending";
info->set_ssl_client_auth_handler(
@@ -1436,11 +1443,11 @@ bool ResourceDispatcherHost::CanGetCookies(
if (!RenderViewForRequest(request, &render_process_id, &render_view_id))
return false;
- const ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ const ResourceRequestInfoImpl* info = InfoForRequest(request);
return content::GetContentClient()->browser()->AllowGetCookie(
request->url(), request->first_party_for_cookies(), cookie_list,
- info->context(), render_process_id, render_view_id);
+ info->GetContext(), render_process_id, render_view_id);
}
bool ResourceDispatcherHost::CanSetCookie(const net::URLRequest* request,
@@ -1452,15 +1459,15 @@ bool ResourceDispatcherHost::CanSetCookie(const net::URLRequest* request,
if (!RenderViewForRequest(request, &render_process_id, &render_view_id))
return false;
- const ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ const ResourceRequestInfoImpl* info = InfoForRequest(request);
return content::GetContentClient()->browser()->AllowSetCookie(
request->url(), request->first_party_for_cookies(), cookie_line,
- info->context(), render_process_id, render_view_id, options);
+ info->GetContext(), render_process_id, render_view_id, options);
}
void ResourceDispatcherHost::OnResponseStarted(net::URLRequest* request) {
VLOG(1) << "OnResponseStarted: " << request->url().spec();
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
if (request->status().is_success()) {
if (PauseRequestIfNeeded(info)) {
@@ -1491,7 +1498,7 @@ void ResourceDispatcherHost::OnResponseStarted(net::URLRequest* request) {
}
bool ResourceDispatcherHost::CompleteResponseStarted(net::URLRequest* request) {
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
scoped_refptr<ResourceResponse> response(new ResourceResponse);
PopulateResourceResponse(request, response);
@@ -1499,7 +1506,7 @@ bool ResourceDispatcherHost::CompleteResponseStarted(net::URLRequest* request) {
if (request->ssl_info().cert) {
int cert_id =
CertStore::GetInstance()->StoreCert(request->ssl_info().cert,
- info->child_id());
+ info->GetChildID());
response->security_info = content::SerializeSecurityInfo(
cert_id, request->ssl_info().cert_status,
request->ssl_info().security_bits,
@@ -1511,9 +1518,9 @@ bool ResourceDispatcherHost::CompleteResponseStarted(net::URLRequest* request) {
!request->ssl_info().connection_status);
}
- NotifyResponseStarted(request, info->child_id());
+ NotifyResponseStarted(request, info->GetChildID());
info->set_called_on_response_started(true);
- return info->resource_handler()->OnResponseStarted(info->request_id(),
+ return info->resource_handler()->OnResponseStarted(info->GetRequestID(),
response.get());
}
@@ -1559,7 +1566,7 @@ bool ResourceDispatcherHost::CancelRequestInternal(net::URLRequest* request,
// WebKit will send us a cancel for downloads since it no longer handles them.
// In this case, ignore the cancel since we handle downloads in the browser.
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
if (!from_renderer || !info->is_download()) {
if (info->login_delegate()) {
info->login_delegate()->OnRequestCancelled();
@@ -1620,7 +1627,7 @@ int ResourceDispatcherHost::CalculateApproximateMemoryCost(
void ResourceDispatcherHost::BeginRequestInternal(net::URLRequest* request) {
DCHECK(!request->is_pending());
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
if ((TimeTicks::Now() - last_user_gesture_time_) <
TimeDelta::FromMilliseconds(kUserGestureWindowMs)) {
@@ -1631,7 +1638,7 @@ void ResourceDispatcherHost::BeginRequestInternal(net::URLRequest* request) {
// Add the memory estimate that starting this request will consume.
info->set_memory_cost(CalculateApproximateMemoryCost(request));
int memory_cost = IncrementOutstandingRequestsMemoryCost(info->memory_cost(),
- info->child_id());
+ info->GetChildID());
// If enqueing/starting this request will exceed our per-process memory
// bound, abort it right away.
@@ -1642,13 +1649,13 @@ void ResourceDispatcherHost::BeginRequestInternal(net::URLRequest* request) {
// TODO(eroman): this is kinda funky -- we insert the unstarted request into
// |pending_requests_| simply to please ResponseCompleted().
- GlobalRequestID global_id(info->child_id(), info->request_id());
+ GlobalRequestID global_id(info->GetChildID(), info->GetRequestID());
pending_requests_[global_id] = request;
ResponseCompleted(request);
return;
}
- std::pair<int, int> pair_id(info->child_id(), info->route_id());
+ std::pair<int, int> pair_id(info->GetChildID(), info->GetRouteID());
BlockedRequestMap::const_iterator iter = blocked_requests_map_.find(pair_id);
if (iter != blocked_requests_map_.end()) {
// The request should be blocked.
@@ -1656,7 +1663,7 @@ void ResourceDispatcherHost::BeginRequestInternal(net::URLRequest* request) {
return;
}
- GlobalRequestID global_id(info->child_id(), info->request_id());
+ GlobalRequestID global_id(info->GetChildID(), info->GetRequestID());
pending_requests_[global_id] = request;
// Give the resource handlers an opportunity to delay the net::URLRequest from
@@ -1673,7 +1680,7 @@ void ResourceDispatcherHost::BeginRequestInternal(net::URLRequest* request) {
// the resource_queue_ (which may pause it further, or start it).
bool defer_start = false;
if (!info->resource_handler()->OnWillStart(
- info->request_id(), request->url(),
+ info->GetRequestID(), request->url(),
&defer_start)) {
CancelRequestInternal(request, false);
return;
@@ -1695,7 +1702,7 @@ void ResourceDispatcherHost::StartRequest(net::URLRequest* request) {
}
bool ResourceDispatcherHost::PauseRequestIfNeeded(
- ResourceDispatcherHostRequestInfo* info) {
+ ResourceRequestInfoImpl* info) {
if (info->pause_count() > 0)
info->set_is_paused(true);
return info->is_paused();
@@ -1707,7 +1714,7 @@ void ResourceDispatcherHost::ResumeRequest(const GlobalRequestID& request_id) {
return;
net::URLRequest* request = i->second;
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
// We may already be unpaused, or the pause count may have increased since we
// posted the task to call ResumeRequest.
@@ -1746,12 +1753,12 @@ void ResourceDispatcherHost::StartReading(net::URLRequest* request) {
}
bool ResourceDispatcherHost::Read(net::URLRequest* request, int* bytes_read) {
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
DCHECK(!info->is_paused());
net::IOBuffer* buf;
int buf_size;
- if (!info->resource_handler()->OnWillRead(info->request_id(),
+ if (!info->resource_handler()->OnWillRead(info->GetRequestID(),
&buf, &buf_size, -1)) {
return false;
}
@@ -1768,7 +1775,7 @@ void ResourceDispatcherHost::OnReadCompleted(net::URLRequest* request,
DCHECK(request);
VLOG(1) << "OnReadCompleted: \"" << request->url().spec() << "\""
<< " bytes_read = " << bytes_read;
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
// bytes_read == -1 always implies an error, so we want to skip the pause
// checks and just call ResponseCompleted.
@@ -1807,7 +1814,7 @@ void ResourceDispatcherHost::OnReadCompleted(net::URLRequest* request,
<< " bytes_read = " << bytes_read;
info->set_paused_read_bytes(bytes_read);
info->set_is_paused(true);
- GlobalRequestID id(info->child_id(), info->request_id());
+ GlobalRequestID id(info->GetChildID(), info->GetRequestID());
MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(
@@ -1839,8 +1846,8 @@ bool ResourceDispatcherHost::CompleteRead(net::URLRequest* request,
return false;
}
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
- if (!info->resource_handler()->OnReadCompleted(info->request_id(),
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
+ if (!info->resource_handler()->OnReadCompleted(info->GetRequestID(),
bytes_read)) {
CancelRequestInternal(request, false);
return false;
@@ -1851,12 +1858,12 @@ bool ResourceDispatcherHost::CompleteRead(net::URLRequest* request,
void ResourceDispatcherHost::ResponseCompleted(net::URLRequest* request) {
VLOG(1) << "ResponseCompleted: " << request->url().spec();
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
// If the load for a main frame has failed, track it in a histogram,
// since it will probably cause the user to see an error page.
if (!request->status().is_success() &&
- info->resource_type() == ResourceType::MAIN_FRAME &&
+ info->GetResourceType() == ResourceType::MAIN_FRAME &&
request->status().error() != net::ERR_ABORTED) {
// This enumeration has "2" appended to its name to distinguish it from
// its original version. We changed the buckets at one point (added
@@ -1881,18 +1888,18 @@ void ResourceDispatcherHost::ResponseCompleted(net::URLRequest* request) {
const net::SSLInfo& ssl_info = request->ssl_info();
if (ssl_info.cert != NULL) {
int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert,
- info->child_id());
+ info->GetChildID());
security_info = content::SerializeSecurityInfo(
cert_id, ssl_info.cert_status, ssl_info.security_bits,
ssl_info.connection_status);
}
- if (info->resource_handler()->OnResponseCompleted(info->request_id(),
+ if (info->resource_handler()->OnResponseCompleted(info->GetRequestID(),
request->status(),
security_info)) {
// The request is complete so we can remove it.
- RemovePendingRequest(info->child_id(), info->request_id());
+ RemovePendingRequest(info->GetChildID(), info->GetRequestID());
}
// If the handler's OnResponseCompleted returns false, we are deferring the
// call until later. We will notify the world and clean up when we resume.
@@ -1911,50 +1918,34 @@ void ResourceDispatcherHost::OnUserGesture(TabContents* tab) {
}
// static
-ResourceDispatcherHostRequestInfo* ResourceDispatcherHost::InfoForRequest(
+ResourceRequestInfoImpl* ResourceDispatcherHost::InfoForRequest(
net::URLRequest* request) {
// Avoid writing this function twice by casting the const version.
const net::URLRequest* const_request = request;
- return const_cast<ResourceDispatcherHostRequestInfo*>(
+ return const_cast<ResourceRequestInfoImpl*>(
InfoForRequest(const_request));
}
// static
-const ResourceDispatcherHostRequestInfo* ResourceDispatcherHost::InfoForRequest(
+const ResourceRequestInfoImpl* ResourceDispatcherHost::InfoForRequest(
const net::URLRequest* request) {
- const ResourceDispatcherHostRequestInfo* info =
- static_cast<const ResourceDispatcherHostRequestInfo*>(
- request->GetUserData(NULL));
- return info;
+ return static_cast<const ResourceRequestInfoImpl*>(
+ ResourceRequestInfo::ForRequest(request));
}
// static
bool ResourceDispatcherHost::RenderViewForRequest(
const net::URLRequest* request,
- int* render_process_host_id,
- int* render_view_host_id) {
- const ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ int* render_process_id,
+ int* render_view_id) {
+ const ResourceRequestInfoImpl* info = InfoForRequest(request);
if (!info) {
- *render_process_host_id = -1;
- *render_view_host_id = -1;
+ *render_process_id = -1;
+ *render_view_id = -1;
return false;
}
- // If the request is from the worker process, find a tab that owns the worker.
- if (info->process_type() == content::PROCESS_TYPE_WORKER) {
- // Need to display some related UI for this network request - pick an
- // arbitrary parent to do so.
- if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker(
- info->child_id(), render_process_host_id, render_view_host_id)) {
- *render_process_host_id = -1;
- *render_view_host_id = -1;
- return false;
- }
- } else {
- *render_process_host_id = info->child_id();
- *render_view_host_id = info->route_id();
- }
- return true;
+ return info->GetAssociatedRenderView(render_process_id, render_view_id);
}
net::URLRequest* ResourceDispatcherHost::GetURLRequest(
@@ -2092,11 +2083,11 @@ void ResourceDispatcherHost::UpdateLoadStates() {
std::map<std::pair<int, int>, uint64> largest_upload_size;
for (i = pending_requests_.begin(); i != pending_requests_.end(); ++i) {
net::URLRequest* request = i->second;
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
- uint64 upload_size = info->upload_size();
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
+ uint64 upload_size = info->GetUploadSize();
if (request->GetLoadState().state != net::LOAD_STATE_SENDING_REQUEST)
upload_size = 0;
- std::pair<int, int> key(info->child_id(), info->route_id());
+ std::pair<int, int> key(info->GetChildID(), info->GetRouteID());
if (upload_size && largest_upload_size[key] < upload_size)
largest_upload_size[key] = upload_size;
}
@@ -2104,8 +2095,8 @@ void ResourceDispatcherHost::UpdateLoadStates() {
for (i = pending_requests_.begin(); i != pending_requests_.end(); ++i) {
net::URLRequest* request = i->second;
net::LoadStateWithParam load_state = request->GetLoadState();
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
- std::pair<int, int> key(info->child_id(), info->route_id());
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
+ std::pair<int, int> key(info->GetChildID(), info->GetRouteID());
// We also poll for upload progress on this timer and send upload
// progress ipc messages to the plugin process.
@@ -2114,7 +2105,7 @@ void ResourceDispatcherHost::UpdateLoadStates() {
// If a request is uploading data, ignore all other requests so that the
// upload progress takes priority for being shown in the status bar.
if (largest_upload_size.find(key) != largest_upload_size.end() &&
- info->upload_size() < largest_upload_size[key])
+ info->GetUploadSize() < largest_upload_size[key])
continue;
net::LoadStateWithParam to_insert = load_state;
@@ -2128,7 +2119,7 @@ void ResourceDispatcherHost::UpdateLoadStates() {
LoadInfo& load_info = info_map[key];
load_info.url = request->url();
load_info.load_state = to_insert;
- load_info.upload_size = info->upload_size();
+ load_info.upload_size = info->GetUploadSize();
load_info.upload_position = request->GetUploadProgress();
}
@@ -2142,13 +2133,13 @@ void ResourceDispatcherHost::UpdateLoadStates() {
// Calls the ResourceHandler to send upload progress messages to the renderer.
void ResourceDispatcherHost::MaybeUpdateUploadProgress(
- ResourceDispatcherHostRequestInfo *info,
+ ResourceRequestInfoImpl *info,
net::URLRequest *request) {
- if (!info->upload_size() || info->waiting_for_upload_progress_ack())
+ if (!info->GetUploadSize() || info->waiting_for_upload_progress_ack())
return;
- uint64 size = info->upload_size();
+ uint64 size = info->GetUploadSize();
uint64 position = request->GetUploadProgress();
if (position == info->last_upload_position())
return; // no progress made since last time
@@ -2165,7 +2156,7 @@ void ResourceDispatcherHost::MaybeUpdateUploadProgress(
if (is_finished || enough_new_progress || too_much_time_passed) {
if (request->load_flags() & net::LOAD_ENABLE_UPLOAD_PROGRESS) {
- info->resource_handler()->OnUploadProgress(info->request_id(),
+ info->resource_handler()->OnUploadProgress(info->GetRequestID(),
position, size);
info->set_waiting_for_upload_progress_ack(true);
}
@@ -2213,9 +2204,9 @@ void ResourceDispatcherHost::ProcessBlockedRequestsForRoute(
// Remove the memory credit that we added when pushing the request onto
// the blocked list.
net::URLRequest* request = *req_iter;
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
IncrementOutstandingRequestsMemoryCost(-1 * info->memory_cost(),
- info->child_id());
+ info->GetChildID());
if (cancel_requests)
delete request;
else
@@ -2228,9 +2219,9 @@ void ResourceDispatcherHost::ProcessBlockedRequestsForRoute(
bool ResourceDispatcherHost::IsValidRequest(net::URLRequest* request) {
if (!request)
return false;
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(request);
+ ResourceRequestInfoImpl* info = InfoForRequest(request);
return pending_requests_.find(
- GlobalRequestID(info->child_id(), info->request_id())) !=
+ GlobalRequestID(info->GetChildID(), info->GetRequestID())) !=
pending_requests_.end();
}
@@ -2284,7 +2275,7 @@ void ResourceDispatcherHost::MarkAsTransferredNavigation(
// requests are canceled. The RVH of requests that are being transferred may
// be gone by that time. If the request is resumed, the ResoureHandlers are
// substituted again.
- ResourceDispatcherHostRequestInfo* info = InfoForRequest(transferred_request);
+ ResourceRequestInfoImpl* info = InfoForRequest(transferred_request);
scoped_refptr<ResourceHandler> transferred_resource_handler(
new DoomedResourceHandler(info->resource_handler()));
info->set_resource_handler(transferred_resource_handler.get());
diff --git a/content/browser/renderer_host/resource_dispatcher_host.h b/content/browser/renderer_host/resource_dispatcher_host.h
index f731d69..f6213e4 100644
--- a/content/browser/renderer_host/resource_dispatcher_host.h
+++ b/content/browser/renderer_host/resource_dispatcher_host.h
@@ -32,7 +32,6 @@
#include "webkit/glue/resource_type.h"
class DownloadFileManager;
-class ResourceDispatcherHostRequestInfo;
class ResourceHandler;
class ResourceMessageFilter;
class SaveFileManager;
@@ -44,6 +43,7 @@ struct ViewMsg_SwapOut_Params;
namespace content {
class ResourceContext;
class ResourceDispatcherHostDelegate;
+class ResourceRequestInfoImpl;
struct GlobalRequestID;
}
@@ -197,9 +197,9 @@ class CONTENT_EXPORT ResourceDispatcherHost : public net::URLRequest::Delegate {
// Helper functions to get the dispatcher's request info for the request.
// If the dispatcher didn't create the request then NULL is returned.
- static ResourceDispatcherHostRequestInfo* InfoForRequest(
+ static content::ResourceRequestInfoImpl* InfoForRequest(
net::URLRequest* request);
- static const ResourceDispatcherHostRequestInfo* InfoForRequest(
+ static const content::ResourceRequestInfoImpl* InfoForRequest(
const net::URLRequest* request);
// Extracts the render view/process host's identifiers from the given request
@@ -279,6 +279,8 @@ class CONTENT_EXPORT ResourceDispatcherHost : public net::URLRequest::Delegate {
const DownloadSaveInfo& save_info,
const DownloadResourceHandler::OnStartedCallback& started_cb);
+ static void ClearLoginDelegate(net::URLRequest* request);
+
private:
FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest,
TestBlockedRequestsProcessDies);
@@ -291,18 +293,13 @@ class CONTENT_EXPORT ResourceDispatcherHost : public net::URLRequest::Delegate {
friend class ShutdownTask;
- // Associates the given info with the given request. The info will then be
- // owned by the request.
- void SetRequestInfo(net::URLRequest* request,
- ResourceDispatcherHostRequestInfo* info);
-
// A shutdown helper that runs on the IO thread.
void OnShutdown();
void StartRequest(net::URLRequest* request);
// Returns true if the request is paused.
- bool PauseRequestIfNeeded(ResourceDispatcherHostRequestInfo* info);
+ bool PauseRequestIfNeeded(content::ResourceRequestInfoImpl* info);
// Resumes the given request by calling OnResponseStarted or OnReadCompleted.
void ResumeRequest(const content::GlobalRequestID& request_id);
@@ -385,7 +382,7 @@ class CONTENT_EXPORT ResourceDispatcherHost : public net::URLRequest::Delegate {
void UpdateLoadStates();
// Checks the upload state and sends an update if one is necessary.
- void MaybeUpdateUploadProgress(ResourceDispatcherHostRequestInfo *info,
+ void MaybeUpdateUploadProgress(content::ResourceRequestInfoImpl *info,
net::URLRequest *request);
// Resumes or cancels (if |cancel_requests| is true) any blocked requests.
@@ -413,9 +410,9 @@ class CONTENT_EXPORT ResourceDispatcherHost : public net::URLRequest::Delegate {
const GURL& new_first_party_for_cookies);
void OnReleaseDownloadedFile(int request_id);
- // Creates ResourceDispatcherHostRequestInfo for a download or page save.
+ // Creates ResourceRequestInfoImpl for a download or page save.
// |download| should be true if the request is a file download.
- ResourceDispatcherHostRequestInfo* CreateRequestInfo(
+ content::ResourceRequestInfoImpl* CreateRequestInfo(
ResourceHandler* handler,
int child_id,
int route_id,
diff --git a/content/browser/renderer_host/resource_dispatcher_host_request_info.cc b/content/browser/renderer_host/resource_dispatcher_host_request_info.cc
deleted file mode 100644
index 60fc30c..0000000
--- a/content/browser/renderer_host/resource_dispatcher_host_request_info.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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/resource_dispatcher_host_request_info.h"
-
-#include "content/browser/renderer_host/resource_handler.h"
-#include "content/browser/ssl/ssl_client_auth_handler.h"
-#include "content/public/browser/resource_dispatcher_host_login_delegate.h"
-#include "net/url_request/url_request.h"
-#include "webkit/blob/blob_data.h"
-
-ResourceDispatcherHostRequestInfo::ResourceDispatcherHostRequestInfo(
- ResourceHandler* handler,
- content::ProcessType process_type,
- int child_id,
- int route_id,
- int origin_pid,
- int request_id,
- bool is_main_frame,
- int64 frame_id,
- bool parent_is_main_frame,
- int64 parent_frame_id,
- ResourceType::Type resource_type,
- content::PageTransition transition_type,
- uint64 upload_size,
- bool is_download,
- bool allow_download,
- bool has_user_gesture,
- WebKit::WebReferrerPolicy referrer_policy,
- content::ResourceContext* context)
- : resource_handler_(handler),
- cross_site_handler_(NULL),
- process_type_(process_type),
- child_id_(child_id),
- route_id_(route_id),
- origin_pid_(origin_pid),
- request_id_(request_id),
- is_main_frame_(is_main_frame),
- frame_id_(frame_id),
- parent_is_main_frame_(parent_is_main_frame),
- parent_frame_id_(parent_frame_id),
- pending_data_count_(0),
- is_download_(is_download),
- allow_download_(allow_download),
- has_user_gesture_(has_user_gesture),
- pause_count_(0),
- resource_type_(resource_type),
- transition_type_(transition_type),
- upload_size_(upload_size),
- last_upload_position_(0),
- waiting_for_upload_progress_ack_(false),
- memory_cost_(0),
- referrer_policy_(referrer_policy),
- context_(context),
- is_paused_(false),
- called_on_response_started_(false),
- has_started_reading_(false),
- paused_read_bytes_(0) {
-}
-
-ResourceDispatcherHostRequestInfo::~ResourceDispatcherHostRequestInfo() {
- resource_handler_->OnRequestClosed();
-}
-
-void ResourceDispatcherHostRequestInfo::set_resource_handler(
- ResourceHandler* resource_handler) {
- resource_handler_ = resource_handler;
-}
-
-void ResourceDispatcherHostRequestInfo::set_login_delegate(
- content::ResourceDispatcherHostLoginDelegate* ld) {
- login_delegate_ = ld;
-}
-
-void ResourceDispatcherHostRequestInfo::set_ssl_client_auth_handler(
- SSLClientAuthHandler* s) {
- ssl_client_auth_handler_ = s;
-}
-
-void ResourceDispatcherHostRequestInfo::set_requested_blob_data(
- webkit_blob::BlobData* data) {
- requested_blob_data_ = data;
-}
diff --git a/content/browser/renderer_host/resource_dispatcher_host_uitest.cc b/content/browser/renderer_host/resource_dispatcher_host_uitest.cc
index 1c21438..6e09f29 100644
--- a/content/browser/renderer_host/resource_dispatcher_host_uitest.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host_uitest.cc
@@ -394,7 +394,7 @@ TEST_F(ResourceDispatcherTest, CrossOriginRedirectBlocked) {
"Title Of More Awesomeness", 2);
}
-// Tests that ResourceDispatcherHostRequestInfo is updated correctly on failed
+// Tests that ResourceRequestInfoImpl is updated correctly on failed
// requests, to prevent calling Read on a request that has already failed.
// See bug 40250.
TEST_F(ResourceDispatcherTest, CrossSiteFailedRequest) {
diff --git a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc
index 65b2f3c..2f79982 100644
--- a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc
@@ -13,10 +13,7 @@
#include "base/process_util.h"
#include "content/browser/browser_thread_impl.h"
#include "content/browser/child_process_security_policy_impl.h"
-#include "content/browser/renderer_host/dummy_resource_handler.h"
-#include "content/browser/renderer_host/layered_resource_handler.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/browser/renderer_host/resource_message_filter.h"
#include "content/common/child_process_host_impl.h"
#include "content/common/resource_messages.h"
diff --git a/content/browser/renderer_host/resource_request_details.cc b/content/browser/renderer_host/resource_request_details.cc
index 6ebec88..7ae17e6 100644
--- a/content/browser/renderer_host/resource_request_details.cc
+++ b/content/browser/renderer_host/resource_request_details.cc
@@ -5,9 +5,10 @@
#include "content/browser/renderer_host/resource_request_details.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
+#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/browser/worker_host/worker_service_impl.h"
+using content::ResourceRequestInfoImpl;
using content::WorkerServiceImpl;
ResourceRequestDetails::ResourceRequestDetails(const net::URLRequest* request,
@@ -22,10 +23,10 @@ ResourceRequestDetails::ResourceRequestDetails(const net::URLRequest* request,
ssl_cert_id_(cert_id),
ssl_cert_status_(request->ssl_info().cert_status),
socket_address_(request->GetSocketAddress()) {
- const ResourceDispatcherHostRequestInfo* info =
+ const ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request);
- resource_type_ = info->resource_type();
- frame_id_ = info->frame_id();
+ resource_type_ = info->GetResourceType();
+ frame_id_ = info->GetFrameID();
// If request is from the worker process on behalf of a renderer, use
// the renderer process id, since it consumes the notification response
@@ -36,8 +37,8 @@ ResourceRequestDetails::ResourceRequestDetails(const net::URLRequest* request,
// a single process).
int temp;
if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker(
- info->child_id(), &origin_child_id_, &temp)) {
- origin_child_id_ = info->child_id();
+ info->GetChildID(), &origin_child_id_, &temp)) {
+ origin_child_id_ = info->GetChildID();
}
}
diff --git a/content/browser/renderer_host/resource_request_info_impl.cc b/content/browser/renderer_host/resource_request_info_impl.cc
new file mode 100644
index 0000000..817815a
--- /dev/null
+++ b/content/browser/renderer_host/resource_request_info_impl.cc
@@ -0,0 +1,196 @@
+// 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/resource_request_info_impl.h"
+
+#include "content/browser/renderer_host/resource_handler.h"
+#include "content/browser/ssl/ssl_client_auth_handler.h"
+#include "content/browser/worker_host/worker_service_impl.h"
+#include "content/public/browser/resource_dispatcher_host_login_delegate.h"
+#include "net/url_request/url_request.h"
+#include "webkit/blob/blob_data.h"
+
+namespace content {
+
+// static
+const ResourceRequestInfo* ResourceRequestInfo::ForRequest(
+ const net::URLRequest* request) {
+ return static_cast<const ResourceRequestInfoImpl*>(
+ request->GetUserData(NULL));
+}
+
+// static
+void ResourceRequestInfo::AllocateForTesting(
+ net::URLRequest* request,
+ ResourceContext* context) {
+ ResourceRequestInfoImpl* info =
+ new ResourceRequestInfoImpl(
+ NULL, // handler
+ PROCESS_TYPE_RENDERER, // process_type
+ -1, // child_id
+ MSG_ROUTING_NONE, // route_id
+ 0, // origin_pid
+ 0, // request_id
+ true, // is_main_frame
+ 0, // frame_id
+ false, // parent_is_main_frame
+ 0, // parent_frame_id
+ ResourceType::MAIN_FRAME, // resource_type
+ PAGE_TRANSITION_LINK, // transition_type
+ 0, // upload_size
+ false, // is_download
+ true, // allow_download
+ false, // has_user_gesture
+ WebKit::WebReferrerPolicyDefault, // referrer_policy
+ context); // context
+ info->AssociateWithRequest(request);
+}
+
+ResourceRequestInfoImpl::ResourceRequestInfoImpl(
+ ResourceHandler* handler,
+ ProcessType process_type,
+ int child_id,
+ int route_id,
+ int origin_pid,
+ int request_id,
+ bool is_main_frame,
+ int64 frame_id,
+ bool parent_is_main_frame,
+ int64 parent_frame_id,
+ ResourceType::Type resource_type,
+ PageTransition transition_type,
+ uint64 upload_size,
+ bool is_download,
+ bool allow_download,
+ bool has_user_gesture,
+ WebKit::WebReferrerPolicy referrer_policy,
+ ResourceContext* context)
+ : resource_handler_(handler),
+ cross_site_handler_(NULL),
+ process_type_(process_type),
+ child_id_(child_id),
+ route_id_(route_id),
+ origin_pid_(origin_pid),
+ request_id_(request_id),
+ is_main_frame_(is_main_frame),
+ frame_id_(frame_id),
+ parent_is_main_frame_(parent_is_main_frame),
+ parent_frame_id_(parent_frame_id),
+ pending_data_count_(0),
+ is_download_(is_download),
+ allow_download_(allow_download),
+ has_user_gesture_(has_user_gesture),
+ pause_count_(0),
+ resource_type_(resource_type),
+ transition_type_(transition_type),
+ upload_size_(upload_size),
+ last_upload_position_(0),
+ waiting_for_upload_progress_ack_(false),
+ memory_cost_(0),
+ referrer_policy_(referrer_policy),
+ context_(context),
+ is_paused_(false),
+ called_on_response_started_(false),
+ has_started_reading_(false),
+ paused_read_bytes_(0) {
+}
+
+ResourceRequestInfoImpl::~ResourceRequestInfoImpl() {
+ if (resource_handler_)
+ resource_handler_->OnRequestClosed();
+}
+
+ResourceContext* ResourceRequestInfoImpl::GetContext() const {
+ return context_;
+}
+
+int ResourceRequestInfoImpl::GetChildID() const {
+ return child_id_;
+}
+
+int ResourceRequestInfoImpl::GetRouteID() const {
+ return route_id_;
+}
+
+int ResourceRequestInfoImpl::GetOriginPID() const {
+ return origin_pid_;
+}
+
+int ResourceRequestInfoImpl::GetRequestID() const {
+ return request_id_;
+}
+
+bool ResourceRequestInfoImpl::IsMainFrame() const {
+ return is_main_frame_;
+}
+
+int64 ResourceRequestInfoImpl::GetFrameID() const {
+ return frame_id_;
+}
+
+bool ResourceRequestInfoImpl::ParentIsMainFrame() const {
+ return parent_is_main_frame_;
+}
+
+int64 ResourceRequestInfoImpl::GetParentFrameID() const {
+ return parent_frame_id_;
+}
+
+ResourceType::Type ResourceRequestInfoImpl::GetResourceType() const {
+ return resource_type_;
+}
+
+WebKit::WebReferrerPolicy ResourceRequestInfoImpl::GetReferrerPolicy() const {
+ return referrer_policy_;
+}
+
+uint64 ResourceRequestInfoImpl::GetUploadSize() const {
+ return upload_size_;
+}
+
+bool ResourceRequestInfoImpl::GetAssociatedRenderView(
+ int* render_process_id,
+ int* render_view_id) const {
+ // If the request is from the worker process, find a tab that owns the worker.
+ if (process_type_ == PROCESS_TYPE_WORKER) {
+ // Need to display some related UI for this network request - pick an
+ // arbitrary parent to do so.
+ if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker(
+ child_id_, render_process_id, render_view_id)) {
+ *render_process_id = -1;
+ *render_view_id = -1;
+ return false;
+ }
+ } else {
+ *render_process_id = child_id_;
+ *render_view_id = route_id_;
+ }
+ return true;
+}
+
+void ResourceRequestInfoImpl::AssociateWithRequest(net::URLRequest* request) {
+ request->SetUserData(NULL, this);
+}
+
+void ResourceRequestInfoImpl::set_resource_handler(
+ ResourceHandler* resource_handler) {
+ resource_handler_ = resource_handler;
+}
+
+void ResourceRequestInfoImpl::set_login_delegate(
+ ResourceDispatcherHostLoginDelegate* ld) {
+ login_delegate_ = ld;
+}
+
+void ResourceRequestInfoImpl::set_ssl_client_auth_handler(
+ SSLClientAuthHandler* s) {
+ ssl_client_auth_handler_ = s;
+}
+
+void ResourceRequestInfoImpl::set_requested_blob_data(
+ webkit_blob::BlobData* data) {
+ requested_blob_data_ = data;
+}
+
+} // namespace content
diff --git a/content/browser/renderer_host/resource_dispatcher_host_request_info.h b/content/browser/renderer_host/resource_request_info_impl.h
index c4a0cb1..6b41bea 100644
--- a/content/browser/renderer_host/resource_dispatcher_host_request_info.h
+++ b/content/browser/renderer_host/resource_request_info_impl.h
@@ -2,8 +2,8 @@
// 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_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_
-#define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_
+#ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_
+#define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_
#pragma once
#include <string>
@@ -12,7 +12,7 @@
#include "base/memory/ref_counted.h"
#include "base/supports_user_data.h"
#include "base/time.h"
-#include "content/common/content_export.h"
+#include "content/public/browser/resource_request_info.h"
#include "content/public/common/page_transition_types.h"
#include "content/public/common/process_type.h"
#include "content/public/common/referrer.h"
@@ -23,28 +23,24 @@ class ResourceDispatcherHost;
class ResourceHandler;
class SSLClientAuthHandler;
+namespace webkit_blob {
+class BlobData;
+}
+
namespace content {
class CrossSiteResourceHandler;
class ResourceContext;
class ResourceDispatcherHostLoginDelegate;
-}
-
-namespace net {
-class URLRequest;
-}
-
-namespace webkit_blob {
-class BlobData;
-}
// Holds the data ResourceDispatcherHost associates with each request.
// Retrieve this data by calling ResourceDispatcherHost::InfoForRequest.
-class ResourceDispatcherHostRequestInfo : public base::SupportsUserData::Data {
+class ResourceRequestInfoImpl : public ResourceRequestInfo,
+ public base::SupportsUserData::Data {
public:
// This will take a reference to the handler.
- CONTENT_EXPORT ResourceDispatcherHostRequestInfo(
+ CONTENT_EXPORT ResourceRequestInfoImpl(
ResourceHandler* handler,
- content::ProcessType process_type,
+ ProcessType process_type,
int child_id,
int route_id,
int origin_pid,
@@ -54,14 +50,32 @@ class ResourceDispatcherHostRequestInfo : public base::SupportsUserData::Data {
bool parent_is_main_frame,
int64 parent_frame_id,
ResourceType::Type resource_type,
- content::PageTransition transition_type,
+ PageTransition transition_type,
uint64 upload_size,
bool is_download,
bool allow_download,
bool has_user_gesture,
WebKit::WebReferrerPolicy referrer_policy,
- content::ResourceContext* context);
- virtual ~ResourceDispatcherHostRequestInfo();
+ ResourceContext* context);
+ virtual ~ResourceRequestInfoImpl();
+
+ // ResourceRequestInfo implementation:
+ virtual ResourceContext* GetContext() const OVERRIDE;
+ virtual int GetChildID() const OVERRIDE;
+ virtual int GetRouteID() const OVERRIDE;
+ virtual int GetOriginPID() const OVERRIDE;
+ virtual int GetRequestID() const OVERRIDE;
+ virtual bool IsMainFrame() const OVERRIDE;
+ virtual int64 GetFrameID() const OVERRIDE;
+ virtual bool ParentIsMainFrame() const OVERRIDE;
+ virtual int64 GetParentFrameID() const OVERRIDE;
+ virtual ResourceType::Type GetResourceType() const OVERRIDE;
+ virtual WebKit::WebReferrerPolicy GetReferrerPolicy() const OVERRIDE;
+ virtual uint64 GetUploadSize() const OVERRIDE;
+ virtual bool GetAssociatedRenderView(int* render_process_id,
+ int* render_view_id) const OVERRIDE;
+
+ void AssociateWithRequest(net::URLRequest* request);
// Top-level ResourceHandler servicing this request.
ResourceHandler* resource_handler() { return resource_handler_.get(); }
@@ -70,19 +84,19 @@ class ResourceDispatcherHostRequestInfo : public base::SupportsUserData::Data {
// 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.
- content::CrossSiteResourceHandler* cross_site_handler() {
+ CrossSiteResourceHandler* cross_site_handler() {
return cross_site_handler_;
}
- void set_cross_site_handler(content::CrossSiteResourceHandler* h) {
+ void set_cross_site_handler(CrossSiteResourceHandler* h) {
cross_site_handler_ = h;
}
// Pointer to the login delegate, or NULL if there is none for this request.
- content::ResourceDispatcherHostLoginDelegate* login_delegate() const {
+ ResourceDispatcherHostLoginDelegate* login_delegate() const {
return login_delegate_.get();
}
CONTENT_EXPORT void set_login_delegate(
- content::ResourceDispatcherHostLoginDelegate* ld);
+ ResourceDispatcherHostLoginDelegate* ld);
// Pointer to the SSL auth, or NULL if there is none for this request.
SSLClientAuthHandler* ssl_client_auth_handler() const {
@@ -91,43 +105,14 @@ class ResourceDispatcherHostRequestInfo : public base::SupportsUserData::Data {
void set_ssl_client_auth_handler(SSLClientAuthHandler* s);
// Identifies the type of process (renderer, plugin, etc.) making the request.
- content::ProcessType process_type() const {
+ ProcessType process_type() const {
return process_type_;
}
- // The child process unique ID of the requestor. This duplicates the value
- // stored on the request by SetChildProcessUniqueIDForRequest in
- // url_request_tracking.
- int child_id() const { return child_id_; }
-
- // The IPC route identifier for this request (this identifies the RenderView
- // or like-thing in the renderer that the request gets routed to).
- int route_id() const { return route_id_; }
-
// The route_id of pending request can change when it is transferred to a new
// page (as in iframe transfer using adoptNode JS API).
void set_route_id(int route_id) { route_id_ = route_id; }
- // The pid of the originating process, if the request is sent on behalf of a
- // another process. Otherwise it is 0.
- int origin_pid() const { return origin_pid_; }
-
- // Unique identifier for this resource request.
- int request_id() const { return request_id_; }
-
- // True if |frame_id_| represents a main frame in the RenderView.
- bool is_main_frame() const { return is_main_frame_; }
-
- // Frame ID that sent this resource request. -1 if unknown / invalid.
- int64 frame_id() const { return frame_id_; }
-
- // True if |parent_frame_id_| represents a main frame in the RenderView.
- bool parent_is_main_frame() const { return parent_is_main_frame_; }
-
- // Frame ID of parent frame of frame that sent this resource request.
- // -1 if unknown / invalid.
- int64 parent_frame_id() const { return parent_frame_id_; }
-
// Number of messages we've sent to the renderer that we haven't gotten an
// ACK for. This allows us to avoid having too many messages in flight.
int pending_data_count() const { return pending_data_count_; }
@@ -147,14 +132,8 @@ class ResourceDispatcherHostRequestInfo : public base::SupportsUserData::Data {
int pause_count() const { return pause_count_; }
void set_pause_count(int count) { pause_count_ = count; }
- // Identifies the type of resource, such as subframe, media, etc.
- ResourceType::Type resource_type() const { return resource_type_; }
-
- content::PageTransition transition_type() const { return transition_type_; }
+ PageTransition transition_type() const { return transition_type_; }
- // When there is upload data, this is the byte count of that data. When there
- // is no upload, this will be 0.
- uint64 upload_size() const { return upload_size_; }
void set_upload_size(uint64 upload_size) { upload_size_ = upload_size; }
// When we're uploading data, this is the the byte offset into the uploaded
@@ -191,12 +170,8 @@ class ResourceDispatcherHostRequestInfo : public base::SupportsUserData::Data {
}
void set_requested_blob_data(webkit_blob::BlobData* data);
- WebKit::WebReferrerPolicy referrer_policy() const { return referrer_policy_; }
-
- content::ResourceContext* context() const { return context_; }
-
private:
- friend class ResourceDispatcherHost;
+ friend class ::ResourceDispatcherHost;
// Request is temporarily not handling network data. Should be used only
// by the ResourceDispatcherHost, not the event handlers (accessors are
@@ -230,11 +205,11 @@ class ResourceDispatcherHostRequestInfo : public base::SupportsUserData::Data {
scoped_refptr<ResourceHandler> resource_handler_;
// Non-owning, may be NULL.
- content::CrossSiteResourceHandler* cross_site_handler_;
+ CrossSiteResourceHandler* cross_site_handler_;
- scoped_refptr<content::ResourceDispatcherHostLoginDelegate> login_delegate_;
+ scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_;
scoped_refptr<SSLClientAuthHandler> ssl_client_auth_handler_;
- content::ProcessType process_type_;
+ ProcessType process_type_;
int child_id_;
int route_id_;
int origin_pid_;
@@ -249,7 +224,7 @@ class ResourceDispatcherHostRequestInfo : public base::SupportsUserData::Data {
bool has_user_gesture_;
int pause_count_;
ResourceType::Type resource_type_;
- content::PageTransition transition_type_;
+ PageTransition transition_type_;
uint64 upload_size_;
uint64 last_upload_position_;
base::TimeTicks last_upload_ticks_;
@@ -257,7 +232,7 @@ class ResourceDispatcherHostRequestInfo : public base::SupportsUserData::Data {
int memory_cost_;
scoped_refptr<webkit_blob::BlobData> requested_blob_data_;
WebKit::WebReferrerPolicy referrer_policy_;
- content::ResourceContext* context_;
+ ResourceContext* context_;
// "Private" data accessible only to ResourceDispatcherHost (use the
// accessors above for consistency).
@@ -266,7 +241,9 @@ class ResourceDispatcherHostRequestInfo : public base::SupportsUserData::Data {
bool has_started_reading_;
int paused_read_bytes_;
- DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostRequestInfo);
+ DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl);
};
-#endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_REQUEST_INFO_IMPL_H_
diff --git a/content/browser/renderer_host/x509_user_cert_resource_handler.cc b/content/browser/renderer_host/x509_user_cert_resource_handler.cc
index dd9e991..046453e 100644
--- a/content/browser/renderer_host/x509_user_cert_resource_handler.cc
+++ b/content/browser/renderer_host/x509_user_cert_resource_handler.cc
@@ -7,7 +7,7 @@
#include "base/string_util.h"
#include "content/browser/download/download_types.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
+#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/resource_response.h"
#include "net/base/io_buffer.h"
diff --git a/content/browser/ssl/ssl_client_auth_handler.cc b/content/browser/ssl/ssl_client_auth_handler.cc
index 09e07cb..11a43ba 100644
--- a/content/browser/ssl/ssl_client_auth_handler.cc
+++ b/content/browser/ssl/ssl_client_auth_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.
@@ -6,7 +6,7 @@
#include "base/bind.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
+#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "net/base/x509_certificate.h"
@@ -15,6 +15,7 @@
#include "net/url_request/url_request_context.h"
using content::BrowserThread;
+using content::ResourceRequestInfoImpl;
SSLClientAuthHandler::SSLClientAuthHandler(
net::URLRequest* request,
@@ -76,7 +77,7 @@ void SSLClientAuthHandler::DoCertificateSelected(net::X509Certificate* cert) {
if (request_) {
request_->ContinueWithCertificate(cert);
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request_);
if (info)
info->set_ssl_client_auth_handler(NULL);
diff --git a/content/browser/ssl/ssl_error_handler.cc b/content/browser/ssl/ssl_error_handler.cc
index ee06a32..0632193 100644
--- a/content/browser/ssl/ssl_error_handler.cc
+++ b/content/browser/ssl/ssl_error_handler.cc
@@ -7,7 +7,7 @@
#include "base/bind.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
+#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/browser/ssl/ssl_cert_error_handler.h"
#include "content/browser/tab_contents/navigation_controller_impl.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -17,6 +17,7 @@
using content::BrowserThread;
using content::RenderViewHostImpl;
+using content::ResourceRequestInfoImpl;
using content::WebContents;
SSLErrorHandler::SSLErrorHandler(ResourceDispatcherHost* rdh,
@@ -30,14 +31,12 @@ SSLErrorHandler::SSLErrorHandler(ResourceDispatcherHost* rdh,
request_has_been_notified_(false) {
DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request);
- request_id_.child_id = info->child_id();
- request_id_.request_id = info->request_id();
+ request_id_.child_id = info->GetChildID();
+ request_id_.request_id = info->GetRequestID();
- if (!ResourceDispatcherHost::RenderViewForRequest(request,
- &render_process_id_,
- &render_view_id_))
+ if (!info->GetAssociatedRenderView(&render_process_id_, &render_view_id_))
NOTREACHED();
// This makes sure we don't disappear on the IO thread until we've given an
diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc
index 44e5df9..a6635f4 100644
--- a/content/browser/ssl/ssl_manager.cc
+++ b/content/browser/ssl/ssl_manager.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.
@@ -8,8 +8,8 @@
#include "base/utf_string_conversions.h"
#include "content/browser/load_from_memory_cache_details.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "content/browser/renderer_host/resource_request_details.h"
+#include "content/browser/renderer_host/resource_request_info_impl.h"
#include "content/browser/ssl/ssl_cert_error_handler.h"
#include "content/browser/ssl/ssl_policy.h"
#include "content/browser/ssl/ssl_request_info.h"
@@ -27,6 +27,7 @@ using content::BrowserThread;
using content::NavigationController;
using content::NavigationEntry;
using content::NavigationEntryImpl;
+using content::ResourceRequestInfoImpl;
using content::SSLStatus;
using content::WebContents;
@@ -40,7 +41,7 @@ void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh,
<< " url: " << request->url().spec()
<< " cert_status: " << std::hex << ssl_info.cert_status;
- ResourceDispatcherHostRequestInfo* info =
+ ResourceRequestInfoImpl* info =
ResourceDispatcherHost::InfoForRequest(request);
// A certificate error occurred. Construct a SSLCertErrorHandler object and
@@ -50,7 +51,7 @@ void SSLManager::OnSSLCertificateError(ResourceDispatcherHost* rdh,
base::Bind(&SSLCertErrorHandler::Dispatch,
new SSLCertErrorHandler(rdh,
request,
- info->resource_type(),
+ info->GetResourceType(),
ssl_info,
fatal)));
}
diff --git a/content/browser/worker_host/worker_service_impl.cc b/content/browser/worker_host/worker_service_impl.cc
index 10518df..df54cdd 100644
--- a/content/browser/worker_host/worker_service_impl.cc
+++ b/content/browser/worker_host/worker_service_impl.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.
@@ -426,7 +426,7 @@ bool WorkerServiceImpl::GetRendererForWorker(int worker_process_id,
int* render_view_id) const {
for (WorkerProcessHostIterator iter; !iter.Done(); ++iter) {
if (iter.GetData().id != worker_process_id)
- continue;
+ continue;
// This code assumes one worker per process, see function comment in header!
WorkerProcessHost::Instances::const_iterator first_instance =
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index af696c1..eab6fda 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -107,6 +107,7 @@
'public/browser/resource_dispatcher_host_delegate.cc',
'public/browser/resource_dispatcher_host_delegate.h',
'public/browser/resource_dispatcher_host_login_delegate.h',
+ 'public/browser/resource_request_info.h',
'public/browser/resource_throttle.h',
'public/browser/resource_throttle_controller.h',
'public/browser/save_page_type.h',
@@ -563,13 +564,13 @@
'browser/renderer_host/render_widget_host_view_win.h',
'browser/renderer_host/resource_dispatcher_host.cc',
'browser/renderer_host/resource_dispatcher_host.h',
- 'browser/renderer_host/resource_dispatcher_host_request_info.cc',
- 'browser/renderer_host/resource_dispatcher_host_request_info.h',
'browser/renderer_host/resource_handler.h',
'browser/renderer_host/resource_message_filter.cc',
'browser/renderer_host/resource_message_filter.h',
'browser/renderer_host/resource_request_details.cc',
'browser/renderer_host/resource_request_details.h',
+ 'browser/renderer_host/resource_request_info_impl.cc',
+ 'browser/renderer_host/resource_request_info_impl.h',
'browser/renderer_host/socket_stream_dispatcher_host.cc',
'browser/renderer_host/socket_stream_dispatcher_host.h',
'browser/renderer_host/socket_stream_host.cc',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 6ad2d7b..d9f791a 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -38,8 +38,6 @@
'browser/mock_content_browser_client.h',
'browser/net/url_request_abort_on_end_job.cc',
'browser/net/url_request_abort_on_end_job.h',
- 'browser/renderer_host/dummy_resource_handler.cc',
- 'browser/renderer_host/dummy_resource_handler.h',
'browser/renderer_host/media/mock_media_observer.cc',
'browser/renderer_host/media/mock_media_observer.h',
'browser/renderer_host/test_backing_store.cc',
diff --git a/content/public/browser/resource_request_info.h b/content/public/browser/resource_request_info.h
new file mode 100644
index 0000000..1339d42
--- /dev/null
+++ b/content/public/browser/resource_request_info.h
@@ -0,0 +1,86 @@
+// 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_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_
+#define CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "content/common/content_export.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h"
+#include "webkit/glue/resource_type.h"
+
+namespace net {
+class URLRequest;
+}
+
+namespace content {
+class ResourceContext;
+
+// Each URLRequest allocated by the ResourceDispatcherHost has a
+// ResourceRequestInfo instance associated with it.
+class ResourceRequestInfo {
+ public:
+ // Returns the ResourceRequestInfo associated with the given URLRequest.
+ CONTENT_EXPORT static const ResourceRequestInfo* ForRequest(
+ const net::URLRequest* request);
+
+ // Allocates a new, dummy ResourceRequestInfo and associates it with the
+ // given URLRequest.
+ // NOTE: Add more parameters if you need to initialize other fields.
+ CONTENT_EXPORT static void AllocateForTesting(
+ net::URLRequest* request,
+ ResourceContext* context);
+
+ // Returns the associated ResourceContext.
+ virtual ResourceContext* GetContext() const = 0;
+
+ // The child process unique ID of the requestor.
+ virtual int GetChildID() const = 0;
+
+ // The IPC route identifier for this request (this identifies the RenderView
+ // or like-thing in the renderer that the request gets routed to).
+ virtual int GetRouteID() const = 0;
+
+ // The pid of the originating process, if the request is sent on behalf of a
+ // another process. Otherwise it is 0.
+ virtual int GetOriginPID() const = 0;
+
+ // Unique identifier (within the scope of the child process) for this request.
+ virtual int GetRequestID() const = 0;
+
+ // True if GetFrameID() represents a main frame in the RenderView.
+ virtual bool IsMainFrame() const = 0;
+
+ // Frame ID that sent this resource request. -1 if unknown / invalid.
+ virtual int64 GetFrameID() const = 0;
+
+ // True if GetParentFrameID() represents a main frame in the RenderView.
+ virtual bool ParentIsMainFrame() const = 0;
+
+ // Frame ID of parent frame of frame that sent this resource request.
+ // -1 if unknown / invalid.
+ virtual int64 GetParentFrameID() const = 0;
+
+ // Returns the associated resource type.
+ virtual ResourceType::Type GetResourceType() const = 0;
+
+ // Returns the associated referrer policy.
+ virtual WebKit::WebReferrerPolicy GetReferrerPolicy() const = 0;
+
+ // When there is upload data, this is the byte count of that data. When there
+ // is no upload, this will be 0.
+ virtual uint64 GetUploadSize() const = 0;
+
+ // Returns false if there is NOT an associated render view.
+ virtual bool GetAssociatedRenderView(int* render_process_id,
+ int* render_view_id) const = 0;
+
+ protected:
+ virtual ~ResourceRequestInfo() {}
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_RESOURCE_REQUEST_INFO_H_