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

Side by Side Diff: chrome/browser/ui/search/search_ipc_router.cc

Issue 1436583002: Revert of Remove setVoiceSearchSupported part of EmbeddedSearch SearchBox API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/search/search_ipc_router.h" 5 #include "chrome/browser/ui/search/search_ipc_router.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/search/search.h" 8 #include "chrome/browser/search/search.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "components/search/search.h" 10 #include "components/search/search.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 131
132 void SearchIPCRouter::SendThemeBackgroundInfo( 132 void SearchIPCRouter::SendThemeBackgroundInfo(
133 const ThemeBackgroundInfo& theme_info) { 133 const ThemeBackgroundInfo& theme_info) {
134 if (!policy_->ShouldSendThemeBackgroundInfo()) 134 if (!policy_->ShouldSendThemeBackgroundInfo())
135 return; 135 return;
136 136
137 Send(new ChromeViewMsg_SearchBoxThemeChanged(routing_id(), theme_info)); 137 Send(new ChromeViewMsg_SearchBoxThemeChanged(routing_id(), theme_info));
138 } 138 }
139 139
140 void SearchIPCRouter::ToggleVoiceSearch() {
141 if (!policy_->ShouldSendToggleVoiceSearch())
142 return;
143
144 Send(new ChromeViewMsg_SearchBoxToggleVoiceSearch(routing_id()));
145 }
146
140 void SearchIPCRouter::Submit(const base::string16& text, 147 void SearchIPCRouter::Submit(const base::string16& text,
141 const EmbeddedSearchRequestParams& params) { 148 const EmbeddedSearchRequestParams& params) {
142 if (!policy_->ShouldSubmitQuery()) 149 if (!policy_->ShouldSubmitQuery())
143 return; 150 return;
144 151
145 Send(new ChromeViewMsg_SearchBoxSubmit(routing_id(), text, params)); 152 Send(new ChromeViewMsg_SearchBoxSubmit(routing_id(), text, params));
146 } 153 }
147 154
148 void SearchIPCRouter::OnTabActivated() { 155 void SearchIPCRouter::OnTabActivated() {
149 is_active_tab_ = true; 156 is_active_tab_ = true;
150 } 157 }
151 158
152 void SearchIPCRouter::OnTabDeactivated() { 159 void SearchIPCRouter::OnTabDeactivated() {
153 is_active_tab_ = false; 160 is_active_tab_ = false;
154 } 161 }
155 162
156 bool SearchIPCRouter::OnMessageReceived(const IPC::Message& message) { 163 bool SearchIPCRouter::OnMessageReceived(const IPC::Message& message) {
157 if (IPC_MESSAGE_CLASS(message) != ChromeMsgStart) 164 if (IPC_MESSAGE_CLASS(message) != ChromeMsgStart)
158 return false; 165 return false;
159 166
160 Profile* profile = 167 Profile* profile =
161 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 168 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
162 if (!search::IsRenderedInInstantProcess(web_contents(), profile)) 169 if (!search::IsRenderedInInstantProcess(web_contents(), profile))
163 return false; 170 return false;
164 171
165 bool handled = true; 172 bool handled = true;
166 IPC_BEGIN_MESSAGE_MAP(SearchIPCRouter, message) 173 IPC_BEGIN_MESSAGE_MAP(SearchIPCRouter, message)
167 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined, 174 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined,
168 OnInstantSupportDetermined) 175 OnInstantSupportDetermined)
176 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetVoiceSearchSupported,
177 OnVoiceSearchSupportDetermined)
169 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox); 178 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox);
170 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate, 179 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate,
171 OnSearchBoxNavigate); 180 OnSearchBoxNavigate);
172 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem, 181 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem,
173 OnDeleteMostVisitedItem); 182 OnDeleteMostVisitedItem);
174 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion, 183 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion,
175 OnUndoMostVisitedDeletion); 184 OnUndoMostVisitedDeletion);
176 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions, 185 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions,
177 OnUndoAllMostVisitedDeletions); 186 OnUndoAllMostVisitedDeletions);
178 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogEvent, OnLogEvent); 187 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogEvent, OnLogEvent);
(...skipping 13 matching lines...) Expand all
192 } 201 }
193 202
194 void SearchIPCRouter::OnInstantSupportDetermined(int page_seq_no, 203 void SearchIPCRouter::OnInstantSupportDetermined(int page_seq_no,
195 bool instant_support) const { 204 bool instant_support) const {
196 if (page_seq_no != commit_counter_) 205 if (page_seq_no != commit_counter_)
197 return; 206 return;
198 207
199 delegate_->OnInstantSupportDetermined(instant_support); 208 delegate_->OnInstantSupportDetermined(instant_support);
200 } 209 }
201 210
211 void SearchIPCRouter::OnVoiceSearchSupportDetermined(
212 int page_seq_no,
213 bool supports_voice_search) const {
214 if (page_seq_no != commit_counter_)
215 return;
216
217 delegate_->OnInstantSupportDetermined(true);
218 if (!policy_->ShouldProcessSetVoiceSearchSupport())
219 return;
220
221 delegate_->OnSetVoiceSearchSupport(supports_voice_search);
222 }
223
202 void SearchIPCRouter::OnFocusOmnibox(int page_seq_no, 224 void SearchIPCRouter::OnFocusOmnibox(int page_seq_no,
203 OmniboxFocusState state) const { 225 OmniboxFocusState state) const {
204 if (page_seq_no != commit_counter_) 226 if (page_seq_no != commit_counter_)
205 return; 227 return;
206 228
207 delegate_->OnInstantSupportDetermined(true); 229 delegate_->OnInstantSupportDetermined(true);
208 if (!policy_->ShouldProcessFocusOmnibox(is_active_tab_)) 230 if (!policy_->ShouldProcessFocusOmnibox(is_active_tab_))
209 return; 231 return;
210 232
211 delegate_->FocusOmnibox(state); 233 delegate_->FocusOmnibox(state);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 360
339 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { 361 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) {
340 DCHECK(delegate); 362 DCHECK(delegate);
341 delegate_ = delegate; 363 delegate_ = delegate;
342 } 364 }
343 365
344 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) { 366 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) {
345 DCHECK(policy.get()); 367 DCHECK(policy.get());
346 policy_.reset(policy.release()); 368 policy_.reset(policy.release());
347 } 369 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_ipc_router.h ('k') | chrome/browser/ui/search/search_ipc_router_policy_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698