| Index: chrome/renderer/searchbox/searchbox_extension.cc
|
| diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc
|
| index ba6fad7e4c2f6856440f7d2e4e4016ac05e3d3cd..7a6e1ad87606698361bd974370b9c86ea7ecec69 100644
|
| --- a/chrome/renderer/searchbox/searchbox_extension.cc
|
| +++ b/chrome/renderer/searchbox/searchbox_extension.cc
|
| @@ -141,6 +141,15 @@ static const char kDispatchUpOrDownKeyPressEventScript[] =
|
| " true;"
|
| "}";
|
|
|
| +static const char kDispatchKeyCaptureChangeScript[] =
|
| + "if (window.chrome &&"
|
| + " window.chrome.searchBox &&"
|
| + " window.chrome.searchBox.onkeycapturechange &&"
|
| + " typeof window.chrome.searchBox.onkeycapturechange == 'function') {"
|
| + " window.chrome.searchBox.onkeycapturechange();"
|
| + " true;"
|
| + "}";
|
| +
|
| static const char kDispatchContextChangeEventScript[] =
|
| "if (window.chrome &&"
|
| " window.chrome.searchBox &&"
|
| @@ -234,6 +243,9 @@ class SearchBoxExtensionWrapper : public v8::Extension {
|
| // "top".
|
| static v8::Handle<v8::Value> GetThemeAreaHeight(const v8::Arguments& args);
|
|
|
| + // Gets whether the browser is capturing key strokes.
|
| + static v8::Handle<v8::Value> IsKeyCaptureEnabled(const v8::Arguments& args);
|
| +
|
| // Navigates the window to a URL represented by either a URL string or a
|
| // restricted ID.
|
| static v8::Handle<v8::Value> NavigateContentWindow(const v8::Arguments& args);
|
| @@ -303,6 +315,8 @@ v8::Handle<v8::FunctionTemplate> SearchBoxExtensionWrapper::GetNativeFunction(
|
| return v8::FunctionTemplate::New(GetThemeBackgroundInfo);
|
| if (name->Equals(v8::String::New("GetThemeAreaHeight")))
|
| return v8::FunctionTemplate::New(GetThemeAreaHeight);
|
| + if (name->Equals(v8::String::New("IsKeyCaptureEnabled")))
|
| + return v8::FunctionTemplate::New(IsKeyCaptureEnabled);
|
| if (name->Equals(v8::String::New("NavigateContentWindow")))
|
| return v8::FunctionTemplate::New(NavigateContentWindow);
|
| if (name->Equals(v8::String::New("SetSuggestions")))
|
| @@ -445,6 +459,16 @@ v8::Handle<v8::Value> SearchBoxExtensionWrapper::GetAutocompleteResults(
|
| }
|
|
|
| // static
|
| +v8::Handle<v8::Value> SearchBoxExtensionWrapper::IsKeyCaptureEnabled(
|
| + const v8::Arguments& args) {
|
| + content::RenderView* render_view = GetRenderView();
|
| + if (!render_view) return v8::Undefined();
|
| +
|
| + return v8::Boolean::New(SearchBox::Get(render_view)->
|
| + is_key_capture_enabled());
|
| +}
|
| +
|
| +// static
|
| v8::Handle<v8::Value> SearchBoxExtensionWrapper::GetContext(
|
| const v8::Arguments& args) {
|
| content::RenderView* render_view = GetRenderView();
|
| @@ -830,6 +854,11 @@ void SearchBoxExtension::DispatchUpOrDownKeyPress(WebKit::WebFrame* frame,
|
| }
|
|
|
| // static
|
| +void SearchBoxExtension::DispatchKeyCaptureChange(WebKit::WebFrame* frame) {
|
| + Dispatch(frame, kDispatchKeyCaptureChangeScript);
|
| +}
|
| +
|
| +// static
|
| void SearchBoxExtension::DispatchContextChange(WebKit::WebFrame* frame) {
|
| Dispatch(frame, kDispatchContextChangeEventScript);
|
| }
|
|
|