chromium/third_party/blink/public/mojom/keyboard_lock/keyboard_lock.mojom

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

module blink.mojom;

enum KeyboardLockRequestResult {
  kSuccess = 0,
  kFrameDetachedError = 1,
  kNoValidKeyCodesError = 2,
  kChildFrameError = 3,
  kRequestFailedError = 4
};

enum GetKeyboardLayoutMapStatus {
  kSuccess = 0,
  kFail = 1,
  kDenied = 2,
};

struct GetKeyboardLayoutMapResult {
  GetKeyboardLayoutMapStatus status;

  // A map of KeyboardEvent code to KeyboardEvent key values.
  map<string, string> layout_map;
};

// The browser side service to process navigator.keyboard.lock() and
// navigator.keyboard.unlock() web APIs. See http://crbug.com/680809.
interface KeyboardLockService {
  // Registers a set of string-formatted key codes
  // (https://www.w3.org/TR/uievents/#interface-keyboardevent) to the platform
  // dependent native API, so the web page can receive these key codes
  // thereafter.
  RequestKeyboardLock(array<string> key_codes)
    => (KeyboardLockRequestResult result);

  // Removes all reserved keys. This function is expected to never fail.
  CancelKeyboardLock();

  // Requests the keyboard layout mapping for the highest-priority ASCII-capable
  // installed layout.
  GetKeyboardLayoutMap() => (GetKeyboardLayoutMapResult result);
};