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

Side by Side Diff: chrome/renderer/searchbox/searchbox_extension.cc

Issue 1428423002: 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/renderer/searchbox/searchbox_extension.h" 5 #include "chrome/renderer/searchbox/searchbox_extension.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/json/string_escape.h" 9 #include "base/json/string_escape.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 const v8::FunctionCallbackInfo<v8::Value>& args); 508 const v8::FunctionCallbackInfo<v8::Value>& args);
509 509
510 // Navigates the window to a URL represented by either a URL string or a 510 // Navigates the window to a URL represented by either a URL string or a
511 // restricted ID. 511 // restricted ID.
512 static void NavigateContentWindow( 512 static void NavigateContentWindow(
513 const v8::FunctionCallbackInfo<v8::Value>& args); 513 const v8::FunctionCallbackInfo<v8::Value>& args);
514 514
515 // Pastes provided value or clipboard's content into the omnibox. 515 // Pastes provided value or clipboard's content into the omnibox.
516 static void Paste(const v8::FunctionCallbackInfo<v8::Value>& args); 516 static void Paste(const v8::FunctionCallbackInfo<v8::Value>& args);
517 517
518 // Indicates whether the page supports voice search.
519 static void SetVoiceSearchSupported(
520 const v8::FunctionCallbackInfo<v8::Value>& args);
521
522 // Start capturing user key strokes. 518 // Start capturing user key strokes.
523 static void StartCapturingKeyStrokes( 519 static void StartCapturingKeyStrokes(
524 const v8::FunctionCallbackInfo<v8::Value>& args); 520 const v8::FunctionCallbackInfo<v8::Value>& args);
525 521
526 // Stop capturing user key strokes. 522 // Stop capturing user key strokes.
527 static void StopCapturingKeyStrokes( 523 static void StopCapturingKeyStrokes(
528 const v8::FunctionCallbackInfo<v8::Value>& args); 524 const v8::FunctionCallbackInfo<v8::Value>& args);
529 525
530 // Undoes the deletion of all Most Visited itens. 526 // Undoes the deletion of all Most Visited itens.
531 static void UndoAllMostVisitedDeletions( 527 static void UndoAllMostVisitedDeletions(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 void SearchBoxExtension::DispatchSuggestionChange(blink::WebFrame* frame) { 617 void SearchBoxExtension::DispatchSuggestionChange(blink::WebFrame* frame) {
622 Dispatch(frame, kDispatchSuggestionChangeEventScript); 618 Dispatch(frame, kDispatchSuggestionChangeEventScript);
623 } 619 }
624 620
625 // static 621 // static
626 void SearchBoxExtension::DispatchThemeChange(blink::WebFrame* frame) { 622 void SearchBoxExtension::DispatchThemeChange(blink::WebFrame* frame) {
627 Dispatch(frame, kDispatchThemeChangeEventScript); 623 Dispatch(frame, kDispatchThemeChangeEventScript);
628 } 624 }
629 625
630 // static 626 // static
631 void SearchBoxExtension::DispatchToggleVoiceSearch( 627 void SearchBoxExtension::DispatchToggleVoiceSearch(
msw 2015/11/06 23:59:23 Remove this and kDispatchToggleVoiceSearchScript?
Evan Stade 2015/11/07 00:43:03 Done.
632 blink::WebFrame* frame) { 628 blink::WebFrame* frame) {
633 Dispatch(frame, kDispatchToggleVoiceSearchScript); 629 Dispatch(frame, kDispatchToggleVoiceSearchScript);
634 } 630 }
635 631
636 SearchBoxExtensionWrapper::SearchBoxExtensionWrapper( 632 SearchBoxExtensionWrapper::SearchBoxExtensionWrapper(
637 const base::StringPiece& code) 633 const base::StringPiece& code)
638 : v8::Extension(kSearchBoxExtensionName, code.data(), 0, 0, code.size()) { 634 : v8::Extension(kSearchBoxExtensionName, code.data(), 0, 0, code.size()) {
639 } 635 }
640 636
641 v8::Local<v8::FunctionTemplate> 637 v8::Local<v8::FunctionTemplate>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 return v8::FunctionTemplate::New(isolate, LogMostVisitedImpression); 681 return v8::FunctionTemplate::New(isolate, LogMostVisitedImpression);
686 } 682 }
687 if (name->Equals( 683 if (name->Equals(
688 v8::String::NewFromUtf8(isolate, "LogMostVisitedNavigation"))) { 684 v8::String::NewFromUtf8(isolate, "LogMostVisitedNavigation"))) {
689 return v8::FunctionTemplate::New(isolate, LogMostVisitedNavigation); 685 return v8::FunctionTemplate::New(isolate, LogMostVisitedNavigation);
690 } 686 }
691 if (name->Equals(v8::String::NewFromUtf8(isolate, "NavigateContentWindow"))) 687 if (name->Equals(v8::String::NewFromUtf8(isolate, "NavigateContentWindow")))
692 return v8::FunctionTemplate::New(isolate, NavigateContentWindow); 688 return v8::FunctionTemplate::New(isolate, NavigateContentWindow);
693 if (name->Equals(v8::String::NewFromUtf8(isolate, "Paste"))) 689 if (name->Equals(v8::String::NewFromUtf8(isolate, "Paste")))
694 return v8::FunctionTemplate::New(isolate, Paste); 690 return v8::FunctionTemplate::New(isolate, Paste);
695 if (name->Equals(v8::String::NewFromUtf8(isolate, "SetVoiceSearchSupported")))
696 return v8::FunctionTemplate::New(isolate, SetVoiceSearchSupported);
697 if (name->Equals( 691 if (name->Equals(
698 v8::String::NewFromUtf8(isolate, "StartCapturingKeyStrokes"))) 692 v8::String::NewFromUtf8(isolate, "StartCapturingKeyStrokes")))
699 return v8::FunctionTemplate::New(isolate, StartCapturingKeyStrokes); 693 return v8::FunctionTemplate::New(isolate, StartCapturingKeyStrokes);
700 if (name->Equals(v8::String::NewFromUtf8(isolate, "StopCapturingKeyStrokes"))) 694 if (name->Equals(v8::String::NewFromUtf8(isolate, "StopCapturingKeyStrokes")))
701 return v8::FunctionTemplate::New(isolate, StopCapturingKeyStrokes); 695 return v8::FunctionTemplate::New(isolate, StopCapturingKeyStrokes);
702 if (name->Equals( 696 if (name->Equals(
703 v8::String::NewFromUtf8(isolate, "UndoAllMostVisitedDeletions"))) 697 v8::String::NewFromUtf8(isolate, "UndoAllMostVisitedDeletions")))
704 return v8::FunctionTemplate::New(isolate, UndoAllMostVisitedDeletions); 698 return v8::FunctionTemplate::New(isolate, UndoAllMostVisitedDeletions);
705 if (name->Equals(v8::String::NewFromUtf8(isolate, "UndoMostVisitedDeletion"))) 699 if (name->Equals(v8::String::NewFromUtf8(isolate, "UndoMostVisitedDeletion")))
706 return v8::FunctionTemplate::New(isolate, UndoMostVisitedDeletion); 700 return v8::FunctionTemplate::New(isolate, UndoMostVisitedDeletion);
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 void SearchBoxExtensionWrapper::StopCapturingKeyStrokes( 1247 void SearchBoxExtensionWrapper::StopCapturingKeyStrokes(
1254 const v8::FunctionCallbackInfo<v8::Value>& args) { 1248 const v8::FunctionCallbackInfo<v8::Value>& args) {
1255 content::RenderView* render_view = GetRenderView(); 1249 content::RenderView* render_view = GetRenderView();
1256 if (!render_view) return; 1250 if (!render_view) return;
1257 1251
1258 DVLOG(1) << render_view << " StopCapturingKeyStrokes"; 1252 DVLOG(1) << render_view << " StopCapturingKeyStrokes";
1259 SearchBox::Get(render_view)->StopCapturingKeyStrokes(); 1253 SearchBox::Get(render_view)->StopCapturingKeyStrokes();
1260 } 1254 }
1261 1255
1262 // static 1256 // static
1263 void SearchBoxExtensionWrapper::SetVoiceSearchSupported(
1264 const v8::FunctionCallbackInfo<v8::Value>& args) {
1265 content::RenderView* render_view = GetRenderView();
1266 if (!render_view) {
1267 return;
1268 }
1269 if (!args.Length()) {
1270 ThrowInvalidParameters(args);
1271 return;
1272 }
1273
1274 DVLOG(1) << render_view << " SetVoiceSearchSupported";
1275 SearchBox::Get(render_view)->SetVoiceSearchSupported(args[0]->BooleanValue());
1276 }
1277
1278 // static
1279 void SearchBoxExtensionWrapper::UndoAllMostVisitedDeletions( 1257 void SearchBoxExtensionWrapper::UndoAllMostVisitedDeletions(
1280 const v8::FunctionCallbackInfo<v8::Value>& args) { 1258 const v8::FunctionCallbackInfo<v8::Value>& args) {
1281 content::RenderView* render_view = GetRenderView(); 1259 content::RenderView* render_view = GetRenderView();
1282 if (!render_view) return; 1260 if (!render_view) return;
1283 1261
1284 DVLOG(1) << render_view << " UndoAllMostVisitedDeletions"; 1262 DVLOG(1) << render_view << " UndoAllMostVisitedDeletions";
1285 SearchBox::Get(render_view)->UndoAllMostVisitedDeletions(); 1263 SearchBox::Get(render_view)->UndoAllMostVisitedDeletions();
1286 } 1264 }
1287 1265
1288 // static 1266 // static
(...skipping 20 matching lines...) Expand all
1309 if (!render_view) return; 1287 if (!render_view) return;
1310 1288
1311 bool display_instant_results = 1289 bool display_instant_results =
1312 SearchBox::Get(render_view)->display_instant_results(); 1290 SearchBox::Get(render_view)->display_instant_results();
1313 DVLOG(1) << render_view << " GetDisplayInstantResults" << 1291 DVLOG(1) << render_view << " GetDisplayInstantResults" <<
1314 display_instant_results; 1292 display_instant_results;
1315 args.GetReturnValue().Set(display_instant_results); 1293 args.GetReturnValue().Set(display_instant_results);
1316 } 1294 }
1317 1295
1318 } // namespace extensions_v8 1296 } // namespace extensions_v8
OLDNEW
« chrome/renderer/searchbox/searchbox.h ('K') | « chrome/renderer/searchbox/searchbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698