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

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

Issue 233353003: Only commit cookie changes in prerenders after a prerender is shown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add browser tests, fix a bug in what was changed yesterday. Created 6 years, 7 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
===================================================================
--- chrome/browser/prerender/prerender_manager.h (revision 265252)
+++ chrome/browser/prerender/prerender_manager.h (working copy)
@@ -295,6 +295,8 @@
PrerenderTracker* prerender_tracker() { return prerender_tracker_; }
+ bool cookie_store_loaded() { return cookie_store_loaded_; }
+
// Adds a condition. This is owned by the PrerenderManager.
void AddCondition(const PrerenderCondition* condition);
@@ -360,6 +362,15 @@
// profile if prerendering is currently enabled.
void AddProfileNetworkBytesIfEnabled(int64 bytes);
+ // To be called once the cookie store for this profile has been loaded.
+ void OnCookieStoreLoaded();
+
+ // For testing purposes. Issues a callback once the cookie store has been
+ // loaded.
+ void set_on_cookie_store_loaded_cb(base::Closure cb) {
Charlie Reis 2014/05/07 17:21:32 I think we typically include "_for_testing" in the
tburkard 2014/05/07 18:34:27 Done.
+ on_cookie_store_loaded_cb_ = cb;
+ }
+
protected:
class PendingSwap;
class PrerenderData : public base::SupportsWeakPtr<PrerenderData> {
@@ -511,6 +522,11 @@
// shorten the TTL of the prerendered page.
void SourceNavigatedAway(PrerenderData* prerender_data);
+ // Gets the request context for the profile.
+ // For unit tests, this will be overriden to return NULL, since it is not
+ // needed.
+ virtual net::URLRequestContextGetter* GetURLRequestContext();
+
private:
friend class ::InstantSearchPrerendererTest;
friend class PrerenderBrowserTest;
@@ -720,6 +736,11 @@
// The value of profile_network_bytes_ that was last recorded.
int64 last_recorded_profile_network_bytes_;
+ // Indicates whether the cookie store for this profile has fully loaded yet.
+ bool cookie_store_loaded_;
+
+ base::Closure on_cookie_store_loaded_cb_;
+
DISALLOW_COPY_AND_ASSIGN(PrerenderManager);
};

Powered by Google App Engine
This is Rietveld 408576698