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

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

Issue 1428423002: Remove setVoiceSearchSupported part of EmbeddedSearch SearchBox API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac fix 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
147 void SearchIPCRouter::Submit(const base::string16& text, 140 void SearchIPCRouter::Submit(const base::string16& text,
148 const EmbeddedSearchRequestParams& params) { 141 const EmbeddedSearchRequestParams& params) {
149 if (!policy_->ShouldSubmitQuery()) 142 if (!policy_->ShouldSubmitQuery())
150 return; 143 return;
151 144
152 Send(new ChromeViewMsg_SearchBoxSubmit(routing_id(), text, params)); 145 Send(new ChromeViewMsg_SearchBoxSubmit(routing_id(), text, params));
153 } 146 }
154 147
155 void SearchIPCRouter::OnTabActivated() { 148 void SearchIPCRouter::OnTabActivated() {
156 is_active_tab_ = true; 149 is_active_tab_ = true;
157 } 150 }
158 151
159 void SearchIPCRouter::OnTabDeactivated() { 152 void SearchIPCRouter::OnTabDeactivated() {
160 is_active_tab_ = false; 153 is_active_tab_ = false;
161 } 154 }
162 155
163 bool SearchIPCRouter::OnMessageReceived(const IPC::Message& message) { 156 bool SearchIPCRouter::OnMessageReceived(const IPC::Message& message) {
164 if (IPC_MESSAGE_CLASS(message) != ChromeMsgStart) 157 if (IPC_MESSAGE_CLASS(message) != ChromeMsgStart)
165 return false; 158 return false;
166 159
167 Profile* profile = 160 Profile* profile =
168 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 161 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
169 if (!search::IsRenderedInInstantProcess(web_contents(), profile)) 162 if (!search::IsRenderedInInstantProcess(web_contents(), profile))
170 return false; 163 return false;
171 164
172 bool handled = true; 165 bool handled = true;
173 IPC_BEGIN_MESSAGE_MAP(SearchIPCRouter, message) 166 IPC_BEGIN_MESSAGE_MAP(SearchIPCRouter, message)
174 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined, 167 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined,
175 OnInstantSupportDetermined) 168 OnInstantSupportDetermined)
176 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetVoiceSearchSupported,
177 OnVoiceSearchSupportDetermined)
178 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox); 169 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox);
179 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate, 170 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate,
180 OnSearchBoxNavigate); 171 OnSearchBoxNavigate);
181 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem, 172 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem,
182 OnDeleteMostVisitedItem); 173 OnDeleteMostVisitedItem);
183 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion, 174 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoMostVisitedDeletion,
184 OnUndoMostVisitedDeletion); 175 OnUndoMostVisitedDeletion);
185 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions, 176 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxUndoAllMostVisitedDeletions,
186 OnUndoAllMostVisitedDeletions); 177 OnUndoAllMostVisitedDeletions);
187 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogEvent, OnLogEvent); 178 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_LogEvent, OnLogEvent);
(...skipping 13 matching lines...) Expand all
201 } 192 }
202 193
203 void SearchIPCRouter::OnInstantSupportDetermined(int page_seq_no, 194 void SearchIPCRouter::OnInstantSupportDetermined(int page_seq_no,
204 bool instant_support) const { 195 bool instant_support) const {
205 if (page_seq_no != commit_counter_) 196 if (page_seq_no != commit_counter_)
206 return; 197 return;
207 198
208 delegate_->OnInstantSupportDetermined(instant_support); 199 delegate_->OnInstantSupportDetermined(instant_support);
209 } 200 }
210 201
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
224 void SearchIPCRouter::OnFocusOmnibox(int page_seq_no, 202 void SearchIPCRouter::OnFocusOmnibox(int page_seq_no,
225 OmniboxFocusState state) const { 203 OmniboxFocusState state) const {
226 if (page_seq_no != commit_counter_) 204 if (page_seq_no != commit_counter_)
227 return; 205 return;
228 206
229 delegate_->OnInstantSupportDetermined(true); 207 delegate_->OnInstantSupportDetermined(true);
230 if (!policy_->ShouldProcessFocusOmnibox(is_active_tab_)) 208 if (!policy_->ShouldProcessFocusOmnibox(is_active_tab_))
231 return; 209 return;
232 210
233 delegate_->FocusOmnibox(state); 211 delegate_->FocusOmnibox(state);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 338
361 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { 339 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) {
362 DCHECK(delegate); 340 DCHECK(delegate);
363 delegate_ = delegate; 341 delegate_ = delegate;
364 } 342 }
365 343
366 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) { 344 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) {
367 DCHECK(policy.get()); 345 DCHECK(policy.get());
368 policy_.reset(policy.release()); 346 policy_.reset(policy.release());
369 } 347 }
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