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

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

Issue 20501002: Adds paste function to searchbox api and handles paste event on fakebox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test updated Created 7 years, 4 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 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/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 const v8::FunctionCallbackInfo<v8::Value>& args); 353 const v8::FunctionCallbackInfo<v8::Value>& args);
354 354
355 // Logs information from the iframes/titles on the NTP. 355 // Logs information from the iframes/titles on the NTP.
356 static void LogEvent(const v8::FunctionCallbackInfo<v8::Value>& args); 356 static void LogEvent(const v8::FunctionCallbackInfo<v8::Value>& args);
357 357
358 // Navigates the window to a URL represented by either a URL string or a 358 // Navigates the window to a URL represented by either a URL string or a
359 // restricted ID. 359 // restricted ID.
360 static void NavigateContentWindow( 360 static void NavigateContentWindow(
361 const v8::FunctionCallbackInfo<v8::Value>& args); 361 const v8::FunctionCallbackInfo<v8::Value>& args);
362 362
363 // Pastes clipboard's content into the omnibox.
364 static void Paste(const v8::FunctionCallbackInfo<v8::Value>& args);
365
363 // Indicates whether the page supports voice search. 366 // Indicates whether the page supports voice search.
364 static void SetVoiceSearchSupported( 367 static void SetVoiceSearchSupported(
365 const v8::FunctionCallbackInfo<v8::Value>& args); 368 const v8::FunctionCallbackInfo<v8::Value>& args);
366 369
367 // Start capturing user key strokes. 370 // Start capturing user key strokes.
368 static void StartCapturingKeyStrokes( 371 static void StartCapturingKeyStrokes(
369 const v8::FunctionCallbackInfo<v8::Value>& args); 372 const v8::FunctionCallbackInfo<v8::Value>& args);
370 373
371 // Stop capturing user key strokes. 374 // Stop capturing user key strokes.
372 static void StopCapturingKeyStrokes( 375 static void StopCapturingKeyStrokes(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 if (name->Equals(v8::String::New("IsFocused"))) 479 if (name->Equals(v8::String::New("IsFocused")))
477 return v8::FunctionTemplate::New(IsFocused); 480 return v8::FunctionTemplate::New(IsFocused);
478 if (name->Equals(v8::String::New("IsInputInProgress"))) 481 if (name->Equals(v8::String::New("IsInputInProgress")))
479 return v8::FunctionTemplate::New(IsInputInProgress); 482 return v8::FunctionTemplate::New(IsInputInProgress);
480 if (name->Equals(v8::String::New("IsKeyCaptureEnabled"))) 483 if (name->Equals(v8::String::New("IsKeyCaptureEnabled")))
481 return v8::FunctionTemplate::New(IsKeyCaptureEnabled); 484 return v8::FunctionTemplate::New(IsKeyCaptureEnabled);
482 if (name->Equals(v8::String::New("LogEvent"))) 485 if (name->Equals(v8::String::New("LogEvent")))
483 return v8::FunctionTemplate::New(LogEvent); 486 return v8::FunctionTemplate::New(LogEvent);
484 if (name->Equals(v8::String::New("NavigateContentWindow"))) 487 if (name->Equals(v8::String::New("NavigateContentWindow")))
485 return v8::FunctionTemplate::New(NavigateContentWindow); 488 return v8::FunctionTemplate::New(NavigateContentWindow);
489 if (name->Equals(v8::String::New("Paste")))
490 return v8::FunctionTemplate::New(Paste);
486 if (name->Equals(v8::String::New("SetVoiceSearchSupported"))) 491 if (name->Equals(v8::String::New("SetVoiceSearchSupported")))
487 return v8::FunctionTemplate::New(SetVoiceSearchSupported); 492 return v8::FunctionTemplate::New(SetVoiceSearchSupported);
488 if (name->Equals(v8::String::New("StartCapturingKeyStrokes"))) 493 if (name->Equals(v8::String::New("StartCapturingKeyStrokes")))
489 return v8::FunctionTemplate::New(StartCapturingKeyStrokes); 494 return v8::FunctionTemplate::New(StartCapturingKeyStrokes);
490 if (name->Equals(v8::String::New("StopCapturingKeyStrokes"))) 495 if (name->Equals(v8::String::New("StopCapturingKeyStrokes")))
491 return v8::FunctionTemplate::New(StopCapturingKeyStrokes); 496 return v8::FunctionTemplate::New(StopCapturingKeyStrokes);
492 if (name->Equals(v8::String::New("UndoAllMostVisitedDeletions"))) 497 if (name->Equals(v8::String::New("UndoAllMostVisitedDeletions")))
493 return v8::FunctionTemplate::New(UndoAllMostVisitedDeletions); 498 return v8::FunctionTemplate::New(UndoAllMostVisitedDeletions);
494 if (name->Equals(v8::String::New("UndoMostVisitedDeletion"))) 499 if (name->Equals(v8::String::New("UndoMostVisitedDeletion")))
495 return v8::FunctionTemplate::New(UndoMostVisitedDeletion); 500 return v8::FunctionTemplate::New(UndoMostVisitedDeletion);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 if (destination_url.is_valid()) { 846 if (destination_url.is_valid()) {
842 WindowOpenDisposition disposition = CURRENT_TAB; 847 WindowOpenDisposition disposition = CURRENT_TAB;
843 if (args[1]->Uint32Value() == 2) 848 if (args[1]->Uint32Value() == 2)
844 disposition = NEW_BACKGROUND_TAB; 849 disposition = NEW_BACKGROUND_TAB;
845 SearchBox::Get(render_view)->NavigateToURL( 850 SearchBox::Get(render_view)->NavigateToURL(
846 destination_url, transition, disposition, false); 851 destination_url, transition, disposition, false);
847 } 852 }
848 } 853 }
849 854
850 // static 855 // static
856 void SearchBoxExtensionWrapper::Paste(
857 const v8::FunctionCallbackInfo<v8::Value>& args) {
858 content::RenderView* render_view = GetRenderView();
859 if (!render_view) return;
860
861 DVLOG(1) << render_view << " Paste";
862
samarth 2013/07/26 22:51:41 nit: omit this line
jfweitz 2013/07/29 18:48:25 Done.
863 SearchBox::Get(render_view)->Paste();
864 }
865
866 // static
851 void SearchBoxExtensionWrapper::StartCapturingKeyStrokes( 867 void SearchBoxExtensionWrapper::StartCapturingKeyStrokes(
852 const v8::FunctionCallbackInfo<v8::Value>& args) { 868 const v8::FunctionCallbackInfo<v8::Value>& args) {
853 content::RenderView* render_view = GetRenderView(); 869 content::RenderView* render_view = GetRenderView();
854 if (!render_view) return; 870 if (!render_view) return;
855 871
856 DVLOG(1) << render_view << " StartCapturingKeyStrokes"; 872 DVLOG(1) << render_view << " StartCapturingKeyStrokes";
857 SearchBox::Get(render_view)->StartCapturingKeyStrokes(); 873 SearchBox::Get(render_view)->StartCapturingKeyStrokes();
858 } 874 }
859 875
860 // static 876 // static
(...skipping 30 matching lines...) Expand all
891 void SearchBoxExtensionWrapper::UndoMostVisitedDeletion( 907 void SearchBoxExtensionWrapper::UndoMostVisitedDeletion(
892 const v8::FunctionCallbackInfo<v8::Value>& args) { 908 const v8::FunctionCallbackInfo<v8::Value>& args) {
893 content::RenderView* render_view = GetRenderView(); 909 content::RenderView* render_view = GetRenderView();
894 if (!render_view || !args.Length()) return; 910 if (!render_view || !args.Length()) return;
895 911
896 DVLOG(1) << render_view << " UndoMostVisitedDeletion"; 912 DVLOG(1) << render_view << " UndoMostVisitedDeletion";
897 SearchBox::Get(render_view)->UndoMostVisitedDeletion(args[0]->IntegerValue()); 913 SearchBox::Get(render_view)->UndoMostVisitedDeletion(args[0]->IntegerValue());
898 } 914 }
899 915
900 } // namespace extensions_v8 916 } // namespace extensions_v8
OLDNEW
« chrome/browser/ui/search/instant_controller.cc ('K') | « chrome/renderer/searchbox/searchbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698