Commit 6016778c authored by zijiehe's avatar zijiehe Committed by Commit bot

[System-Keyboard-Lock] Forward navigator functions to RenderFrameHost

This change forwards navigator.requestKeyLock() and navigator.cancelKeyLock()
functions to the RenderFrameHostImpl.

System-Keyboard-Lock is a feature to detect the key presses which usually cannot
be received by the browser, and send them to the web page. It contains various
components to achieve the goal. This change is one of them, which receives
JavaScript (or Web Platform API in the design doc) function calls and forwards
them into RenderFrameHost. For detail, please refer to the design doc at,
https://docs.google.com/document/d/1T9gJHYdA1VGZ6QHQeOu0hOacWWWJ7yNEt1VDbLju4bs/edit#heading=h.cgwemqs2j4ta

W3C Working Draft: https://garykac.github.io/system-keyboard-lock/
Intent to implement: https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/9pauQUAvrcw/lfbG7eunCAAJ

BUG=680809
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2805763004
Cr-Commit-Position: refs/heads/master@{#468158}
parent 56fc9d63
...@@ -820,6 +820,8 @@ source_set("browser") { ...@@ -820,6 +820,8 @@ source_set("browser") {
"indexed_db/list_set.h", "indexed_db/list_set.h",
"installedapp/installed_app_provider_impl_default.cc", "installedapp/installed_app_provider_impl_default.cc",
"installedapp/installed_app_provider_impl_default.h", "installedapp/installed_app_provider_impl_default.h",
"keyboard_lock/keyboard_lock_service_impl.cc",
"keyboard_lock/keyboard_lock_service_impl.h",
"leveldb_wrapper_impl.cc", "leveldb_wrapper_impl.cc",
"leveldb_wrapper_impl.h", "leveldb_wrapper_impl.h",
"loader/async_resource_handler.cc", "loader/async_resource_handler.cc",
......
...@@ -87,6 +87,7 @@ include_rules = [ ...@@ -87,6 +87,7 @@ include_rules = [
"+third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h", "+third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h",
"+third_party/WebKit/public/platform/modules/installedapp/installed_app_provider.mojom.h", "+third_party/WebKit/public/platform/modules/installedapp/installed_app_provider.mojom.h",
"+third_party/WebKit/public/platform/modules/installedapp/related_application.mojom.h", "+third_party/WebKit/public/platform/modules/installedapp/related_application.mojom.h",
"+third_party/WebKit/public/platform/modules/keyboard_lock/keyboard_lock.mojom.h",
"+third_party/WebKit/public/platform/modules/mediasession/media_session.mojom.h", "+third_party/WebKit/public/platform/modules/mediasession/media_session.mojom.h",
"+third_party/WebKit/public/platform/modules/notifications/WebNotificationConstants.h", "+third_party/WebKit/public/platform/modules/notifications/WebNotificationConstants.h",
"+third_party/WebKit/public/platform/modules/notifications/notification.mojom.h", "+third_party/WebKit/public/platform/modules/notifications/notification.mojom.h",
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "content/browser/frame_host/render_frame_proxy_host.h" #include "content/browser/frame_host/render_frame_proxy_host.h"
#include "content/browser/frame_host/render_widget_host_view_child_frame.h" #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
#include "content/browser/installedapp/installed_app_provider_impl_default.h" #include "content/browser/installedapp/installed_app_provider_impl_default.h"
#include "content/browser/keyboard_lock/keyboard_lock_service_impl.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/loader/resource_dispatcher_host_impl.h"
#include "content/browser/media/media_interface_proxy.h" #include "content/browser/media/media_interface_proxy.h"
#include "content/browser/media/session/media_session_service_impl.h" #include "content/browser/media/session/media_session_service_impl.h"
...@@ -2714,6 +2715,9 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() { ...@@ -2714,6 +2715,9 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() {
&RemoterFactoryImpl::Bind, GetProcess()->GetID(), GetRoutingID())); &RemoterFactoryImpl::Bind, GetProcess()->GetID(), GetRoutingID()));
#endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING)
GetInterfaceRegistry()->AddInterface(base::Bind(
&KeyboardLockServiceImpl::CreateMojoService));
GetContentClient()->browser()->ExposeInterfacesToFrame(GetInterfaceRegistry(), GetContentClient()->browser()->ExposeInterfacesToFrame(GetInterfaceRegistry(),
this); this);
} }
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/keyboard_lock/keyboard_lock_service_impl.h"
#include <memory>
#include <utility>
#include "base/memory/ptr_util.h"
#include "content/public/browser/render_frame_host.h"
namespace content {
KeyboardLockServiceImpl::KeyboardLockServiceImpl() = default;
KeyboardLockServiceImpl::~KeyboardLockServiceImpl() = default;
// static
void KeyboardLockServiceImpl::CreateMojoService(
blink::mojom::KeyboardLockServiceRequest request) {
mojo::MakeStrongBinding(
base::MakeUnique<KeyboardLockServiceImpl>(),
std::move(request));
}
void KeyboardLockServiceImpl::RequestKeyLock(
const std::vector<std::string>& key_codes,
const RequestKeyLockCallback& callback) {
// TODO(zijiehe): Implementation required.
callback.Run(true, std::string());
}
void KeyboardLockServiceImpl::CancelKeyLock() {
// TODO(zijiehe): Implementation required.
}
} // namespace content
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include <vector>
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "third_party/WebKit/public/platform/modules/keyboard_lock/keyboard_lock.mojom.h"
namespace content {
class CONTENT_EXPORT KeyboardLockServiceImpl
: public NON_EXPORTED_BASE(blink::mojom::KeyboardLockService) {
public:
KeyboardLockServiceImpl();
~KeyboardLockServiceImpl() override;
static void CreateMojoService(
blink::mojom::KeyboardLockServiceRequest request);
// blink::mojom::KeyboardLockService implementations.
void RequestKeyLock(const std::vector<std::string>& key_codes,
const RequestKeyLockCallback& callback) override;
void CancelKeyLock() override;
};
} // namespace
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
// impossible this week. Remove once sky/ken fix this. // impossible this week. Remove once sky/ken fix this.
"autofill::mojom::AutofillDriver", "autofill::mojom::AutofillDriver",
"autofill::mojom::PasswordManagerDriver", "autofill::mojom::PasswordManagerDriver",
"blink::mojom::KeyboardLockService",
"blink::mojom::MediaSessionService", "blink::mojom::MediaSessionService",
"blink::mojom::PermissionService", "blink::mojom::PermissionService",
"blink::mojom::PresentationService", "blink::mojom::PresentationService",
......
...@@ -734,3 +734,8 @@ external/wpt/uievents/order-of-events/mouse-events/click-order-manual.html [ Ski ...@@ -734,3 +734,8 @@ external/wpt/uievents/order-of-events/mouse-events/click-order-manual.html [ Ski
external/wpt/uievents/order-of-events/mouse-events/mouseevents-mousemove-manual.htm [ Skip ] external/wpt/uievents/order-of-events/mouse-events/mouseevents-mousemove-manual.htm [ Skip ]
external/wpt/uievents/order-of-events/mouse-events/mousemove-across-manual.html [ Skip ] external/wpt/uievents/order-of-events/mouse-events/mousemove-across-manual.html [ Skip ]
external/wpt/uievents/order-of-events/mouse-events/mousemove-between-manual.html [ Skip ] external/wpt/uievents/order-of-events/mouse-events/mousemove-between-manual.html [ Skip ]
external/wpt/keyboard-lock/idlharness.https.html [ Skip ]
external/wpt/keyboard-lock/navigator-cancelKeyLock.https.html [ Skip ]
external/wpt/keyboard-lock/navigator-requestKeyLock.https.html [ Skip ]
external/wpt/keyboard-lock/navigator-requestKeyLock-two-parallel-requests.https.html [ Skip ]
external/wpt/keyboard-lock/navigator-requestKeyLock-two-sequential-requests.https.html [ Skip ]
This is a testharness.js-based test.
FAIL Navigator interface: operation requestKeyLock(sequence) assert_throws: calling operation with this = null didn't throw TypeError function "function () {
fn.apply(obj, args);
}" did not throw
PASS Navigator interface: operation cancelKeyLock()
PASS Navigator must be primary interface of navigator
PASS Stringification of navigator
PASS Navigator interface: navigator must inherit property "requestKeyLock" with the proper type (0)
PASS Navigator interface: calling requestKeyLock(sequence) on navigator with too few arguments must throw TypeError
PASS Navigator interface: navigator must inherit property "cancelKeyLock" with the proper type (1)
Harness: the test ran to completion.
<!doctype html>
<html>
<head>
<title>Keyboard Lock IDL tests</title>
<link rel="help" href="https://github.com/w3c/keyboard-lock"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
</head>
<body>
<pre id="untested_idl" style="display: none">
interface Navigator {
};
</pre>
<!--
The reason of the failure of requestKeyLock test looks like a code defect in
idlharness.js. media-capabilities/idlharness.html is also impacted by this
issue. See https://codereview.chromium.org/2805763004/#ps620001, which
includes a potential fix.
TODO(zijiehe): Submit the fix.
-->
<pre id="idl" style="display: none">
partial interface Navigator {
[SecureContext] Promise<void> requestKeyLock(optional sequence<DOMString> keyCodes = []);
[SecureContext] void cancelKeyLock();
};
</pre>
<script>
var idl_array = new IdlArray();
idl_array.add_untested_idls(
document.getElementById("untested_idl").textContent);
idl_array.add_idls(document.getElementById("idl").textContent);
idl_array.add_objects({
Navigator: ["navigator"]
});
idl_array.test();
</script>
<div id="log"></div>
</body>
</html>
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
test(() => {
assert_equals(navigator.cancelKeyLock(),
undefined);
}, 'Keyboard Lock cancelKeyLock');
</script>
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
promise_test((t) => {
const p1 = navigator.requestKeyLock(['a', 'b']);
const p2 = navigator.requestKeyLock(['c', 'd']);
return promise_rejects(t, null, p2,
'requestKeyLock() should only be ' +
'executed if another request has finished.');
}, 'Keyboard Lock requestKeyLock twice in parallel');
</script>
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
promise_test(() => {
return navigator.requestKeyLock(['a', 'b'])
.then(() => {
return navigator.requestKeyLock(['c', 'd']);
});
}, 'Keyboard Lock requestKeyLock twice sequentially');
</script>
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
promise_test(() => {
const p = navigator.requestKeyLock(['a', 'b']);
assert_true(p instanceof Promise);
return p;
}, 'Keyboard Lock requestKeyLock');
</script>
...@@ -4361,6 +4361,7 @@ interface Navigator ...@@ -4361,6 +4361,7 @@ interface Navigator
getter vendorSub getter vendorSub
getter webkitPersistentStorage getter webkitPersistentStorage
getter webkitTemporaryStorage getter webkitTemporaryStorage
method cancelKeyLock
method constructor method constructor
method getBattery method getBattery
method getGamepads method getGamepads
...@@ -4370,6 +4371,7 @@ interface Navigator ...@@ -4370,6 +4371,7 @@ interface Navigator
method isProtocolHandlerRegistered method isProtocolHandlerRegistered
method javaEnabled method javaEnabled
method registerProtocolHandler method registerProtocolHandler
method requestKeyLock
method requestMIDIAccess method requestMIDIAccess
method requestMediaKeySystemAccess method requestMediaKeySystemAccess
method sendBeacon method sendBeacon
......
...@@ -4368,6 +4368,7 @@ interface Navigator ...@@ -4368,6 +4368,7 @@ interface Navigator
getter vendorSub getter vendorSub
getter webkitPersistentStorage getter webkitPersistentStorage
getter webkitTemporaryStorage getter webkitTemporaryStorage
method cancelKeyLock
method constructor method constructor
method getBattery method getBattery
method getGamepads method getGamepads
...@@ -4377,6 +4378,7 @@ interface Navigator ...@@ -4377,6 +4378,7 @@ interface Navigator
method isProtocolHandlerRegistered method isProtocolHandlerRegistered
method javaEnabled method javaEnabled
method registerProtocolHandler method registerProtocolHandler
method requestKeyLock
method requestMIDIAccess method requestMIDIAccess
method requestMediaKeySystemAccess method requestMediaKeySystemAccess
method sendBeacon method sendBeacon
......
...@@ -126,6 +126,7 @@ target(modules_target_type, "modules") { ...@@ -126,6 +126,7 @@ target(modules_target_type, "modules") {
"//third_party/WebKit/Source/modules/indexeddb", "//third_party/WebKit/Source/modules/indexeddb",
"//third_party/WebKit/Source/modules/installation", "//third_party/WebKit/Source/modules/installation",
"//third_party/WebKit/Source/modules/installedapp", "//third_party/WebKit/Source/modules/installedapp",
"//third_party/WebKit/Source/modules/keyboard_lock",
"//third_party/WebKit/Source/modules/media_capabilities", "//third_party/WebKit/Source/modules/media_capabilities",
"//third_party/WebKit/Source/modules/media_controls", "//third_party/WebKit/Source/modules/media_controls",
"//third_party/WebKit/Source/modules/mediacapturefromelement", "//third_party/WebKit/Source/modules/mediacapturefromelement",
......
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//third_party/WebKit/Source/modules/modules.gni")
blink_modules_sources("keyboard_lock") {
sources = [
"NavigatorKeyboardLock.cpp",
"NavigatorKeyboardLock.h",
]
}
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "modules/keyboard_lock/NavigatorKeyboardLock.h"
#include "bindings/core/v8/ScriptPromise.h"
#include "bindings/core/v8/ScriptPromiseResolver.h"
#include "bindings/core/v8/V8Binding.h"
#include "core/frame/LocalFrame.h"
#include "platform/heap/Persistent.h"
#include "platform/wtf/Assertions.h"
#include "platform/wtf/Functional.h"
#include "public/platform/InterfaceProvider.h"
namespace blink {
NavigatorKeyboardLock::NavigatorKeyboardLock(Navigator& navigator)
: Supplement<Navigator>(navigator) {}
NavigatorKeyboardLock& NavigatorKeyboardLock::From(Navigator& navigator) {
NavigatorKeyboardLock* supplement = static_cast<NavigatorKeyboardLock*>(
Supplement<Navigator>::From(navigator, SupplementName()));
if (!supplement) {
supplement = new NavigatorKeyboardLock(navigator);
ProvideTo(navigator, SupplementName(), supplement);
}
return *supplement;
}
// static
ScriptPromise NavigatorKeyboardLock::requestKeyLock(
ScriptState* state,
Navigator& navigator,
const Vector<String>& keycodes) {
return NavigatorKeyboardLock::From(navigator).requestKeyLock(state, keycodes);
}
ScriptPromise NavigatorKeyboardLock::requestKeyLock(
ScriptState* state,
const Vector<String>& keycodes) {
DCHECK(state);
if (request_keylock_resolver_) {
// TODO(zijiehe): Reject with a DOMException once it has been defined in the
// spec. See https://github.com/w3c/keyboard-lock/issues/18.
return ScriptPromise::Reject(
state, V8String(state->GetIsolate(),
"Last requestKeyLock() has not finished yet."));
}
if (!EnsureServiceConnected()) {
return ScriptPromise::Reject(
state, V8String(state->GetIsolate(), "Current frame is detached."));
}
request_keylock_resolver_ = ScriptPromiseResolver::Create(state);
service_->RequestKeyLock(
keycodes,
ConvertToBaseCallback(WTF::Bind(
&NavigatorKeyboardLock::LockRequestFinished, WrapPersistent(this))));
return request_keylock_resolver_->Promise();
}
void NavigatorKeyboardLock::cancelKeyLock() {
if (!EnsureServiceConnected()) {
// Current frame is detached.
return;
}
service_->CancelKeyLock();
}
// static
void NavigatorKeyboardLock::cancelKeyLock(Navigator& navigator) {
NavigatorKeyboardLock::From(navigator).cancelKeyLock();
}
bool NavigatorKeyboardLock::EnsureServiceConnected() {
if (!service_) {
LocalFrame* frame = GetSupplementable()->GetFrame();
if (!frame) {
return false;
}
frame->GetInterfaceProvider()->GetInterface(mojo::MakeRequest(&service_));
}
DCHECK(service_);
return true;
}
void NavigatorKeyboardLock::LockRequestFinished(bool allowed,
const String& reason) {
DCHECK(request_keylock_resolver_);
// TODO(zijiehe): Reject with a DOMException once it has been defined in the
// spec.
if (allowed)
request_keylock_resolver_->Resolve();
else
request_keylock_resolver_->Reject(reason);
request_keylock_resolver_ = nullptr;
}
// static
const char* NavigatorKeyboardLock::SupplementName() {
return "NavigatorKeyboardLock";
}
DEFINE_TRACE(NavigatorKeyboardLock) {
visitor->Trace(request_keylock_resolver_);
Supplement<Navigator>::Trace(visitor);
}
} // namespace blink
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NavigatorKeyboardLock_h
#define NavigatorKeyboardLock_h
#include "bindings/core/v8/ScriptPromise.h"
#include "core/frame/Navigator.h"
#include "platform/Supplementable.h"
#include "platform/heap/Handle.h"
#include "platform/heap/Member.h"
#include "platform/wtf/Forward.h"
#include "public/platform/modules/keyboard_lock/keyboard_lock.mojom-blink.h"
namespace blink {
class ScriptPromiseResolver;
// The supplement of Navigator to process navigator.requestKeyLock() and
// navigator.cancelKeyLock() web APIs. This class forwards both requests
// directly to the browser process through mojo.
class NavigatorKeyboardLock final
: public GarbageCollectedFinalized<NavigatorKeyboardLock>,
public Supplement<Navigator> {
USING_GARBAGE_COLLECTED_MIXIN(NavigatorKeyboardLock);
public:
// Requests to receive a set of key codes
// (https://w3c.github.io/uievents/#dom-keyboardevent-code) in string format.
// The Promise will be rejected if the user or browser do not allow the web
// page to use this API. Otherwise, web page should expect to receive the key
// presses once the Promise has been resolved. This API does best effort to
// deliver the key codes: due to the platform restrictions, some keys or key
// combinations may not be able to receive or intercept by the user agent.
// - Making two requests concurrently without waiting for one Promise to
// finish is disallowed, the second Promise will be rejected immediately.
// - Making a second request after the Promise of the first one has finished
// is allowed; the second request will overwrite the key codes reserved.
// - Passing in an empty keyCodes array will reserve all keys.
static ScriptPromise requestKeyLock(ScriptState*,
Navigator&,
const Vector<String>&);
// Removes all reserved keys. This function is also asynchronized, the web
// page may still receive reserved keys after this function has finished. Once
// the web page is closed, the user agent implicitly executes this API.
static void cancelKeyLock(Navigator&);
DECLARE_TRACE();
private:
explicit NavigatorKeyboardLock(Navigator&);
static const char* SupplementName();
static NavigatorKeyboardLock& From(Navigator&);
ScriptPromise requestKeyLock(ScriptState*, const Vector<String>&);
void cancelKeyLock();
// Ensures the |service_| is correctly initialized. In case of the |service_|
// cannot be initialized, this function returns false.
bool EnsureServiceConnected();
void LockRequestFinished(bool, const String&);
mojom::blink::KeyboardLockServicePtr service_;
Member<ScriptPromiseResolver> request_keylock_resolver_;
};
} // namespace blink
#endif // NavigatorKeyboardLock_h
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://rawgit.com/w3c/keyboard-lock/gh-pages/index.html.
// TODO(zijiehe, garykac): Update the spec to match the implementation.
// 1. "System" should be removed from both the function names: these functions
// are not for system keys or key combinations only.
// See https://github.com/w3c/keyboard-lock/issues/6
// 2. Returns Promise<void> from requestKeyLock() function: user agents can
// decline the request, and web page can get a notification once the
// requested keys should be received.
// See https://github.com/w3c/keyboard-lock/issues/7
// 3. The parameter of requestKeyLock() should be
// optional sequence<DOMString> keyCodes = []
// See https://github.com/w3c/keyboard-lock/issues/21
// 4. cancelKeyLock() function is implicitly called whenever the unloading
// document cleanup steps run with a document.
// See https://github.com/w3c/keyboard-lock/issues/22
partial interface Navigator {
[SecureContext, RuntimeEnabled=KeyboardLock, CallWith=ScriptState] Promise<void> requestKeyLock(optional sequence<DOMString> keyCodes = []);
[SecureContext, RuntimeEnabled=KeyboardLock] void cancelKeyLock();
};
...@@ -614,6 +614,7 @@ modules_dependency_idl_files = ...@@ -614,6 +614,7 @@ modules_dependency_idl_files =
"indexeddb/WindowIndexedDatabase.idl", "indexeddb/WindowIndexedDatabase.idl",
"indexeddb/WorkerGlobalScopeIndexedDatabase.idl", "indexeddb/WorkerGlobalScopeIndexedDatabase.idl",
"installedapp/NavigatorInstalledApp.idl", "installedapp/NavigatorInstalledApp.idl",
"keyboard_lock/NavigatorKeyboardLock.idl",
"media_capabilities/NavigatorMediaCapabilities.idl", "media_capabilities/NavigatorMediaCapabilities.idl",
"mediacapturefromelement/HTMLCanvasElementCapture.idl", "mediacapturefromelement/HTMLCanvasElementCapture.idl",
"mediacapturefromelement/HTMLMediaElementCapture.idl", "mediacapturefromelement/HTMLMediaElementCapture.idl",
......
...@@ -535,6 +535,10 @@ ...@@ -535,6 +535,10 @@
name: "IntersectionObserver", name: "IntersectionObserver",
status: "stable", status: "stable",
}, },
{
name: "KeyboardLock",
status: "test",
},
{ {
name: "LangAttributeAwareFormControlUI", name: "LangAttributeAwareFormControlUI",
}, },
......
...@@ -699,6 +699,7 @@ mojom("mojo_bindings") { ...@@ -699,6 +699,7 @@ mojom("mojo_bindings") {
"platform/modules/budget_service/budget_service.mojom", "platform/modules/budget_service/budget_service.mojom",
"platform/modules/fetch/fetch_api_request.mojom", "platform/modules/fetch/fetch_api_request.mojom",
"platform/modules/hyphenation/hyphenation.mojom", "platform/modules/hyphenation/hyphenation.mojom",
"platform/modules/keyboard_lock/keyboard_lock.mojom",
"platform/modules/mediasession/media_session.mojom", "platform/modules/mediasession/media_session.mojom",
"platform/modules/notifications/notification.mojom", "platform/modules/notifications/notification.mojom",
"platform/modules/notifications/notification_service.mojom", "platform/modules/notifications/notification_service.mojom",
......
# COMPONENT: Services>Chromoting
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module blink.mojom;
// The browser side service to process navigator.requestKeyLock() and
// navigator.cancelKeyLock() 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.
// The reason will only be provided if the request is rejected.
// TODO(zijiehe): Update the return type once it's defined in the spec.
RequestKeyLock(array<string> key_codes)
=> (bool allowed_by_user_or_browser, string reason);
// Removes all reserved keys. This function is expected to never fail.
CancelKeyLock();
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment