diff options
author | komatsu@chromium.org <komatsu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-12 17:27:40 +0000 |
---|---|---|
committer | komatsu@chromium.org <komatsu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-12 17:27:40 +0000 |
commit | ff5c7e6d18ef3f4c937e0814728af5a039ff37b4 (patch) | |
tree | c2e35e70f1f7fac1f1bb5cfaa937587e89f476d8 | |
parent | c27ec9229128b81006d8a610d08678d99174f61d (diff) | |
download | chromium_src-ff5c7e6d18ef3f4c937e0814728af5a039ff37b4.zip chromium_src-ff5c7e6d18ef3f4c937e0814728af5a039ff37b4.tar.gz chromium_src-ff5c7e6d18ef3f4c937e0814728af5a039ff37b4.tar.bz2 |
Add input.ime.sendKeyEvents.
This patch adds input.ime.sendKeyEvents to IME JS API.
The actual implementation of the function will be added in the next patch.
BUG=326931
Review URL: https://codereview.chromium.org/110083002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240351 0039d316-1c4b-4281-b951-d872f2087c98
5 files changed, 53 insertions, 2 deletions
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc index 5bcb621..e289756 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc @@ -22,6 +22,7 @@ namespace KeyEventHandled = extensions::api::input_ime::KeyEventHandled; namespace DeleteSurroundingText = extensions::api::input_ime::DeleteSurroundingText; namespace UpdateMenuItems = extensions::api::input_ime::UpdateMenuItems; +namespace SendKeyEvents = extensions::api::input_ime::SendKeyEvents; namespace SetMenuItems = extensions::api::input_ime::SetMenuItems; namespace SetCursorPosition = extensions::api::input_ime::SetCursorPosition; namespace SetCandidates = extensions::api::input_ime::SetCandidates; @@ -499,6 +500,11 @@ bool InputImeCommitTextFunction::RunImpl() { return true; } +bool InputImeSendKeyEventsFunction::RunImpl() { + // TODO(komatsu): Implement here. + return true; +} + bool InputImeSetCandidateWindowPropertiesFunction::RunImpl() { scoped_ptr<SetCandidateWindowProperties::Params> parent_params( SetCandidateWindowProperties::Params::Create(*args_)); diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.h b/chrome/browser/extensions/api/input_ime/input_ime_api.h index 702b104..8f546b6 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api.h +++ b/chrome/browser/extensions/api/input_ime/input_ime_api.h @@ -189,6 +189,18 @@ class InputImeKeyEventHandledFunction : public AsyncExtensionFunction { virtual bool RunImpl() OVERRIDE; }; +class InputImeSendKeyEventsFunction : public AsyncExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("input.ime.sendKeyEvents", + INPUT_IME_SENDKEYEVENTS) + + protected: + virtual ~InputImeSendKeyEventsFunction() {} + + // ExtensionFunction: + virtual bool RunImpl() OVERRIDE; +}; + class InputImeAPI : public ProfileKeyedAPI, public content::NotificationObserver { public: diff --git a/chrome/browser/extensions/extension_function_histogram_value.h b/chrome/browser/extensions/extension_function_histogram_value.h index c6f9104..42d37da 100644 --- a/chrome/browser/extensions/extension_function_histogram_value.h +++ b/chrome/browser/extensions/extension_function_histogram_value.h @@ -709,6 +709,7 @@ enum HistogramValue { SOCKETS_UDP_SETPAUSED, WEBVIEW_CAPTUREVISIBLEREGION, MEDIAGALLERIES_GETMETADATA, + INPUT_IME_SENDKEYEVENTS, ENUM_BOUNDARY // Last entry: Add new entries above. }; diff --git a/chrome/common/extensions/api/input_ime.json b/chrome/common/extensions/api/input_ime.json index 0ff882b..7254776 100644 --- a/chrome/common/extensions/api/input_ime.json +++ b/chrome/common/extensions/api/input_ime.json @@ -185,9 +185,40 @@ ] }, { + "name": "sendKeyEvents", + "type": "function", + "description": "Sends the key events. This function is expected to be used by virtual keyboards. When key(s) on a virtual keyboard is pressed by a user, this function is used to propagate that event to the system.", + "parameters": [ + { + "name": "parameters", + "type": "object", + "properties": { + "contextID": { + "description": "ID of the context where the key events will be sent", + "type": "integer" + }, + "keyData": { + "type": "array", + "description": "Data on the key event.", + "items": { + "$ref": "KeyboardEvent" + } + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called when the operation completes.", + "parameters": [] + } + ] + }, + { "name": "setCandidateWindowProperties", "type": "function", - "description": "Sets the properties of the candidate window. This fails if the extension doesn’t own the active IME", + "description": "Sets the properties of the candidate window. This fails if the extension doesn't own the active IME", "parameters": [ { "name": "parameters", @@ -257,7 +288,7 @@ { "name": "setCandidates", "type": "function", - "description": "Sets the current candidate list. This fails if this extension doesn’t own the active IME", + "description": "Sets the current candidate list. This fails if this extension doesn't own the active IME", "parameters": [ { "name": "parameters", diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 0db4498..fb1eacb 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -24137,6 +24137,7 @@ other types of suffix sets. <int value="647" label="SOCKETS_UDP_SETPAUSED"/> <int value="648" label="WEBVIEW_CAPTUREVISIBLEREGION"/> <int value="649" label="MEDIAGALLERIES_GETMETADATA"/> + <int value="650" label="INPUT_IME_SENDKEYEVENTS"/> </enum> <enum name="ExtensionInstallCause" type="int"> |