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

Migrate EventRewriterChromeOS to new API (5/n).

This CL changes RewriteKeyEventInContext to use the new API.
Before this CL, EventRewriterChromeOS::NextDispatchEvent sends the
events from StickyKeysControllers and the events generated in
RewriteKeyEventInContext. Now, RewriteKeyEventInContext takes
Continuation as an argument and sends all generated events without
storing them in dispatched_key_events_ and gets events from
StickyKeysController if it has pending events.
As the result, we can remove dispatched_key_events_ field and
EventRewriterChromeOS::NextDispatchEvent.
However, EventRewriteStatus is still used inside EventRewriterChromeOS,
so we can't clean up them yet.

Bug: 1049489
Test: unit_tests
Change-Id: I41109afa57bc1407beab6ab264bcbfc992d9f1ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2056526
Commit-Queue: Yuichiro Hanada <yhanada@chromium.org>
Reviewed-by: default avatarMitsuru Oshima (OOO) <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743440}
parent cc41d132
......@@ -151,12 +151,6 @@ class EventRewriterChromeOS : public ui::EventRewriter {
ui::EventDispatchDetails RewriteEvent(
const ui::Event& event,
const Continuation continuation) override;
ui::EventRewriteStatus RewriteEvent(
const ui::Event& event,
std::unique_ptr<ui::Event>* rewritten_event) override;
ui::EventRewriteStatus NextDispatchEvent(
const ui::Event& last_event,
std::unique_ptr<ui::Event>* new_event) override;
// Generate a new key event from an original key event and the replacement
// state determined by a key rewriter.
......@@ -262,9 +256,15 @@ class EventRewriterChromeOS : public ui::EventRewriter {
// Take the keys being pressed into consideration, in contrast to
// RewriteKeyEvent which computes the rewritten event and event rewrite
// status in stateless way.
void RewriteKeyEventInContext(const ui::KeyEvent& event,
std::unique_ptr<ui::Event>* rewritten_event,
ui::EventRewriteStatus* status);
ui::EventDispatchDetails RewriteKeyEventInContext(
const ui::KeyEvent& event,
std::unique_ptr<ui::Event> rewritten_event,
ui::EventRewriteStatus status,
const Continuation continuation);
ui::EventDispatchDetails SendStickyKeysReleaseEvents(
std::unique_ptr<ui::Event> rewritten_event,
const Continuation continuation);
// A set of device IDs whose press event has been rewritten.
// This is to ensure that press and release events are rewritten consistently.
......@@ -285,9 +285,6 @@ class EventRewriterChromeOS : public ui::EventRewriter {
// element and the second element are identical.
std::list<std::pair<MutableKeyState, MutableKeyState>> pressed_key_states_;
// Store key events when there are more than one key events to be dispatched.
std::vector<std::unique_ptr<ui::KeyEvent>> dispatched_key_events_;
// The sticky keys controller is not owned here;
// at time of writing it is a singleton in ash::Shell.
ui::EventRewriter* const sticky_keys_controller_;
......
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