Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: chrome/browser/prerender/prerender_manager.h

Issue 9226037: Cancel prerenders from Omnibox if we navigate to a different URL than predicted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reorg prerender_manager.cc to match header. Add tests for cancellation. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prerender/prerender_manager.h
diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h
index c573021ef5ad451bde1eec4c39ae215e30127332..b193cb62edeb37cd50f09a6046230b8c87178e4d 100644
--- a/chrome/browser/prerender/prerender_manager.h
+++ b/chrome/browser/prerender/prerender_manager.h
@@ -121,6 +121,9 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
// Cancels all active prerenders.
void CancelAllPrerenders();
+ // Cancels all active prerenders with the ORIGIN_OMNIBOX origin.
+ void CancelOmniboxPrerenders();
+
// For a given WebContents that wants to navigate to the URL supplied,
// determines whether a prerendered version of the URL can be used,
// and substitutes the prerendered RVH into the WebContents. |opener_url| is
@@ -217,6 +220,11 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
bool IsPendingEntry(const GURL& url) const;
+ // Returns true if |url| matches any URLs being prerendered.
+ // TODO(dominich): This should be a const method but FindEntry is not const.
cbentzel 2012/01/25 12:14:01 Why not just make it const in this CL? You may nee
dominich 2012/01/25 23:09:23 I tried it out and it just worked, so that's done
+ // It should be.
+ bool IsPrerendering(const GURL& url);
+
protected:
void SetPrerenderContentsFactory(
PrerenderContents::Factory* prerender_contents_factory);
@@ -233,6 +241,8 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
// Test that needs needs access to internal functions.
friend class PrerenderBrowserTest;
FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, AliasURLTest);
+ FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, CancelAllTest);
+ FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, CancelOmniboxTest);
FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ClearTest);
FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ControlGroup);
FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, DropOldestRequestTest);
@@ -267,14 +277,6 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
const content::Referrer& referrer,
SessionStorageNamespace* session_storage_namespace);
- // Adds a pending preload issued by the prerendering RenderView identified by
- // |child_route_id_pair|. If and when that prerendering RenderView is used,
- // the specified prerender will start.
- void AddPendingPrerender(Origin origin,
- const std::pair<int, int>& child_route_id_pair,
- const GURL& url,
- const content::Referrer& referrer);
-
// Retrieves the PrerenderContents object for the specified URL, if it
// has been prerendered. The caller will then have ownership of the
// PrerenderContents object and is responsible for freeing it.
@@ -332,11 +334,6 @@ class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>,
FindPrerenderContentsForChildRouteIdPair(
const std::pair<int, int>& child_route_id_pair);
- // Returns whether the PrerenderManager is currently within the prerender
- // window - effectively, up to 30 seconds after a prerender tag has been
- // observed.
- bool WithinWindow() const;
-
bool DoesRateLimitAllowPrerender() const;
// Deletes old TabContents that have been replaced by prerendered ones. This

Powered by Google App Engine
This is Rietveld 408576698