Index: trunk/src/chrome/browser/search/instant_service.h |
=================================================================== |
--- trunk/src/chrome/browser/search/instant_service.h (revision 244428) |
+++ trunk/src/chrome/browser/search/instant_service.h (working copy) |
@@ -11,6 +11,8 @@ |
#include <vector> |
#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "base/gtest_prod_util.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
@@ -18,6 +20,7 @@ |
#include "base/prefs/pref_change_registrar.h" |
#include "chrome/browser/google/google_url_tracker.h" |
#include "chrome/browser/history/history_types.h" |
+#include "chrome/browser/ui/search/instant_ntp_prerenderer.h" |
#include "chrome/browser/ui/search/instant_search_prerenderer.h" |
#include "chrome/common/instant_types.h" |
#include "components/browser_context_keyed_service/browser_context_keyed_service.h" |
@@ -33,7 +36,7 @@ |
class ThemeService; |
namespace content { |
-class RenderProcessHost; |
+class WebContents; |
} |
namespace net { |
@@ -86,6 +89,22 @@ |
// NTP. |
void UpdateMostVisitedItemsInfo(); |
+ // Forwards the request to InstantNTPPrerenderer to release and return the |
+ // preloaded InstantNTP WebContents. May be NULL. InstantNTPPrerenderer will |
+ // load a new InstantNTP after releasing the preloaded contents. |
+ scoped_ptr<content::WebContents> ReleaseNTPContents() WARN_UNUSED_RESULT; |
+ |
+ // The NTP WebContents. May be NULL. InstantNTPPrerenderer retains ownership. |
+ content::WebContents* GetNTPContents() const; |
+ |
+ // Notifies InstantService about the creation of a BrowserInstantController |
+ // object. Used to preload InstantNTP. |
+ void OnBrowserInstantControllerCreated(); |
+ |
+ // Notifies InstantService about the destruction of a BrowserInstantController |
+ // object. Used to destroy the preloaded InstantNTP. |
+ void OnBrowserInstantControllerDestroyed(); |
+ |
// Sends the current set of search URLs to a renderer process. |
void SendSearchURLsToRenderer(content::RenderProcessHost* rph); |
@@ -99,7 +118,11 @@ |
friend class InstantTestBase; |
friend class InstantUnitTestBase; |
+ FRIEND_TEST_ALL_PREFIXES(InstantExtendedNetworkTest, |
+ NTPReactsToNetworkChanges); |
FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, |
+ MANUAL_ShowsGoogleNTP); |
+ FRIEND_TEST_ALL_PREFIXES(InstantExtendedManualTest, |
MANUAL_SearchesFromFakebox); |
FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ProcessIsolation); |
FRIEND_TEST_ALL_PREFIXES(InstantServiceTest, SendsSearchURLsToRenderer); |
@@ -131,6 +154,9 @@ |
void OnDefaultSearchProviderChanged(const std::string& pref_name); |
+ // Used by tests. |
+ InstantNTPPrerenderer* ntp_prerenderer(); |
+ |
void ResetInstantSearchPrerenderer(); |
Profile* const profile_; |
@@ -152,6 +178,12 @@ |
scoped_refptr<InstantIOContext> instant_io_context_; |
+ InstantNTPPrerenderer ntp_prerenderer_; |
+ |
+ // Total number of BrowserInstantController objects (does not include objects |
+ // created for OTR browser windows). Used to preload and delete InstantNTP. |
+ size_t browser_instant_controller_object_count_; |
+ |
// Set to NULL if the default search provider does not support Instant. |
scoped_ptr<InstantSearchPrerenderer> instant_prerenderer_; |