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

Unified Diff: chrome/browser/ui/search/search_tab_helper.cc

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: Rebase past 16035020, add test. 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
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/search_tab_helper.cc
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index d191ce9c87921ce9f3d54c8b7c48d7726363a516..cf808dcb24ffef97ce24d811170d377740bd8b04 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -141,6 +141,7 @@ void SearchTabHelper::Observe(
}
model_.SetInstantSupportState(INSTANT_SUPPORT_UNKNOWN);
+ model_.SetVoiceSearchSupported(false);
}
bool SearchTabHelper::OnMessageReceived(const IPC::Message& message) {
@@ -152,6 +153,8 @@ bool SearchTabHelper::OnMessageReceived(const IPC::Message& message) {
OnSearchBoxHideBars)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined,
OnInstantSupportDetermined)
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetVoiceSearchSupported,
+ OnSetVoiceSearchSupported)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -183,13 +186,14 @@ void SearchTabHelper::UpdateMode() {
!popup_is_open_ && !user_text_is_empty_) {
// We're switching back (|popup_is_open_| is false) to an NTP (type and
// mode are |NTP|) with suggestions (|user_text_is_empty_| is false), don't
- // modify visibility of top bars. This specific omnibox state is set when
- // OmniboxEditModelChanged() is called from
+ // modify visibility of top bars or voice search support. This specific
+ // omnibox state is set when OmniboxEditModelChanged() is called from
// OmniboxEditModel::SetInputInProgress() which is called from
// OmniboxEditModel::Revert().
model_.SetState(SearchModel::State(SearchMode(type, origin),
model_.state().top_bars_visible,
- model_.instant_support()));
+ model_.instant_support(),
+ model_.state().voice_search_supported));
} else {
model_.SetMode(SearchMode(type, origin));
}
@@ -232,3 +236,8 @@ void SearchTabHelper::OnSearchBoxHideBars(int page_id) {
Send(new ChromeViewMsg_SearchBoxBarsHidden(routing_id()));
}
}
+
+void SearchTabHelper::OnSetVoiceSearchSupported(int page_id, bool supported) {
+ if (web_contents()->IsActiveEntry(page_id))
+ model_.SetVoiceSearchSupported(supported);
+}
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698