summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-12 13:12:21 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-12 13:12:21 +0000
commit0e25b15e6bf51ced4c0cc3d2c14122b38debc815 (patch)
treed64bde3c0e1043135dd872c936f137581f6fd3b7 /chrome/browser/net
parent702f9978ada5dcf21c2720219c7de067b81950a6 (diff)
downloadchromium_src-0e25b15e6bf51ced4c0cc3d2c14122b38debc815.zip
chromium_src-0e25b15e6bf51ced4c0cc3d2c14122b38debc815.tar.gz
chromium_src-0e25b15e6bf51ced4c0cc3d2c14122b38debc815.tar.bz2
Add PrerenderResourceHandler and hook it into the ResourceDispatcherHost.
The PrerenderResourceHandler will initiate prerendering of a web page under the following conditions: - The initial request is a GET for a ResourceType::PREFETCH resource. - The mime-type (sniffed or explicitly specified) of the resource is text/html. - The response status code is a 200. - The top-level page will not need to be revalidated until after it's guaranteed to be removed from potential use. The handler passes along all data to the backing resource handler. BUG=61745 TEST=unit_tests --gtest_filter="PrerenderResourceHandlerTest*" Manual Test: Start Chrome with --enable-page-prerender. Go to a page with a <link rel=prefetch> element. Navigate to that element, and make sure that it uses the prerendered view. Review URL: http://codereview.chromium.org/5912001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc2
-rw-r--r--chrome/browser/net/chrome_url_request_context.h12
2 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index d06d806..c5c7edb 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -885,6 +885,7 @@ ChromeURLRequestContextFactory::ChromeURLRequestContextFactory(Profile* profile)
blob_storage_context_ = profile->GetBlobStorageContext();
file_system_context_ = profile->GetFileSystemContext();
extension_info_map_ = profile->GetExtensionInfoMap();
+ prerender_manager_ = profile->GetPrerenderManager();
}
ChromeURLRequestContextFactory::~ChromeURLRequestContextFactory() {
@@ -911,4 +912,5 @@ void ChromeURLRequestContextFactory::ApplyProfileParametersToContext(
context->set_blob_storage_context(blob_storage_context_);
context->set_file_system_context(file_system_context_);
context->set_extension_info_map(extension_info_map_);
+ context->set_prerender_manager(prerender_manager_);
}
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index 93f0e37..7d0c66b 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -19,6 +19,7 @@
#include "chrome/browser/net/chrome_cookie_policy.h"
#include "chrome/browser/prefs/pref_change_registrar.h"
#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/prerender/prerender_manager.h"
#include "chrome/common/extensions/extension_icon_set.h"
#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_registrar.h"
@@ -94,6 +95,10 @@ class ChromeURLRequestContext : public net::URLRequestContext {
return extension_info_map_;
}
+ PrerenderManager* prerender_manager() {
+ return prerender_manager_.get();
+ }
+
// Returns true if this context is an external request context, like
// ChromeFrame.
virtual bool IsExternal() const;
@@ -165,6 +170,9 @@ class ChromeURLRequestContext : public net::URLRequestContext {
net::HttpNetworkDelegate* network_delegate) {
network_delegate_ = network_delegate;
}
+ void set_prerender_manager(PrerenderManager* prerender_manager) {
+ prerender_manager_ = prerender_manager;
+ }
// Callback for when the accept language changes.
void OnAcceptLanguageChange(const std::string& accept_language);
@@ -176,6 +184,7 @@ class ChromeURLRequestContext : public net::URLRequestContext {
// Path to the directory user scripts are stored in.
FilePath user_script_dir_path_;
+ // TODO(willchan): Make these non-refcounted.
scoped_refptr<ChromeAppCacheService> appcache_service_;
scoped_refptr<webkit_database::DatabaseTracker> database_tracker_;
scoped_refptr<ChromeCookiePolicy> chrome_cookie_policy_;
@@ -184,6 +193,7 @@ class ChromeURLRequestContext : public net::URLRequestContext {
scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
scoped_refptr<fileapi::SandboxedFileSystemContext> file_system_context_;
scoped_refptr<ExtensionInfoMap> extension_info_map_;
+ scoped_refptr<PrerenderManager> prerender_manager_;
bool is_media_;
bool is_off_the_record_;
@@ -342,6 +352,7 @@ class ChromeURLRequestContextFactory {
// TODO(aa): I think this can go away now as we no longer support standalone
// user scripts.
+ // TODO(willchan): Make these non-refcounted.
FilePath user_script_dir_path_;
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
scoped_refptr<ChromeAppCacheService> appcache_service_;
@@ -353,6 +364,7 @@ class ChromeURLRequestContextFactory {
scoped_refptr<ChromeBlobStorageContext> blob_storage_context_;
scoped_refptr<fileapi::SandboxedFileSystemContext> file_system_context_;
scoped_refptr<ExtensionInfoMap> extension_info_map_;
+ scoped_refptr<PrerenderManager> prerender_manager_;
FilePath profile_dir_path_;