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 56e61604ba79ce3e6da24385f3def4566abf11a4..c1a95fe15440ac8ad6c740cbc6c641987b8bae5e 100644 |
| --- a/chrome/renderer/searchbox/searchbox_extension.cc |
| +++ b/chrome/renderer/searchbox/searchbox_extension.cc |
| @@ -142,6 +142,16 @@ static const char kDispatchUpOrDownKeyPressEventScript[] = |
| " true;" |
| "}"; |
| +// Takes one printf-style replaceable values: key_code. |
|
sreeram
2013/02/12 20:52:59
values -> value
beaudoin
2013/02/12 21:34:41
Done.
|
| +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.searchBox &&" |
| @@ -933,6 +943,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); |
| } |