Implement inputMethodPrivate.finishComposingText
The TextInputClients are responsible for updating the committed text
correctly, as TextInputClients should be aware of the current composition
and text selection. Currently, the TextInputClient::ConfirmComposingText()
implementation says that clients have to confirm the composing text, but
it does not specify what should happen to the selection. It makes sense
to add a new keep_selection parameter to indicate if we want to leave the
selection range unchanged when committing text.
Modified the TextInputClient::ConfirmComposingText() to have a
keep_selection parameter and use it in the RenderHostWidgetViewAura::ConfirmCompositionText()
function implementation.
Modified InputMethodEngineBase::ConfirmCompositionText(bool reset_engine)
and InputMethod::ConfirmCompositionText(bool reset_engine) to also pipe the parameter
to the API layer.
This allows us to easily implement a new API chrome.inputMethodPrivate.finishComposing
which will commit the text currently being composed, without changing the selected text
This API will not work correctly until all TextInputClient::ConfirmComposingText() have
been updated to not modify the selection when the keep_selection param is set, but those
changes will be made in a separate CL to avoid this CL becoming too big.
Changes to third_party/closure_compiler/externs/input_method_private.js
were generated by running:
```
python tools/json_schema_compiler/compiler.py /usr/local/google/home/keithlee/chromium/src/chrome/common/extensions/api/input_method_private.json --root=. --generator=externs > /usr/local/google/home/keithlee/chromium/src/third_party/closure_compiler/externs/input_method_private.js
```
Change-Id: Ieb5daac3cc3bf890c7062394c64ec53976c7d64c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1885149
Reviewed-by: Ben Wells <[email protected]>
Reviewed-by: Keith Lee <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: Yuichiro Hanada <[email protected]>
Reviewed-by: Darren Shen <[email protected]>
Reviewed-by: Shu Chen <[email protected]>
Commit-Queue: Keith Lee <[email protected]>
Auto-Submit: Keith Lee <[email protected]>
Cr-Commit-Position: refs/heads/master@{#713746}
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h
index 6eee8b7..5906339 100644
--- a/extensions/browser/extension_function_histogram_value.h
+++ b/extensions/browser/extension_function_histogram_value.h
@@ -1466,6 +1466,7 @@
AUTOTESTPRIVATE_REMOVEACTIVEDESK = 1403,
TERMINALPRIVATE_GETCROSHSETTINGS = 1404,
AUTOTESTPRIVATE_ENABLEASSISTANTANDWAITFORREADY = 1405,
+ INPUTMETHODPRIVATE_FINISHCOMPOSINGTEXT = 1406,
// Last entry: Add new entries above, then run:
// python tools/metrics/histograms/update_extension_histograms.py
ENUM_BOUNDARY