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

Unified 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, 5 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
Index: chrome/renderer/searchbox/searchbox_extension.cc
diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc
index 7a1267bfbf73405f1d59a4ab1426493f40d7e61f..d8485acc9d61a80745eecb0055391cf3706b9652 100644
--- a/chrome/renderer/searchbox/searchbox_extension.cc
+++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -360,6 +360,9 @@ class SearchBoxExtensionWrapper : public v8::Extension {
static void NavigateContentWindow(
const v8::FunctionCallbackInfo<v8::Value>& args);
+ // Pastes clipboard's content into the omnibox.
+ static void Paste(const v8::FunctionCallbackInfo<v8::Value>& args);
+
// Indicates whether the page supports voice search.
static void SetVoiceSearchSupported(
const v8::FunctionCallbackInfo<v8::Value>& args);
@@ -483,6 +486,8 @@ v8::Handle<v8::FunctionTemplate> SearchBoxExtensionWrapper::GetNativeFunction(
return v8::FunctionTemplate::New(LogEvent);
if (name->Equals(v8::String::New("NavigateContentWindow")))
return v8::FunctionTemplate::New(NavigateContentWindow);
+ if (name->Equals(v8::String::New("Paste")))
+ return v8::FunctionTemplate::New(Paste);
if (name->Equals(v8::String::New("SetVoiceSearchSupported")))
return v8::FunctionTemplate::New(SetVoiceSearchSupported);
if (name->Equals(v8::String::New("StartCapturingKeyStrokes")))
@@ -848,6 +853,17 @@ void SearchBoxExtensionWrapper::NavigateContentWindow(
}
// static
+void SearchBoxExtensionWrapper::Paste(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ content::RenderView* render_view = GetRenderView();
+ if (!render_view) return;
+
+ DVLOG(1) << render_view << " Paste";
+
samarth 2013/07/26 22:51:41 nit: omit this line
jfweitz 2013/07/29 18:48:25 Done.
+ SearchBox::Get(render_view)->Paste();
+}
+
+// static
void SearchBoxExtensionWrapper::StartCapturingKeyStrokes(
const v8::FunctionCallbackInfo<v8::Value>& args) {
content::RenderView* render_view = GetRenderView();
« 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