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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475
|
// 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.
// Use the <code>chrome.os.events</code> API to subscribe to real time events.
[implemented_in = "chrome/browser/chromeos/extensions/telemetry/api/events/events_api.h"]
namespace os.events {
// Note: Please update documentation as well when this interface is changed.
// The documentation lives here: //docs/telemetry_extension/api_overview.md.
// LINT.IfChange
enum EventCategory {
audio_jack,
lid,
usb,
sd_card,
power,
keyboard_diagnostic,
stylus_garage,
touchpad_button,
touchpad_touch,
touchpad_connected,
touchscreen_touch,
touchscreen_connected,
external_display,
stylus_touch,
stylus_connected
};
enum EventSupportStatus {
supported,
unsupported
};
dictionary EventSupportStatusInfo {
EventSupportStatus? status;
};
callback EventSupportStatusInfoCallback = void(
EventSupportStatusInfo info);
enum AudioJackEvent {
// The audio jack was connected.
connected,
// The audio jack was disconnected.
disconnected
};
enum AudioJackDeviceType {
// The device is a headphone.
headphone,
// The device is a microphone.
microphone
};
enum KeyboardConnectionType {
// Includes devices connected over USB that are on fully internal
// busses, as well as the keyboards/touchpads for detachables.
internal,
usb,
bluetooth,
// An unknown device is most likely to be internal.
unknown
};
enum PhysicalKeyboardLayout {
unknown,
// A typical Chrome OS keyboard with action keys on the top row, reduced
// navigation keys, etc.
// TODO: Should we map Wilco and drallion to chromeos?
chrome_os
};
// The international standard that the layout follows.
enum MechanicalKeyboardLayout {
unknown,
ansi,
iso,
jis
};
enum KeyboardNumberPadPresence {
// Unknown indicates there is no reliable evidence whether a numberpad
// is present. This is common for external keyboards.
unknown,
present,
not_present
};
enum KeyboardTopRowKey {
// Either no key at all, or no special action key at this position.
no_key,
// Marker for keys which cannot be decoded, but have some action.
unknown,
back,
forward,
refresh,
fullscreen,
overview,
screenshot,
screen_brightness_down,
screen_brightness_up,
privacy_screen_toggle,
microphone_mute,
volume_mute,
volume_down,
volume_up,
keyboard_backlight_toggle,
keyboard_backlight_down,
keyboard_backlight_up,
next_track,
previous_track,
play_pause,
screen_mirror,
delete
};
enum KeyboardTopRightKey {
unknown,
power,
lock,
control_panel
};
// Describes a connected keyboard.
dictionary KeyboardInfo {
// The number of the keyboard's /dev/input/event* node.
long? id;
KeyboardConnectionType? connectionType;
DOMString? name;
PhysicalKeyboardLayout? physicalLayout;
MechanicalKeyboardLayout? mechanicalLayout;
// For internal keyboards, the region code of the device (from which the
// visual layout can be determined).
DOMString? regionCode;
KeyboardNumberPadPresence? numberPadPresent;
// List of ChromeOS specific action keys in the top row. This list
// excludes the left-most Escape key, and right-most key (usually
// Power/Lock).
// If a keyboard has F11-F15 keys beyond the rightmost action key,
// they may not be included in this list (even as "none").
KeyboardTopRowKey[] topRowKeys;
// For CrOS keyboards, the glyph shown on the key at the far right end
// of the top row. This data may not be completely reliable.
KeyboardTopRightKey? topRightKey;
// Only applicable to CrOS keyboards.
boolean? hasAssistantKey;
};
// Keyboard diagnostics event info. It is fired when users completed a
// keyboard diagnostic in the Diagnostics App.
dictionary KeyboardDiagnosticEventInfo {
// The keyboard which has been tested.
KeyboardInfo? keyboardInfo;
// Keys which have been tested. It is an array of the evdev key code.
long[] testedKeys;
// Top row keys which have been tested. They are positions of the key on
// the top row after escape (0 is leftmost, 1 is next to the right,
// etc.).
// Generally, 0 is F1, in some fashion.
// NOTE: This position may exceed the length of
// keyboard_info->top_row_keys, for external keyboards with keys in the
// F11-F15 range.
long[] testedTopRowKeys;
};
enum LidEvent {
// The lid was closed.
closed,
// The lid was opened.
opened
};
enum UsbEvent {
// A USB device was connected.
connected,
// A USB device was disconnected.
disconnected
};
enum ExternalDisplayEvent {
// An external display was connected.
connected,
// An external display was disconnected.
disconnected
};
enum SdCardEvent {
// A SD card was connected.
connected,
// A SD card was disconnected.
disconnected
};
enum PowerEvent {
// The device began consuming from an external power source.
ac_inserted,
// The device stopped consuming from an external power source.
ac_removed,
// The system received a suspend request.
os_suspend,
// The system completed a suspend request, i.e. resumed again.
os_resume
};
enum StylusGarageEvent {
// Stylus inserted into the garage.
inserted,
// Stylus removed from the garage.
removed
};
dictionary AudioJackEventInfo {
AudioJackEvent? event;
AudioJackDeviceType? deviceType;
};
dictionary LidEventInfo {
LidEvent? event;
};
dictionary UsbEventInfo {
// Vendor name.
DOMString? vendor;
// Name, model name, product name.
DOMString? name;
// Vendor ID.
long? vid;
// Product ID.
long? pid;
// USB device categories.
// https://www.usb.org/defined-class-codes
DOMString[] categories;
UsbEvent? event;
};
// An enumeration of display input type.
enum DisplayInputType {
// Unknown enum value.
unknown,
// Digital input.
digital,
// Analog input.
analog
};
dictionary ExternalDisplayInfo {
// Display width in millimeters.
long? displayWidth;
// Display height in millimeters.
long? displayHeight;
// Horizontal resolution.
long? resolutionHorizontal;
// Vertical resolution.
long? resolutionVertical;
// Refresh rate.
double? refreshRate;
// Three letter manufacturer ID.
DOMString? manufacturer;
// Manufacturer product code.
long? modelId;
// 32 bits serial number.
long? serialNumber;
// Week of manufacture.
long? manufactureWeek;
// Year of manufacture.
long? manufactureYear;
// EDID version.
DOMString? edidVersion;
// Digital or analog input.
DisplayInputType inputType;
// Name of display product.
DOMString? displayName;
};
dictionary ExternalDisplayEventInfo {
ExternalDisplayEvent? event;
ExternalDisplayInfo? displayInfo;
};
dictionary SdCardEventInfo {
SdCardEvent? event;
};
dictionary PowerEventInfo {
PowerEvent? event;
};
dictionary StylusGarageEventInfo {
StylusGarageEvent? event;
};
// An enumeration of input touch buttons. The enumeration refers to the
// physical button that is present in some touchpads under the surface.
// Clicks resulting from gestures such as two finger right-click are not
// included here. Separate physical buttons external to the touchpad are
// also not included.
enum InputTouchButton {
// Left key.
left,
// Middle key.
middle,
// Right key.
right
};
enum InputTouchButtonState {
// The button was pressed.
pressed,
// The button was released.
released
};
dictionary TouchpadButtonEventInfo {
InputTouchButton? button;
InputTouchButtonState? state;
};
dictionary TouchPointInfo {
// An id to track an initiated contact throughout its life cycle.
long? trackingId;
// The x position.
long? x;
// The y position.
long? y;
// The pressure applied to the touch contact. The value ranges from 0 to
// |max_pressure| as defined in TouchpadConnectedEventInfo.
long? pressure;
// The length of the longer dimension of the touch contact.
long? touchMajor;
// The length of the shorter dimension of the touch contact.
long? touchMinor;
};
dictionary TouchpadTouchEventInfo {
// The touch points reported by the touchpad.
TouchPointInfo[] touchPoints;
};
dictionary TouchpadConnectedEventInfo {
// The maximum possible x position of touch points.
long? maxX;
// The maximum possible y position of touch points.
long? maxY;
// The maximum possible pressure of touch points, or 0 if pressure is not
// supported.
long? maxPressure;
// The supported buttons;
InputTouchButton[] buttons;
};
dictionary TouchscreenTouchEventInfo {
// The touch points reported by the touchscreen.
TouchPointInfo[] touchPoints;
};
dictionary TouchscreenConnectedEventInfo {
// The maximum possible x position of touch points.
long? maxX;
// The maximum possible y position of touch points.
long? maxY;
// The maximum possible pressure of touch points, or 0 if pressure is not
// supported.
long? maxPressure;
};
dictionary StylusTouchPointInfo {
// The x position. The value ranges from 0 to |max_x| as defined in
// StylusConnectedEventInfo.
long? x;
// The y position. The value ranges from 0 to |max_y| as defined in
// StylusConnectedEventInfo.
long? y;
// The pressure applied to the touch contact. The value ranges from 0 to
// |max_pressure| as defined in StylusConnectedEventInfo.
long? pressure;
};
dictionary StylusTouchEventInfo {
// The info of the stylus touch point. A null touch point means the stylus
// leaves the contact.
StylusTouchPointInfo? touch_point;
};
dictionary StylusConnectedEventInfo {
// The maximum possible x position of touch points.
long? max_x;
// The maximum possible y position of touch points.
long? max_y;
// The maximum possible pressure of touch points, or 0 if pressure is not
// supported.
long? max_pressure;
};
callback VoidCallback = void();
interface Functions {
// Checks whether an event is supported. The information returned by
// this method is valid across reboots of the device.
static void isEventSupported(
EventCategory category, EventSupportStatusInfoCallback callback);
// Starts capturing events for `EventCategory`. After calling this
// method, an extension can expect to be updated about events through
// invocations of `on<EventCategory>Event`, until either the PWA is
// closed or `stopCapturingEvents` is called. Note that an extension
// is only able to subscribe to events if the PWA is currently open.
static void startCapturingEvents(
EventCategory category, VoidCallback callback);
// Stops capturing `EventCategory` events. This means
// `on<EventCategory>Event` won't be invoked until
// `startCapturingEvents` is succesfully called.
static void stopCapturingEvents(
EventCategory category, VoidCallback callback);
};
interface Events {
// Informs the extension that an `AudioJack` event occured.
static void onAudioJackEvent(AudioJackEventInfo event_info);
// Informs the extension that a Keyboard diagnostic has been completed
// in the first party diagnostic tool.
static void onKeyboardDiagnosticEvent(
KeyboardDiagnosticEventInfo event_info);
// Informs the extension that a `Lid` event occured.
static void onLidEvent(LidEventInfo event_info);
// Informs the extension that a `Usb` event occured.
static void onUsbEvent(UsbEventInfo event_info);
// Informs the extension that an `ExternalDisplay` event occured.
static void onExternalDisplayEvent(ExternalDisplayEventInfo event_info);
// Informs the extension that a `SD Card` event occured.
static void onSdCardEvent(SdCardEventInfo event_info);
// Informs the extension that a `Power` event occured.
static void onPowerEvent(PowerEventInfo event_info);
// Informs the extension that a `Stylus Garage` event occured.
static void onStylusGarageEvent(StylusGarageEventInfo event_info);
// Informs the extension that a `Touchpad Button` event occured.
static void onTouchpadButtonEvent(TouchpadButtonEventInfo event_info);
// Informs the extension that a `Touchpad Touch` event occured.
static void onTouchpadTouchEvent(TouchpadTouchEventInfo event_info);
// Informs the extension that a `Touchpad Connected` event occured.
static void onTouchpadConnectedEvent(
TouchpadConnectedEventInfo event_info);
// Informs the extension that a `Touchscreen Touch` event occured.
static void onTouchscreenTouchEvent(
TouchscreenTouchEventInfo event_info);
// Informs the extension that a `Touchscreen Connected` event occured.
static void onTouchscreenConnectedEvent(
TouchscreenConnectedEventInfo event_info);
// Informs the extension that a `Stylus Touch` event occured.
static void onStylusTouchEvent(StylusTouchEventInfo event_info);
// Informs the extension that a `Stylus Connected` event occured.
static void onStylusConnectedEvent(StylusConnectedEventInfo event_info);
};
// LINT.ThenChange(//docs/telemetry_extension/api_overview.md)
// The following is an empty definition, since the IDL compiler only accepts
// comments over valid definitions.
callback EOF = void();
};
|