Index: chrome/browser/instant/instant_controller.h |
diff --git a/chrome/browser/instant/instant_controller.h b/chrome/browser/instant/instant_controller.h |
index 2018862cf838069cb9ba0e6d5967c8786f183cf3..1af71fddec94409fc6df43e2e1bf6acfef957884 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" |
@@ -145,11 +146,32 @@ class InstantController : public InstantLoaderDelegate { |
#endif |
private: |
+ FRIEND_TEST_ALL_PREFIXES(InstantTest, InstantLoaderRefresh); |
+ |
+ // Creates a new loader with the provided |instant_url| on the |active_tab|. |
+ // Will also start the |loader_refresh_timer_|. The |loader_| should have been |
+ // deleted before making this call. |
+ void CreateLoader(const std::string& instant_url, |
+ const TabContents* active_tab); |
+ |
// 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 |
sreeram
2012/08/22 17:39:35
instant url -> Instant URL
Shishir
2012/08/23 18:26:33
Done.
|
+ // necessary. Uses the current tab if the |loader_| needs to be recreated. |
sreeram
2012/08/22 17:39:35
You can lose this part ("Uses the current tab ...
Shishir
2012/08/23 18:26:33
Done.
|
+ // Will not do anything if the instant url could not be determined or the |
sreeram
2012/08/22 17:39:35
instant url -> Instant URL
Shishir
2012/08/23 18:26:33
Done.
|
+ // active tab is NULL (browser is shutting down). |
+ void ResetLoaderWithDefaultUrlAndCurrentTab(); |
sreeram
2012/08/22 17:39:35
Rename this to CreateDefaultLoader().
Shishir
2012/08/23 18:26:33
Done, but note that this need not create the loade
|
+ |
+ // Starts / restarts the |loader_refresh_timer_| to refresh interval from now. |
+ void ScheduleLoaderRefresh(); |
sreeram
2012/08/22 17:39:35
Rename to ResetStaleLoaderTimer?
Shishir
2012/08/23 18:26:33
Done.
|
+ |
+ // If the |loader_| is not showing, it is deleted and recreated. Else the |
+ // refresh is skipped and the next refresh is scheduled. |
+ void RefreshLoader(); |
sreeram
2012/08/22 17:39:35
Call this OnStaleLoader?
Shishir
2012/08/23 18:26:33
Done.
|
+ |
// Destroys the |loader_| and its preview contents. |
void DeleteLoader(); |
@@ -218,6 +240,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> loader_refresh_timer_; |
sreeram
2012/08/22 17:39:35
Call this stale_loader_timer_?
Shishir
2012/08/23 18:26:33
Done.
|
+ |
// 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 |