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

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: Focus handled in browser_instant_controller 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 3eacc3c6d6db1bbed4433b805dcefcba70538dec..5c1551895cc9efeb7dec9ee7ef74a335efecfc84 100644
--- a/chrome/renderer/searchbox/searchbox_extension.cc
+++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -362,6 +362,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);
@@ -485,6 +488,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")))
@@ -852,6 +857,16 @@ 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";
+ SearchBox::Get(render_view)->Paste();
+}
+
+// static
void SearchBoxExtensionWrapper::StartCapturingKeyStrokes(
const v8::FunctionCallbackInfo<v8::Value>& args) {
content::RenderView* render_view = GetRenderView();
« chrome/browser/ui/browser_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