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

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

Issue 17132011: Add setVoiceSearchSupported to the searchbox API. This will be used to determine whether to show a … (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Move listener to SearchTabHelper. Created 7 years, 6 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 5bb3045e467dca76041b20932083a5a8ecffa2be..ec9f7523d1c67c970aa432279034463a4630821c 100644
--- a/chrome/browser/ui/search/instant_page.h
+++ b/chrome/browser/ui/search/instant_page.h
@@ -11,6 +11,7 @@
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/strings/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"
@@ -32,7 +33,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
@@ -63,6 +65,10 @@ class InstantPage : public content::WebContentsObserver {
const content::WebContents* contents,
const std::vector<InstantSuggestion>& suggestions) = 0;
+ // Called upon determination of whether the page supports voice search.
+ virtual void SetVoiceSearchSupported(const content::WebContents* contents,
+ bool supported) = 0;
+
// Called when the page wants to be shown. Usually in response to Update()
// or SendAutocompleteResults().
virtual void ShowInstantOverlay(const content::WebContents* contents,
@@ -204,9 +210,9 @@ class InstantPage : public content::WebContentsObserver {
protected:
InstantPage(Delegate* delegate, const std::string& instant_url);
- // Sets |contents| as the page to communicate with. |contents| may be NULL,
- // which effectively stops all communication.
- void SetContents(content::WebContents* contents);
+ // Sets |web_contents| as the page to communicate with. |web_contents| may be
+ // NULL, which effectively stops all communication.
+ void SetContents(content::WebContents* web_contents);
Delegate* delegate() const { return delegate_; }
@@ -218,6 +224,7 @@ class InstantPage : public content::WebContentsObserver {
virtual bool ShouldProcessRenderViewGone();
virtual bool ShouldProcessAboutToNavigateMainFrame();
virtual bool ShouldProcessSetSuggestions();
+ virtual bool ShouldProcessSetVoiceSearchSupported();
virtual bool ShouldProcessShowInstantOverlay();
virtual bool ShouldProcessFocusOmnibox();
virtual bool ShouldProcessNavigateToURL();
@@ -263,9 +270,16 @@ class InstantPage : public content::WebContentsObserver {
int error_code,
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();
void OnSetSuggestions(int page_id,
const std::vector<InstantSuggestion>& suggestions);
+ void OnSetVoiceSearchSupported(int page_id, bool supported);
void OnInstantSupportDetermined(int page_id, bool supports_instant);
void OnShowInstantOverlay(int page_id,
int height,

Powered by Google App Engine
This is Rietveld 408576698