Chromium Code Reviews| 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..4b5d81b876c1b096e23d1378fce54137236e088b 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 provided value or 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,21 @@ 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/08/06 18:39:44
Might as well also output the text here.
jfweitz
2013/08/09 02:37:41
Done.
|
| + string16 text; |
| + |
|
samarth
2013/08/06 18:39:44
nit: remove empty line
jfweitz
2013/08/09 02:37:41
Done.
|
| + if (!args[0]->IsUndefined()) |
| + text = V8ValueToUTF16(args[0]); |
| + |
| + SearchBox::Get(render_view)->Paste(text); |
| +} |
| + |
| +// static |
| void SearchBoxExtensionWrapper::StartCapturingKeyStrokes( |
| const v8::FunctionCallbackInfo<v8::Value>& args) { |
| content::RenderView* render_view = GetRenderView(); |