customization: Allow button remapping for graphics tablet buttons

Adds VKEY values for "button" key events so that these can be processed
by Peripheral Customization. This will allow graphics tablet buttons to
be fully customizable via Peripheral Customization.

Bug: b/241965717
Change-Id: I7bcd70696b368504e9bef2818c02a07933177ab9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4998272
Reviewed-by: Scott Violet <[email protected]>
Code-Coverage: [email protected] <[email protected]>
Commit-Queue: David Padlipsky <[email protected]>
Reviewed-by: Will Harris <[email protected]>
Reviewed-by: Sean O'Brien <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1246102}
diff --git a/ash/events/peripheral_customization_event_rewriter.cc b/ash/events/peripheral_customization_event_rewriter.cc
index 2086399d..d8cb61c63 100644
--- a/ash/events/peripheral_customization_event_rewriter.cc
+++ b/ash/events/peripheral_customization_event_rewriter.cc
@@ -674,6 +674,11 @@
     UpdatePressedButtonMap(std::move(button), key_event, rewritten_event);
   }
 
+  if (!rewritten_event && key_event.key_code() >= ui::VKEY_BUTTON_0 &&
+      key_event.key_code() <= ui::VKEY_BUTTON_Z) {
+    return DiscardEvent(continuation);
+  }
+
   if (!rewritten_event) {
     rewritten_event = std::make_unique<ui::KeyEvent>(key_event);
   }