Index: chrome/renderer/searchbox/searchbox_extension.cc |
diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc |
index f0bc3413fa502e5de0b3ca55cfa22c57c1f4800a..948aaea59832b8488cb8ef7cc3733432a63fcbfe 100644 |
--- a/chrome/renderer/searchbox/searchbox_extension.cc |
+++ b/chrome/renderer/searchbox/searchbox_extension.cc |
@@ -321,6 +321,9 @@ class SearchBoxExtensionWrapper : public v8::Extension { |
static void DeleteMostVisitedItem( |
const v8::FunctionCallbackInfo<v8::Value>& args); |
+ // Focuses the omnibox. |
+ static void Focus(const v8::FunctionCallbackInfo<v8::Value>& args); |
+ |
// Gets whether or not the app launcher is enabled. |
static void GetAppLauncherEnabled( |
const v8::FunctionCallbackInfo<v8::Value>& args); |
@@ -485,6 +488,8 @@ v8::Handle<v8::FunctionTemplate> SearchBoxExtensionWrapper::GetNativeFunction( |
v8::Handle<v8::String> name) { |
if (name->Equals(v8::String::New("DeleteMostVisitedItem"))) |
return v8::FunctionTemplate::New(DeleteMostVisitedItem); |
+ if (name->Equals(v8::String::New("Focus"))) |
+ return v8::FunctionTemplate::New(Focus); |
if (name->Equals(v8::String::New("GetAppLauncherEnabled"))) |
return v8::FunctionTemplate::New(GetAppLauncherEnabled); |
if (name->Equals(v8::String::New("GetFont"))) |
@@ -554,6 +559,16 @@ void SearchBoxExtensionWrapper::DeleteMostVisitedItem( |
} |
// static |
+void SearchBoxExtensionWrapper::Focus( |
+ const v8::FunctionCallbackInfo<v8::Value>& args) { |
+ content::RenderView* render_view = GetRenderView(); |
+ if (!render_view) return; |
+ |
+ DVLOG(1) << render_view << " Focus"; |
+ SearchBox::Get(render_view)->Focus(); |
+} |
+ |
+// static |
void SearchBoxExtensionWrapper::GetAppLauncherEnabled( |
const v8::FunctionCallbackInfo<v8::Value>& args) { |
content::RenderView* render_view = GetRenderView(); |