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

Unified Diff: chrome/browser/ui/search/instant_page.h

Issue 14911005: Move instant support to SearchTabHelper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 7 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/ui/search/instant_page.h
diff --git a/chrome/browser/ui/search/instant_page.h b/chrome/browser/ui/search/instant_page.h
index 5edf008da7b97b32ce9d70150e9217bd6429415b..8a675233009cad4cb33f42af32aca141825f1e76 100644
--- a/chrome/browser/ui/search/instant_page.h
+++ b/chrome/browser/ui/search/instant_page.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/string16.h"
+#include "chrome/browser/ui/search/search_model_observer.h"
#include "chrome/common/instant_types.h"
#include "chrome/common/omnibox_focus_state.h"
#include "content/public/browser/web_contents_observer.h"
@@ -31,7 +32,8 @@ class Rect;
// Instant/Embedded Search API (http://dev.chromium.org/embeddedsearch).
// InstantPage is not used directly but via one of its derived classes:
// InstantOverlay, InstantNTP and InstantTab.
-class InstantPage : public content::WebContentsObserver {
+class InstantPage : public content::WebContentsObserver,
+ public SearchModelObserver {
public:
// InstantPage calls its delegate in response to messages received from the
// page. Each method is called with the |contents| corresponding to the page
@@ -115,12 +117,6 @@ class InstantPage : public content::WebContentsObserver {
// support suddenly).
bool supports_instant() const { return supports_instant_; }
- // True if Instant support has been tested and determined for this page at
- // least once. Note that Instant support may change in the future.
- bool instant_support_determined() const {
- return instant_support_determined_;
- }
-
// Returns true if the page is the local NTP (i.e. its URL is
// chrome::kChromeSearchLocalNTPURL).
bool IsLocal() const;
@@ -155,10 +151,6 @@ class InstantPage : public content::WebContentsObserver {
// Tells the page about the font information.
void InitializeFonts();
- // Tells the renderer to determine if the page supports the Instant API, which
- // results in a call to InstantSupportDetermined() when the reply is received.
- void DetermineIfPageSupportsInstant();
-
// Tells the page about the available autocomplete results.
void SendAutocompleteResults(
const std::vector<InstantAutocompleteResult>& results);
@@ -216,11 +208,6 @@ class InstantPage : public content::WebContentsObserver {
// Overridden from content::WebContentsObserver:
virtual void RenderViewCreated(
content::RenderViewHost* render_view_host) OVERRIDE;
- virtual void DidFinishLoad(
- int64 frame_id,
- const GURL& validated_url,
- bool is_main_frame,
- content::RenderViewHost* render_view_host) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
virtual void DidCommitProvisionalLoadForFrame(
@@ -240,9 +227,18 @@ class InstantPage : public content::WebContentsObserver {
const string16& error_description,
content::RenderViewHost* render_view_host) OVERRIDE;
+ // Overridden from SearchModelObserver:
+ virtual void ModelChanged(const SearchModel::State& old_state,
+ const SearchModel::State& new_state) OVERRIDE;
+
+ // Helper to look up the SearchModel for this page.
+ SearchModel* GetSearchModel();
+
+ // Update the status of Instant support.
+ void SetSupportsInstant(bool supports_instant);
+
void OnSetSuggestions(int page_id,
const std::vector<InstantSuggestion>& suggestions);
- void OnInstantSupportDetermined(int page_id, bool supports_instant);
void OnShowInstantOverlay(int page_id,
int height,
InstantSizeUnits units);
@@ -258,7 +254,6 @@ class InstantPage : public content::WebContentsObserver {
Delegate* const delegate_;
const std::string instant_url_;
bool supports_instant_;
- bool instant_support_determined_;
DISALLOW_COPY_AND_ASSIGN(InstantPage);
};
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_page.cc » ('j') | chrome/browser/ui/search/search_model_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698