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); |
+} |