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

Unified Diff: chrome/renderer/searchbox/searchbox_extension.cc

Issue 23462014: InstantExtended: add back focus() API call. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix semi-colon. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/renderer/searchbox/searchbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698