summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 01:11:25 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-12 01:11:25 +0000
commitea114727620483755ebecf7b3fe4e7f9d50316e4 (patch)
tree4731c05242dc6745d2a7e9fb50e1e310470c7138 /chrome/browser
parent0535866266fe81c93349f9abf0d2e2b87519b3d0 (diff)
downloadchromium_src-ea114727620483755ebecf7b3fe4e7f9d50316e4.zip
chromium_src-ea114727620483755ebecf7b3fe4e7f9d50316e4.tar.gz
chromium_src-ea114727620483755ebecf7b3fe4e7f9d50316e4.tar.bz2
Add content/public/browser/resource_dispatcher_host.h
R=jam@chromium.org TBR=willchan@chromium.org,mirandac@chromium.org,ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/9648020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126089 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/DEPS1
-rw-r--r--chrome/browser/browser_process.h1
-rw-r--r--chrome/browser/browser_process_impl.cc12
-rw-r--r--chrome/browser/download/download_browsertest.cc2
-rw-r--r--chrome/browser/download/download_extension_api.cc15
-rw-r--r--chrome/browser/download/download_extension_api.h4
-rw-r--r--chrome/browser/extensions/crx_installer.cc4
-rw-r--r--chrome/browser/extensions/extension_updater.cc10
-rw-r--r--chrome/browser/extensions/sandboxed_extension_unpacker.cc12
-rw-r--r--chrome/browser/extensions/sandboxed_extension_unpacker.h11
-rw-r--r--chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc2
-rw-r--r--chrome/browser/importer/external_process_importer_client.cc1
-rw-r--r--chrome/browser/net/chrome_network_delegate.cc9
-rw-r--r--chrome/browser/plugin_installer.cc26
-rw-r--r--chrome/browser/prerender/prerender_field_trial.cc10
-rw-r--r--chrome/browser/prerender/prerender_manager.cc13
-rw-r--r--chrome/browser/prerender/prerender_manager.h7
-rw-r--r--chrome/browser/prerender/prerender_tracker.cc1
-rw-r--r--chrome/browser/profiles/profile_io_data.cc5
-rw-r--r--chrome/browser/renderer_host/chrome_render_message_filter.cc1
-rw-r--r--chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc9
-rw-r--r--chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h8
-rw-r--r--chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc23
-rw-r--r--chrome/browser/renderer_host/transfer_navigation_resource_throttle.h2
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_host.cc1
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc2
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc7
-rw-r--r--chrome/browser/ui/login/login_prompt.cc5
-rw-r--r--chrome/browser/ui/login/login_prompt_browsertest.cc9
-rw-r--r--chrome/browser/ui/login/login_prompt_gtk.cc1
-rw-r--r--chrome/browser/ui/login/login_prompt_mac.mm3
-rw-r--r--chrome/browser/ui/login/login_prompt_win.cc1
-rw-r--r--chrome/browser/web_resource/web_resource_service.cc14
33 files changed, 119 insertions, 113 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index fa2c830..99d6b1b 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -45,7 +45,6 @@ include_rules = [
"+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_request_details.h",
"+content/browser/renderer_host/resource_request_info_impl.h",
"+content/browser/renderer_host/test_render_view_host.h",
diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h
index d5bb939..ecec003 100644
--- a/chrome/browser/browser_process.h
+++ b/chrome/browser/browser_process.h
@@ -35,7 +35,6 @@ class NotificationUIManager;
class PrefService;
class Profile;
class ProfileManager;
-class ResourceDispatcherHost;
class SafeBrowsingService;
class StatusTray;
class TabCloseableStateWatcher;
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index aa430fe..0fb1a30 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -67,12 +67,12 @@
#include "chrome/common/switch_utils.h"
#include "chrome/common/url_constants.h"
#include "chrome/installer/util/google_update_constants.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/resource_dispatcher_host.h"
#include "net/socket/client_socket_pool_manager.h"
#include "net/url_request/url_request_context_getter.h"
#include "ui/base/clipboard/clipboard.h"
@@ -112,6 +112,7 @@ static const int kEndSessionTimeoutSeconds = 10;
using content::BrowserThread;
using content::ChildProcessSecurityPolicy;
using content::PluginService;
+using content::ResourceDispatcherHost;
BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line)
: created_metrics_service_(false),
@@ -636,11 +637,10 @@ CRLSetFetcher* BrowserProcessImpl::crl_set_fetcher() {
}
void BrowserProcessImpl::ResourceDispatcherHostCreated() {
- ResourceDispatcherHost* rdh = ResourceDispatcherHost::Get();
-
resource_dispatcher_host_delegate_.reset(
- new ChromeResourceDispatcherHostDelegate(rdh, prerender_tracker()));
- rdh->set_delegate(resource_dispatcher_host_delegate_.get());
+ new ChromeResourceDispatcherHostDelegate(prerender_tracker()));
+ ResourceDispatcherHost::Get()->SetDelegate(
+ resource_dispatcher_host_delegate_.get());
pref_change_registrar_.Add(prefs::kAllowCrossOriginAuthPrompt, this);
ApplyAllowCrossOriginAuthPromptPolicy();
@@ -841,7 +841,7 @@ void BrowserProcessImpl::ApplyDefaultBrowserPolicy() {
void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() {
bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt);
- ResourceDispatcherHost::Get()->set_allow_cross_origin_auth_prompt(value);
+ ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value);
}
// Mac is currently not supported.
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index 8f6d762..448ef24 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -43,9 +43,9 @@
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "content/browser/download/download_types.h"
#include "content/browser/net/url_request_mock_http_job.h"
#include "content/browser/net/url_request_slow_download_job.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/download_persistent_store_info.h"
diff --git a/chrome/browser/download/download_extension_api.cc b/chrome/browser/download/download_extension_api.cc
index 716220c..9ca6e5f 100644
--- a/chrome/browser/download/download_extension_api.cc
+++ b/chrome/browser/download/download_extension_api.cc
@@ -39,11 +39,11 @@
#include "chrome/browser/ui/webui/web_ui_util.h"
#include "content/browser/download/download_state_info.h"
#include "content/browser/download/download_types.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/download_interrupt_reasons.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/resource_dispatcher_host.h"
#include "net/base/load_flags.h"
#include "net/http/http_util.h"
#include "net/url_request/url_request.h"
@@ -432,7 +432,7 @@ bool DownloadsDownloadFunction::ParseArgs() {
}
}
}
- iodata_->rdh = ResourceDispatcherHost::Get();
+ iodata_->rdh = content::ResourceDispatcherHost::Get();
iodata_->resource_context = profile()->GetResourceContext();
iodata_->render_process_host_id = render_view_host()->GetProcess()->GetID();
iodata_->render_view_host_routing_id = render_view_host()->GetRoutingID();
@@ -458,8 +458,7 @@ void DownloadsDownloadFunction::BeginDownloadOnIOThread() {
save_info.suggested_name = iodata_->filename;
save_info.prompt_for_save_location = iodata_->save_as;
- scoped_ptr<net::URLRequest> request(
- new net::URLRequest(iodata_->url, iodata_->rdh));
+ scoped_ptr<net::URLRequest> request(new net::URLRequest(iodata_->url, NULL));
request->set_method(iodata_->method);
if (iodata_->extra_headers != NULL) {
for (size_t index = 0; index < iodata_->extra_headers->GetSize(); ++index) {
@@ -495,12 +494,12 @@ void DownloadsDownloadFunction::BeginDownloadOnIOThread() {
net::Error error = iodata_->rdh->BeginDownload(
request.Pass(),
- false, // prefer_cache
- save_info,
- base::Bind(&DownloadsDownloadFunction::OnStarted, this),
+ iodata_->resource_context,
iodata_->render_process_host_id,
iodata_->render_view_host_routing_id,
- iodata_->resource_context);
+ false, // prefer_cache
+ save_info,
+ base::Bind(&DownloadsDownloadFunction::OnStarted, this));
iodata_.reset();
if (error != net::OK) {
diff --git a/chrome/browser/download/download_extension_api.h b/chrome/browser/download/download_extension_api.h
index 3da28e7..b024664 100644
--- a/chrome/browser/download/download_extension_api.h
+++ b/chrome/browser/download/download_extension_api.h
@@ -22,10 +22,10 @@
class DownloadFileIconExtractor;
class DownloadQuery;
-class ResourceDispatcherHost;
namespace content {
class ResourceContext;
+class ResourceDispatcherHost;
}
// Functions in the chrome.experimental.downloads namespace facilitate
@@ -135,7 +135,7 @@ class DownloadsDownloadFunction : public AsyncDownloadsFunction {
base::ListValue* extra_headers;
std::string method;
std::string post_body;
- ResourceDispatcherHost* rdh;
+ content::ResourceDispatcherHost* rdh;
content::ResourceContext* resource_context;
int render_process_host_id;
int render_view_host_routing_id;
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index 2f42cce..17f6e82 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -34,9 +34,9 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_file_util.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
+#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/user_metrics.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -172,7 +172,7 @@ void CrxInstaller::InstallCrx(const FilePath& source_file) {
scoped_refptr<SandboxedExtensionUnpacker> unpacker(
new SandboxedExtensionUnpacker(
source_file,
- ResourceDispatcherHost::Get(),
+ content::ResourceDispatcherHost::Get() != NULL,
install_source_,
creation_flags_,
this));
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc
index 04f5c29..35605a5 100644
--- a/chrome/browser/extensions/extension_updater.cc
+++ b/chrome/browser/extensions/extension_updater.cc
@@ -36,9 +36,9 @@
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_file_util.h"
#include "chrome/common/pref_names.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/utility_process_host.h"
#include "content/public/common/url_fetcher.h"
#include "crypto/sha2.h"
@@ -638,20 +638,18 @@ class SafeManifestParser : public UtilityProcessHostClient {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (!BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(
- &SafeManifestParser::ParseInSandbox, this,
- ResourceDispatcherHost::Get()))) {
+ base::Bind(&SafeManifestParser::ParseInSandbox, this))) {
NOTREACHED();
}
}
// Creates the sandboxed utility process and tells it to start parsing.
- void ParseInSandbox(ResourceDispatcherHost* rdh) {
+ void ParseInSandbox() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// TODO(asargent) we shouldn't need to do this branch here - instead
// UtilityProcessHost should handle it for us. (http://crbug.com/19192)
- bool use_utility_process = rdh &&
+ bool use_utility_process = content::ResourceDispatcherHost::Get() &&
!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess);
if (use_utility_process) {
UtilityProcessHost* host = UtilityProcessHost::Create(
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
index 8fa01ae..7f469f8 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc
@@ -24,7 +24,6 @@
#include "chrome/common/extensions/extension_file_util.h"
#include "chrome/common/extensions/extension_l10n_util.h"
#include "chrome/common/extensions/extension_unpacker.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/utility_process_host.h"
#include "crypto/signature_verifier.h"
@@ -165,14 +164,17 @@ bool FindWritableTempLocation(FilePath* temp_dir) {
SandboxedExtensionUnpacker::SandboxedExtensionUnpacker(
const FilePath& crx_path,
- ResourceDispatcherHost* rdh,
+ bool run_out_of_process,
Extension::Location location,
int creation_flags,
SandboxedExtensionUnpackerClient* client)
: crx_path_(crx_path),
thread_identifier_(BrowserThread::ID_COUNT),
- rdh_(rdh), client_(client), got_response_(false),
- location_(location), creation_flags_(creation_flags) {
+ run_out_of_process_(run_out_of_process),
+ client_(client),
+ got_response_(false),
+ location_(location),
+ creation_flags_(creation_flags) {
}
bool SandboxedExtensionUnpacker::CreateTempDirectory() {
@@ -241,7 +243,7 @@ void SandboxedExtensionUnpacker::Start() {
//
// TODO(asargent) we shouldn't need to do this branch here - instead
// UtilityProcessHost should handle it for us. (http://crbug.com/19192)
- bool use_utility_process = rdh_ &&
+ bool use_utility_process = run_out_of_process_ &&
!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess);
if (use_utility_process) {
// The utility process will have access to the directory passed to
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.h b/chrome/browser/extensions/sandboxed_extension_unpacker.h
index 3461d45..696c4cd 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker.h
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker.h
@@ -16,7 +16,6 @@
#include "content/public/browser/utility_process_host_client.h"
class Extension;
-class ResourceDispatcherHost;
namespace base {
class DictionaryValue;
@@ -99,10 +98,10 @@ class SandboxedExtensionUnpacker : public content::UtilityProcessHostClient {
static const uint32 kCurrentVersion = 2;
// Unpacks the extension in |crx_path| into a temporary directory and calls
- // |client| with the result. If |rdh| is provided, unpacking is done in a
- // sandboxed subprocess. Otherwise, it is done in-process.
+ // |client| with the result. If |run_out_of_process| is provided, unpacking
+ // is done in a sandboxed subprocess. Otherwise, it is done in-process.
SandboxedExtensionUnpacker(const FilePath& crx_path,
- ResourceDispatcherHost* rdh,
+ bool run_out_of_process,
Extension::Location location,
int creation_flags,
SandboxedExtensionUnpackerClient* client);
@@ -221,8 +220,8 @@ class SandboxedExtensionUnpacker : public content::UtilityProcessHostClient {
// Our client's thread. This is the thread we respond on.
content::BrowserThread::ID thread_identifier_;
- // ResourceDispatcherHost to pass to the utility process.
- ResourceDispatcherHost* rdh_;
+ // True if unpacking should be done by the utility process.
+ bool run_out_of_process_;
// Our client.
scoped_refptr<SandboxedExtensionUnpackerClient> client_;
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
index 81e000a..776fead 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
@@ -101,7 +101,7 @@ class SandboxedExtensionUnpackerTest : public testing::Test {
ASSERT_TRUE(file_util::CreateDirectory(temp_path_));
sandboxed_unpacker_ =
- new SandboxedExtensionUnpacker(crx_path, NULL, Extension::INTERNAL,
+ new SandboxedExtensionUnpacker(crx_path, false, Extension::INTERNAL,
Extension::NO_FLAGS, client_);
// Hack since SandboxedExtensionUnpacker gets its background thread id from
diff --git a/chrome/browser/importer/external_process_importer_client.cc b/chrome/browser/importer/external_process_importer_client.cc
index 19f25bd..c2de9a8 100644
--- a/chrome/browser/importer/external_process_importer_client.cc
+++ b/chrome/browser/importer/external_process_importer_client.cc
@@ -14,7 +14,6 @@
#include "chrome/browser/importer/profile_import_process_messages.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_service.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/utility_process_host.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index ea86b3d..d60517b 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -18,7 +18,6 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/task_manager/task_manager.h"
#include "chrome/common/pref_names.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_request_info.h"
@@ -36,6 +35,7 @@
using content::BrowserThread;
using content::RenderViewHost;
+using content::ResourceRequestInfo;
namespace {
@@ -87,9 +87,12 @@ void NotifyEPMRequestStatus(RequestStatus status,
void ForwardRequestStatus(
RequestStatus status, net::URLRequest* request, void* profile_id) {
+ const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
+ if (!info)
+ return;
+
int process_id, render_view_id;
- if (ResourceDispatcherHost::RenderViewForRequest(
- request, &process_id, &render_view_id)) {
+ if (info->GetAssociatedRenderView(&process_id, &render_view_id)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&NotifyEPMRequestStatus,
status, profile_id, process_id, render_view_id));
diff --git a/chrome/browser/plugin_installer.cc b/chrome/browser/plugin_installer.cc
index 7466f6a..0379050 100644
--- a/chrome/browser/plugin_installer.cc
+++ b/chrome/browser/plugin_installer.cc
@@ -16,38 +16,40 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "content/browser/download/download_types.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/download_id.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/web_contents.h"
+#include "net/url_request/url_request.h"
using content::BrowserThread;
using content::DownloadItem;
+using content::ResourceDispatcherHost;
namespace {
-void BeginDownload(const GURL& url,
- content::ResourceContext* resource_context,
- int render_process_host_id,
- int render_view_host_routing_id,
- const DownloadResourceHandler::OnStartedCallback& callback) {
+void BeginDownload(
+ const GURL& url,
+ content::ResourceContext* resource_context,
+ int render_process_host_id,
+ int render_view_host_routing_id,
+ const ResourceDispatcherHost::DownloadStartedCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
ResourceDispatcherHost* rdh = ResourceDispatcherHost::Get();
- scoped_ptr<net::URLRequest> request(
- new net::URLRequest(url, rdh));
+ scoped_ptr<net::URLRequest> request(new net::URLRequest(url, NULL));
net::Error error = rdh->BeginDownload(
request.Pass(),
- true, // prefer_cache
- DownloadSaveInfo(),
- callback,
+ resource_context,
render_process_host_id,
render_view_host_routing_id,
- resource_context);
+ true, // prefer_cache
+ DownloadSaveInfo(),
+ callback);
if (error != net::OK) {
BrowserThread::PostTask(
diff --git a/chrome/browser/prerender/prerender_field_trial.cc b/chrome/browser/prerender/prerender_field_trial.cc
index 5b5f2b0..51cfd93 100644
--- a/chrome/browser/prerender/prerender_field_trial.cc
+++ b/chrome/browser/prerender/prerender_field_trial.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
namespace prerender {
@@ -37,8 +36,7 @@ void SetupPrefetchFieldTrial() {
"ContentPrefetchPrefetchOff", 2012, 6, 30));
const int kPrefetchOnGroup = trial->AppendGroup("ContentPrefetchPrefetchOn",
prefetch_probability);
- ResourceDispatcherHost::set_is_prefetch_enabled(
- trial->group() == kPrefetchOnGroup);
+ PrerenderManager::SetIsPrefetchEnabled(trial->group() == kPrefetchOnGroup);
}
void SetupPrerenderFieldTrial() {
@@ -161,15 +159,15 @@ void ConfigurePrefetchAndPrerender(const CommandLine& command_line) {
SetupPrerenderFieldTrial();
break;
case PRERENDER_OPTION_DISABLED:
- ResourceDispatcherHost::set_is_prefetch_enabled(false);
+ PrerenderManager::SetIsPrefetchEnabled(false);
PrerenderManager::SetMode(PrerenderManager::PRERENDER_MODE_DISABLED);
break;
case PRERENDER_OPTION_ENABLED:
- ResourceDispatcherHost::set_is_prefetch_enabled(true);
+ PrerenderManager::SetIsPrefetchEnabled(true);
PrerenderManager::SetMode(PrerenderManager::PRERENDER_MODE_ENABLED);
break;
case PRERENDER_OPTION_PREFETCH_ONLY:
- ResourceDispatcherHost::set_is_prefetch_enabled(true);
+ PrerenderManager::SetIsPrefetchEnabled(true);
PrerenderManager::SetMode(PrerenderManager::PRERENDER_MODE_DISABLED);
break;
default:
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index d10838c..fa9e6a4 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -162,6 +162,9 @@ class PrerenderManager::OnCloseTabContentsDeleter
};
// static
+bool PrerenderManager::is_prefetch_enabled_ = false;
+
+// static
int PrerenderManager::prerenders_per_session_count_ = 0;
// static
@@ -578,6 +581,16 @@ void PrerenderManager::set_enabled(bool enabled) {
}
// static
+bool PrerenderManager::IsPrefetchEnabled() {
+ return is_prefetch_enabled_;
+}
+
+// static
+void PrerenderManager::SetIsPrefetchEnabled(bool value) {
+ is_prefetch_enabled_ = value;
+}
+
+// static
PrerenderManager::PrerenderManagerMode PrerenderManager::GetMode() {
return mode_;
}
diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h
index 7a39614..3ba1d31 100644
--- a/chrome/browser/prerender/prerender_manager.h
+++ b/chrome/browser/prerender/prerender_manager.h
@@ -155,6 +155,11 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
// they time out, but new ones will not be generated.
void set_enabled(bool enabled);
+ // Controls if we launch or squash prefetch requests as they arrive from
+ // renderers.
+ static bool IsPrefetchEnabled();
+ static void SetIsPrefetchEnabled(bool enabled);
+
static PrerenderManagerMode GetMode();
static void SetMode(PrerenderManagerMode mode);
static bool IsPrerenderingPossible();
@@ -396,6 +401,8 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
// of the PrerenderManager.
bool enabled_;
+ static bool is_prefetch_enabled_;
+
// The profile that owns this PrerenderManager.
Profile* profile_;
diff --git a/chrome/browser/prerender/prerender_tracker.cc b/chrome/browser/prerender/prerender_tracker.cc
index 1eb0b0a..185e967 100644
--- a/chrome/browser/prerender/prerender_tracker.cc
+++ b/chrome/browser/prerender/prerender_tracker.cc
@@ -8,7 +8,6 @@
#include "base/logging.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/prerender/prerender_manager.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_context.h"
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index 305a7f3..1e416a0 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -41,12 +41,12 @@
#include "chrome/common/chrome_switches.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_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"
#include "content/public/browser/resource_context.h"
+#include "content/public/browser/resource_dispatcher_host.h"
#include "net/base/origin_bound_cert_service.h"
#include "net/http/http_transaction_factory.h"
#include "net/http/http_util.h"
@@ -66,6 +66,7 @@
using content::BrowserContext;
using content::BrowserThread;
using content::ResourceContext;
+using content::ResourceDispatcherHost;
using content::ResourceRequestInfoImpl;
namespace {
@@ -163,7 +164,7 @@ class ChromeBlobProtocolHandler : public webkit_blob::BlobProtocolHandler {
virtual scoped_refptr<webkit_blob::BlobData>
LookupBlobData(net::URLRequest* request) const {
const ResourceRequestInfoImpl* info =
- ResourceDispatcherHost::InfoForRequest(request);
+ ResourceRequestInfoImpl::ForRequest(request);
if (!info)
return NULL;
return info->requested_blob_data();
diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc
index 1563b5e..582467a 100644
--- a/chrome/browser/renderer_host/chrome_render_message_filter.cc
+++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc
@@ -30,7 +30,6 @@
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/process_type.h"
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 86eeee2..9322586 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
@@ -29,14 +29,15 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/user_script.h"
#include "chrome/common/render_messages.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.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_dispatcher_host.h"
#include "content/public/browser/resource_request_info.h"
#include "net/base/load_flags.h"
#include "net/base/ssl_config_service.h"
+#include "net/url_request/url_request.h"
// TODO(oshima): Enable this for other platforms.
#if defined(OS_CHROMEOS)
@@ -80,10 +81,8 @@ void NotifyDownloadInitiatedOnUI(int render_process_id, int render_view_id) {
} // end namespace
ChromeResourceDispatcherHostDelegate::ChromeResourceDispatcherHostDelegate(
- ResourceDispatcherHost* resource_dispatcher_host,
prerender::PrerenderTracker* prerender_tracker)
- : resource_dispatcher_host_(resource_dispatcher_host),
- download_request_limiter_(g_browser_process->download_request_limiter()),
+ : download_request_limiter_(g_browser_process->download_request_limiter()),
safe_browsing_(g_browser_process->safe_browsing_service()),
user_script_listener_(new UserScriptListener()),
prerender_tracker_(prerender_tracker) {
@@ -110,7 +109,7 @@ bool ChromeResourceDispatcherHostDelegate::ShouldBeginRequest(
return false;
// If prefetch is disabled, kill the request.
- if (!ResourceDispatcherHost::is_prefetch_enabled())
+ if (!prerender::PrerenderManager::IsPrefetchEnabled())
return false;
}
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h
index f6a7328..34ffb27 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h
@@ -14,7 +14,6 @@
class DelayedResourceQueue;
class DownloadRequestLimiter;
-class ResourceDispatcherHost;
class SafeBrowsingService;
class UserScriptListener;
@@ -29,10 +28,8 @@ class ChromeResourceDispatcherHostDelegate
public:
// This class does not take ownership of the tracker but merely holds a
// reference to it to avoid accessing g_browser_process.
- // Both |resource_dispatcher_host| and |prerender_tracker| must outlive
- // |this|.
- ChromeResourceDispatcherHostDelegate(
- ResourceDispatcherHost* resource_dispatcher_host,
+ // |prerender_tracker| must outlive |this|.
+ explicit ChromeResourceDispatcherHostDelegate(
prerender::PrerenderTracker* prerender_tracker);
virtual ~ChromeResourceDispatcherHostDelegate();
@@ -90,7 +87,6 @@ class ChromeResourceDispatcherHostDelegate
ResourceType::Type resource_type,
ScopedVector<content::ResourceThrottle>* throttles);
- ResourceDispatcherHost* resource_dispatcher_host_;
scoped_refptr<DownloadRequestLimiter> download_request_limiter_;
scoped_refptr<SafeBrowsingService> safe_browsing_;
scoped_refptr<UserScriptListener> user_script_listener_;
diff --git a/chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc b/chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc
index d71ef19..c59a19f 100644
--- a/chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc
+++ b/chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc
@@ -8,14 +8,18 @@
#include "chrome/browser/extensions/extension_info_map.h"
#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/public/browser/global_request_id.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_view_host_delegate.h"
+#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/resource_request_info.h"
#include "content/public/common/referrer.h"
+#include "net/url_request/url_request.h"
using content::GlobalRequestID;
+using content::Referrer;
using content::RenderViewHostDelegate;
+using content::ResourceDispatcherHost;
using content::ResourceRequestInfo;
namespace {
@@ -23,7 +27,7 @@ namespace {
void RequestTransferURLOnUIThread(int render_process_id,
int render_view_id,
const GURL& new_url,
- const content::Referrer& referrer,
+ const Referrer& referrer,
WindowOpenDisposition window_open_disposition,
int64 frame_id,
const GlobalRequestID& global_request_id) {
@@ -69,19 +73,20 @@ void TransferNavigationResourceThrottle::WillRedirectRequest(
ExtensionURLInfo(request_->url()), ExtensionURLInfo(new_url))) {
int render_process_id, render_view_id;
if (info->GetAssociatedRenderView(&render_process_id, &render_view_id)) {
- GlobalRequestID global_id(info->GetChildID(), info->GetRequestID());
- ResourceDispatcherHost::Get()->MarkAsTransferredNavigation(global_id,
- request_);
+ ResourceDispatcherHost::Get()->MarkAsTransferredNavigation(request_);
+ GlobalRequestID global_id(info->GetChildID(), info->GetRequestID());
content::BrowserThread::PostTask(
content::BrowserThread::UI,
FROM_HERE,
base::Bind(&RequestTransferURLOnUIThread,
- render_process_id, render_view_id,
+ render_process_id,
+ render_view_id,
new_url,
- content::Referrer(GURL(request_->referrer()),
- info->GetReferrerPolicy()),
- CURRENT_TAB, info->GetFrameID(), global_id));
+ Referrer(GURL(request_->referrer()), info->GetReferrerPolicy()),
+ CURRENT_TAB,
+ info->GetFrameID(),
+ global_id));
*defer = true;
}
diff --git a/chrome/browser/renderer_host/transfer_navigation_resource_throttle.h b/chrome/browser/renderer_host/transfer_navigation_resource_throttle.h
index 1ac6046..637314f 100644
--- a/chrome/browser/renderer_host/transfer_navigation_resource_throttle.h
+++ b/chrome/browser/renderer_host/transfer_navigation_resource_throttle.h
@@ -14,8 +14,6 @@ namespace net {
class URLRequest;
}
-class ResourceDispatcherHost;
-
// This ResourceThrottle checks whether a navigation redirect will cause a
// renderer process swap. When that happens, we remember the request so
// that we can transfer it to be handled by the new renderer. This fixes
diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc
index 0c69c6e..916ee72 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host.cc
@@ -21,7 +21,6 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/safe_browsing/csd.pb.h"
#include "chrome/common/safe_browsing/safebrowsing_messages.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/browser/renderer_host/resource_request_details.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_controller.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
index 521ce1a..8f873ef9 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -20,9 +20,9 @@
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/navigation_controller.h"
+#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/test/test_browser_thread.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
index cf7b8a1..d738fe2 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
@@ -25,7 +25,6 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/test/test_browser_thread.h"
@@ -471,15 +470,15 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, Prefetch) {
class SetPrefetchForTest {
public:
explicit SetPrefetchForTest(bool prefetch)
- : old_prefetch_state_(ResourceDispatcherHost::is_prefetch_enabled()),
+ : old_prefetch_state_(prerender::PrerenderManager::IsPrefetchEnabled()),
old_prerender_mode_(prerender::PrerenderManager::GetMode()) {
- ResourceDispatcherHost::set_is_prefetch_enabled(prefetch);
+ prerender::PrerenderManager::SetIsPrefetchEnabled(prefetch);
prerender::PrerenderManager::SetMode(
prerender::PrerenderManager::PRERENDER_MODE_DISABLED);
}
~SetPrefetchForTest() {
- ResourceDispatcherHost::set_is_prefetch_enabled(old_prefetch_state_);
+ prerender::PrerenderManager::SetIsPrefetchEnabled(old_prefetch_state_);
prerender::PrerenderManager::SetMode(old_prerender_mode_);
}
private:
diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc
index e30cfd4..c39d25d 100644
--- a/chrome/browser/ui/login/login_prompt.cc
+++ b/chrome/browser/ui/login/login_prompt.cc
@@ -15,12 +15,12 @@
#include "chrome/browser/ui/constrained_window.h"
#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/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_dispatcher_host.h"
#include "content/public/browser/resource_request_info.h"
#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
@@ -36,6 +36,7 @@ using content::BrowserThread;
using content::NavigationController;
using content::RenderViewHost;
using content::RenderViewHostDelegate;
+using content::ResourceDispatcherHost;
using content::ResourceRequestInfo;
using content::WebContents;
using webkit::forms::PasswordForm;
@@ -46,7 +47,7 @@ class LoginHandlerImpl;
// Should only be called from the IO thread, since it accesses an
// net::URLRequest.
void ResetLoginHandlerForRequest(net::URLRequest* request) {
- ResourceDispatcherHost::ClearLoginDelegate(request);
+ ResourceDispatcherHost::Get()->ClearLoginDelegateForRequest(request);
}
// Get the signon_realm under which this auth info should be stored.
diff --git a/chrome/browser/ui/login/login_prompt_browsertest.cc b/chrome/browser/ui/login/login_prompt_browsertest.cc
index 068794d..ff544aa 100644
--- a/chrome/browser/ui/login/login_prompt_browsertest.cc
+++ b/chrome/browser/ui/login/login_prompt_browsertest.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.
@@ -14,7 +14,6 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/web_contents.h"
@@ -225,16 +224,16 @@ IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, PrefetchAuthCancels) {
class SetPrefetchForTest {
public:
explicit SetPrefetchForTest(bool prefetch)
- : old_prefetch_state_(ResourceDispatcherHost::is_prefetch_enabled()),
+ : old_prefetch_state_(prerender::PrerenderManager::IsPrefetchEnabled()),
old_mode_(prerender::PrerenderManager::GetMode()) {
- ResourceDispatcherHost::set_is_prefetch_enabled(prefetch);
+ prerender::PrerenderManager::SetIsPrefetchEnabled(prefetch);
// Disable prerender so this is just a prefetch of the top-level page.
prerender::PrerenderManager::SetMode(
prerender::PrerenderManager::PRERENDER_MODE_DISABLED);
}
~SetPrefetchForTest() {
- ResourceDispatcherHost::set_is_prefetch_enabled(old_prefetch_state_);
+ prerender::PrerenderManager::SetIsPrefetchEnabled(old_prefetch_state_);
prerender::PrerenderManager::SetMode(old_mode_);
}
private:
diff --git a/chrome/browser/ui/login/login_prompt_gtk.cc b/chrome/browser/ui/login/login_prompt_gtk.cc
index 6ec0851..717c0a5 100644
--- a/chrome/browser/ui/login/login_prompt_gtk.cc
+++ b/chrome/browser/ui/login/login_prompt_gtk.cc
@@ -14,7 +14,6 @@
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "chrome/browser/ui/login/login_model.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
diff --git a/chrome/browser/ui/login/login_prompt_mac.mm b/chrome/browser/ui/login/login_prompt_mac.mm
index c0d5c0c..84ef4d7 100644
--- a/chrome/browser/ui/login/login_prompt_mac.mm
+++ b/chrome/browser/ui/login/login_prompt_mac.mm
@@ -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.
@@ -16,7 +16,6 @@
#include "chrome/browser/ui/cocoa/constrained_window_mac.h"
#include "chrome/browser/ui/login/login_model.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/ui/login/login_prompt_win.cc b/chrome/browser/ui/login/login_prompt_win.cc
index 8f0c451..f9e72d8 100644
--- a/chrome/browser/ui/login/login_prompt_win.cc
+++ b/chrome/browser/ui/login/login_prompt_win.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
#include "chrome/browser/ui/views/login_view.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc
index aa5a45b..89f6496 100644
--- a/chrome/browser/web_resource/web_resource_service.cc
+++ b/chrome/browser/web_resource/web_resource_service.cc
@@ -17,8 +17,8 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_utility_messages.h"
#include "chrome/common/web_resource/web_resource_unpacker.h"
-#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/utility_process_host.h"
#include "content/public/browser/utility_process_host_client.h"
#include "content/public/common/url_fetcher.h"
@@ -37,7 +37,6 @@ class WebResourceService::UnpackerClient : public UtilityProcessHostClient {
public:
explicit UnpackerClient(WebResourceService* web_resource_service)
: web_resource_service_(web_resource_service),
- resource_dispatcher_host_(ResourceDispatcherHost::Get()),
got_response_(false) {
}
@@ -45,11 +44,11 @@ class WebResourceService::UnpackerClient : public UtilityProcessHostClient {
AddRef(); // balanced in Cleanup.
// TODO(willchan): Look for a better signal of whether we're in a unit test
- // or not. Using |resource_dispatcher_host_| for this is pretty lame.
- // If we don't have a resource_dispatcher_host_, assume we're in
- // a test and run the unpacker directly in-process.
+ // or not. Using |ResourceDispatcherHost::Get()| for this is pretty lame.
+ // If we don't have a ResourceDispatcherHost, assume we're in a test and
+ // run the unpacker directly in-process.
bool use_utility_process =
- resource_dispatcher_host_ != NULL &&
+ content::ResourceDispatcherHost::Get() &&
!CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess);
if (use_utility_process) {
BrowserThread::ID thread_id;
@@ -123,9 +122,6 @@ class WebResourceService::UnpackerClient : public UtilityProcessHostClient {
scoped_refptr<WebResourceService> web_resource_service_;
- // Owned by the global browser process.
- ResourceDispatcherHost* resource_dispatcher_host_;
-
// True if we got a response from the utility process and have cleaned up
// already.
bool got_response_;