1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37

ash / webui / common / mojom / shortcut_input_provider.mojom [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module ash.common.mojom;

import "ash/public/mojom/input_device_settings.mojom";

// ShortcutInputObserver is the interface used to get notified of key events
// for the purposes of inputing shortcuts in ChromeOS. This will initially be
// used in the Settings App for Peripheral Customization.
interface ShortcutInputObserver {
  // Called whenever a key event is pressed and the target window has focus.
  // `prerewritten_event` is the event before any event rewrites.
  // `key_event` is the event after event rewrites. Some events get discarded
  // before a real event is produced, but we still want to be able to
  // track the `prerewritten_event`.
  OnShortcutInputEventPressed(ash.mojom.KeyEvent prerewritten_key_event,
                              ash.mojom.KeyEvent? key_event);

  // Called whenever a key event is pressed and the target window has focus.
  // `prerewritten_event` is the event before any event rewrites.
  // `key_event` is the event after event rewrites.
  OnShortcutInputEventReleased(ash.mojom.KeyEvent prerewritten_key_event,
                               ash.mojom.KeyEvent? key_event);
};

// ShortcutInputProvider is the interface which key events are communicated for
// the purpose of inputing customizable shortcuts in ChromeOS. This will
// initially be used in the Settings App for Peripheral Customization.
interface ShortcutInputProvider {
  // Starts observing key events if the target app is in focus.
  StartObservingShortcutInput(pending_remote<ShortcutInputObserver> observer);

  // Stops observing key events.
  StopObservingShortcutInput();
};