Commit c9a9fa3d authored by Yuichiro Hanada's avatar Yuichiro Hanada Committed by Commit Bot

Tell the proxy IME to send a received key event.

When ARC apps receive a key event before IME, a key event which is not
consumed by the apps has to be sent to the IME.
The new mojo method is added to let the proxy IME ask ArcImeService
whether it should send back a key event.

Bug: b:148193316
Change-Id: I6bbb83b9b3ab58a11ab5e9c01ce626255871818f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2269386Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Reviewed-by: default avatarMattias Nissler <mnissler@chromium.org>
Commit-Queue: Yuichiro Hanada <yhanada@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784440}
parent 98dd0269
...@@ -42,6 +42,7 @@ class ArcImeBridge { ...@@ -42,6 +42,7 @@ class ArcImeBridge {
const base::string16& text_in_range, const base::string16& text_in_range,
const gfx::Range& selection_range, const gfx::Range& selection_range,
bool is_screen_coordinates) = 0; bool is_screen_coordinates) = 0;
virtual bool ShouldEnableKeyEventForwarding() = 0;
}; };
// Serializes and sends IME related requests through IPCs. // Serializes and sends IME related requests through IPCs.
......
...@@ -154,4 +154,9 @@ void ArcImeBridgeImpl::RequestHideImeDeprecated() { ...@@ -154,4 +154,9 @@ void ArcImeBridgeImpl::RequestHideImeDeprecated() {
DVLOG(1) << "RequestHideIme is deprecated."; DVLOG(1) << "RequestHideIme is deprecated.";
} }
void ArcImeBridgeImpl::ShouldEnableKeyEventForwarding(
ShouldEnableKeyEventForwardingCallback callback) {
std::move(callback).Run(delegate_->ShouldEnableKeyEventForwarding());
}
} // namespace arc } // namespace arc
...@@ -52,6 +52,8 @@ class ArcImeBridgeImpl : public ArcImeBridge, public mojom::ImeHost { ...@@ -52,6 +52,8 @@ class ArcImeBridgeImpl : public ArcImeBridge, public mojom::ImeHost {
const gfx::Range& selection_range, const gfx::Range& selection_range,
bool screen_coordinates) override; bool screen_coordinates) override;
void RequestHideImeDeprecated() override; void RequestHideImeDeprecated() override;
void ShouldEnableKeyEventForwarding(
ShouldEnableKeyEventForwardingCallback callback) override;
private: private:
Delegate* const delegate_; Delegate* const delegate_;
......
...@@ -387,6 +387,11 @@ void ArcImeService::OnCursorRectChangedWithSurroundingText( ...@@ -387,6 +387,11 @@ void ArcImeService::OnCursorRectChangedWithSurroundingText(
input_method->OnCaretBoundsChanged(this); input_method->OnCaretBoundsChanged(this);
} }
bool ArcImeService::ShouldEnableKeyEventForwarding() {
return base::FeatureList::IsEnabled(
chromeos::features::kArcPreImeKeyEventSupport);
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Overridden from ash::KeyboardControllerObserver // Overridden from ash::KeyboardControllerObserver
void ArcImeService::OnKeyboardAppearanceChanged( void ArcImeService::OnKeyboardAppearanceChanged(
......
...@@ -101,6 +101,7 @@ class ArcImeService : public KeyedService, ...@@ -101,6 +101,7 @@ class ArcImeService : public KeyedService,
const base::string16& text_in_range, const base::string16& text_in_range,
const gfx::Range& selection_range, const gfx::Range& selection_range,
bool is_screen_coordinates) override; bool is_screen_coordinates) override;
bool ShouldEnableKeyEventForwarding() override;
// Overridden from ash::KeyboardControllerObserver. // Overridden from ash::KeyboardControllerObserver.
void OnKeyboardAppearanceChanged( void OnKeyboardAppearanceChanged(
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Next MinVersion: 13 // Next MinVersion: 14
module arc.mojom; module arc.mojom;
...@@ -56,7 +56,7 @@ struct KeyEventData { ...@@ -56,7 +56,7 @@ struct KeyEventData {
bool is_capslock_on; bool is_capslock_on;
}; };
// Next method ID: 6 // Next method ID: 7
interface ImeHost { interface ImeHost {
// Notifies Chrome that the text input focus is changed. // Notifies Chrome that the text input focus is changed.
// Each bit of the bitmask |flags| corresponds to TEXT_INPUT_FLAG_*. // Each bit of the bitmask |flags| corresponds to TEXT_INPUT_FLAG_*.
...@@ -105,6 +105,9 @@ interface ImeHost { ...@@ -105,6 +105,9 @@ interface ImeHost {
// Requests Chrome to hide the virtual keyboard. // Requests Chrome to hide the virtual keyboard.
// However, hiding can be canceled if a text field gets focus. // However, hiding can be canceled if a text field gets focus.
[MinVersion=9] RequestHideImeDeprecated@5(); [MinVersion=9] RequestHideImeDeprecated@5();
// Asks Chrome whether the proxy IME should send a key event to the host IME.
[MinVersion=13] ShouldEnableKeyEventForwarding@6() => (bool should_forward);
}; };
// Next method ID: 8 // Next method ID: 8
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment