| Index: chrome/renderer/searchbox/searchbox_extension.cc
|
| diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc
|
| index 161c84449e1e0c398b379e2884fdeac264e146cc..cd74c6f0021efe634748a11079f669d689e9f883 100644
|
| --- a/chrome/renderer/searchbox/searchbox_extension.cc
|
| +++ b/chrome/renderer/searchbox/searchbox_extension.cc
|
| @@ -155,6 +155,16 @@ static const char kDispatchUpOrDownKeyPressEventScript[] =
|
| " true;"
|
| "}";
|
|
|
| +// Takes one printf-style replaceable value: key_code.
|
| +static const char kDispatchEscKeyPressEventScript[] =
|
| + "if (window.chrome &&"
|
| + " window.chrome.searchBox &&"
|
| + " window.chrome.searchBox.onkeypress &&"
|
| + " typeof window.chrome.searchBox.onkeypress == 'function') {"
|
| + " window.chrome.searchBox.onkeypress({keyCode: %d});"
|
| + " true;"
|
| + "}";
|
| +
|
| static const char kDispatchKeyCaptureChangeScript[] =
|
| "if (window.chrome &&"
|
| " window.chrome.embeddedSearch &&"
|
| @@ -930,6 +940,12 @@ void SearchBoxExtension::DispatchUpOrDownKeyPress(WebKit::WebFrame* frame,
|
| }
|
|
|
| // static
|
| +void SearchBoxExtension::DispatchEscKeyPress(WebKit::WebFrame* frame) {
|
| + Dispatch(frame, WebKit::WebString::fromUTF8(
|
| + base::StringPrintf(kDispatchEscKeyPressEventScript, ui::VKEY_ESCAPE)));
|
| +}
|
| +
|
| +// static
|
| void SearchBoxExtension::DispatchKeyCaptureChange(WebKit::WebFrame* frame) {
|
| Dispatch(frame, kDispatchKeyCaptureChangeScript);
|
| }
|
|
|