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

Unified Diff: chrome/renderer/searchbox/searchbox_extension.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/renderer/searchbox/searchbox.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/searchbox/searchbox_extension.cc
diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc
index 7c19aed40d61cd83545933382e28cbaab0d42c11..4b3043a185357058b25049ec770f7fffc355339d 100644
--- a/chrome/renderer/searchbox/searchbox_extension.cc
+++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -602,6 +602,10 @@ class SearchBoxExtensionWrapper : public v8::Extension {
static void SetQueryFromAutocompleteResult(
const v8::FunctionCallbackInfo<v8::Value>& args);
+ // Indicates whether the page supports voice search.
+ static void SetVoiceSearchSupported(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+
// Requests the overlay be shown with the specified contents and height.
static void ShowOverlay(const v8::FunctionCallbackInfo<v8::Value>& args);
@@ -713,6 +717,8 @@ v8::Handle<v8::FunctionTemplate> SearchBoxExtensionWrapper::GetNativeFunction(
return v8::FunctionTemplate::New(SetQuery);
if (name->Equals(v8::String::New("SetQueryFromAutocompleteResult")))
return v8::FunctionTemplate::New(SetQueryFromAutocompleteResult);
+ if (name->Equals(v8::String::New("SetVoiceSearchSupported")))
+ return v8::FunctionTemplate::New(SetVoiceSearchSupported);
if (name->Equals(v8::String::New("ShowOverlay")))
return v8::FunctionTemplate::New(ShowOverlay);
if (name->Equals(v8::String::New("FocusOmnibox")))
@@ -1264,6 +1270,16 @@ void SearchBoxExtensionWrapper::SetQueryFromAutocompleteResult(
}
// static
+void SearchBoxExtensionWrapper::SetVoiceSearchSupported(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ content::RenderView* render_view = GetRenderView();
+ if (!render_view || args.Length() < 1) return;
+
+ DVLOG(1) << render_view << " SetVoiceSearchSupported";
+ SearchBox::Get(render_view)->SetVoiceSearchSupported(args[0]->BooleanValue());
+}
+
+// static
void SearchBoxExtensionWrapper::ShowOverlay(
const v8::FunctionCallbackInfo<v8::Value>& args) {
content::RenderView* render_view = GetRenderView();
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698