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

Unified Diff: chrome/browser/instant/instant_controller.h

Issue 10829436: Recreate the loader as soon as it is deleted and ensure that it does not become stale. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Spelling fix. Created 8 years, 4 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
« no previous file with comments | « chrome/browser/instant/instant_browsertest.cc ('k') | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/instant/instant_controller.h
diff --git a/chrome/browser/instant/instant_controller.h b/chrome/browser/instant/instant_controller.h
index a4566bba0f0c5f87932b2f9f92ee10289ea3b663..242466731d88fd70a3f9db86afc97537cf8a7324 100644
--- a/chrome/browser/instant/instant_controller.h
+++ b/chrome/browser/instant/instant_controller.h
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
#include "base/timer.h"
@@ -152,11 +153,25 @@ class InstantController : public InstantLoaderDelegate {
#endif
private:
+ FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantLoaderRefresh);
+
// Creates a new loader if necessary (for example, if the |instant_url| has
// changed since the last time we created the loader).
void ResetLoader(const std::string& instant_url,
const TabContents* active_tab);
+ // Ensures that the |loader_| uses the default Instant URL, recreating it if
+ // necessary. Will not do anything if the Instant URL could not be determined
+ // or the active tab is NULL (browser is shutting down).
+ void CreateDefaultLoader();
+
+ // If the |loader_| is not showing, it is deleted and recreated. Else the
+ // refresh is skipped and the next refresh is scheduled.
+ void OnStaleLoader();
+
+ // Calls OnStaleLoader if |stale_loader_timer_| is not running.
+ void MaybeOnStaleLoader();
+
// Destroys the |loader_| and its preview contents.
void DeleteLoader();
@@ -223,6 +238,9 @@ class InstantController : public InstantLoaderDelegate {
// Timer used to update the bounds of the omnibox.
base::OneShotTimer<InstantController> update_bounds_timer_;
+ // Timer used to ensure that the Instant page does not get too stale.
+ base::OneShotTimer<InstantController> stale_loader_timer_;
+
// For each key K => value N, the map says that we found that the search
// engine identified by Instant URL K didn't support the Instant API in each
// of the last N times that we loaded it. If an Instant URL isn't present in
« no previous file with comments | « chrome/browser/instant/instant_browsertest.cc ('k') | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698