shortcuts: Add initial implementation of PrewrittenEventForwarder
PrewrittenEventForwarder will notify clients of events before it has
gone through any rewriters. This is useful for surfaces that want
what has actually been pressed, e.g. shortcut customization input
handler.
Bug: b/308843852, b/216049298
Test: ash_unittests
Change-Id: I21b8cd71e16dad312271fb081a3a8b8515e30058
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4998123
Commit-Queue: Jimmy Gong <[email protected]>
Reviewed-by: David Padlipsky <[email protected]>
Reviewed-by: James Cook <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1223082}
diff --git a/ash/events/peripheral_customization_event_rewriter.cc b/ash/events/peripheral_customization_event_rewriter.cc
index 2e33854..b2cb767 100644
--- a/ash/events/peripheral_customization_event_rewriter.cc
+++ b/ash/events/peripheral_customization_event_rewriter.cc
@@ -19,6 +19,7 @@
#include "base/containers/fixed_flat_map.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
+#include "ui/base/ui_base_features.h"
#include "ui/display/screen.h"
#include "ui/events/event.h"
#include "ui/events/event_constants.h"
@@ -659,7 +660,8 @@
ui::EventDispatchDetails PeripheralCustomizationEventRewriter::RewriteEvent(
const ui::Event& event,
const Continuation continuation) {
- DCHECK(features::IsPeripheralCustomizationEnabled());
+ DCHECK(features::IsPeripheralCustomizationEnabled() ||
+ ::features::IsShortcutCustomizationEnabled());
if (event.IsMouseEvent()) {
return RewriteMouseEvent(*event.AsMouseEvent(), continuation);