diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 16:40:36 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 16:40:36 +0000 |
commit | 33f7497dd5e6711df30e02f4f0eea4e512773487 (patch) | |
tree | 2524049ee0edf6cd7b78662745435e14355a87af /chrome/browser/profiles | |
parent | 4b23712142c351bbd41269b7a2bbeda861634a32 (diff) | |
download | chromium_src-33f7497dd5e6711df30e02f4f0eea4e512773487.zip chromium_src-33f7497dd5e6711df30e02f4f0eea4e512773487.tar.gz chromium_src-33f7497dd5e6711df30e02f4f0eea4e512773487.tar.bz2 |
Prerender: Add PrerenderManager and PrerenderContents
Contributed By: tburkard@chromium.org
BUG=None
TEST=trybots, no new unit tests
Review URL: http://codereview.chromium.org/5180005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68602 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profiles')
-rw-r--r-- | chrome/browser/profiles/profile.cc | 12 | ||||
-rw-r--r-- | chrome/browser/profiles/profile.h | 7 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.cc | 10 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.h | 3 |
4 files changed, 31 insertions, 1 deletions
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc index 38aadf0..d2087fc 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -70,6 +70,11 @@ void CleanupRequestContext(ChromeURLRequestContextGetter* context) { } // namespace +Profile::Profile() + : restored_last_session_(false), + accessibility_pause_level_(0) { +} + // static const ProfileId Profile::InvalidProfileId = static_cast<ProfileId>(0); @@ -598,6 +603,13 @@ class OffTheRecordProfileImpl : public Profile, return profile_->GetProxyConfigTracker(); } + virtual PrerenderManager* GetPrerenderManager() { + // We do not allow prerendering in OTR profiles at this point. + // TODO(tburkard): Figure out if we want to support this, and how, at some + // point in the future. + return NULL; + } + private: NotificationRegistrar registrar_; diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index b563010..9bf0f3e5 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -74,6 +74,7 @@ class PinnedTabService; class PrefService; class ExtensionInfoMap; class PrefProxyConfigTracker; +class PrerenderManager; class PromoCounter; class ProfileSyncService; class ProfileSyncFactory; @@ -130,7 +131,7 @@ class Profile { // Value that represents no profile Id. static const ProfileId InvalidProfileId; - Profile() : restored_last_session_(false), accessibility_pause_level_(0) {} + Profile(); virtual ~Profile() {} // Profile prefs are registered as soon as the prefs are loaded for the first @@ -495,6 +496,10 @@ class Profile { // access to the the proxy configuration possibly defined by preferences. virtual PrefProxyConfigTracker* GetProxyConfigTracker() = 0; + // Returns the PrerenderManager used to prerender entire webpages for this + // profile. + virtual PrerenderManager* GetPrerenderManager() = 0; + #ifdef UNIT_TEST // Use with caution. GetDefaultRequestContext may be called on any thread! static void set_default_request_context(URLRequestContextGetter* c) { diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 66b023f..7913da1 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -59,6 +59,7 @@ #include "chrome/browser/policy/profile_policy_context.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/pref_value_store.h" +#include "chrome/browser/prerender/prerender_manager.h" #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/renderer_host/render_process_host.h" @@ -1352,3 +1353,12 @@ PrefProxyConfigTracker* ProfileImpl::GetProxyConfigTracker() { return pref_proxy_config_tracker_; } + +PrerenderManager* ProfileImpl::GetPrerenderManager() { + CommandLine* cl = CommandLine::ForCurrentProcess(); + if (!cl->HasSwitch(switches::kEnablePagePrerender)) + return NULL; + if (!prerender_manager_.get()) + prerender_manager_.reset(new PrerenderManager(this)); + return prerender_manager_.get(); +} diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index d018825..59a1695 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -133,6 +133,7 @@ class ProfileImpl : public Profile, #endif // defined(OS_CHROMEOS) virtual PrefProxyConfigTracker* GetProxyConfigTracker(); + virtual PrerenderManager* GetPrerenderManager(); // NotificationObserver implementation. virtual void Observe(NotificationType type, @@ -296,6 +297,8 @@ class ProfileImpl : public Profile, scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; + scoped_ptr<PrerenderManager> prerender_manager_; + DISALLOW_COPY_AND_ASSIGN(ProfileImpl); }; |