blob: 758cfde37dab7f50a5314e0782e1198f9a6e2d22 (
plain)
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
|
// Copyright 2018 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 "third_party/blink/renderer/modules/keyboard/keyboard.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/modules/keyboard/keyboard_layout.h"
#include "third_party/blink/renderer/modules/keyboard/keyboard_lock.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
namespace blink {
Keyboard::Keyboard(ExecutionContext* context)
: keyboard_lock_(MakeGarbageCollected<KeyboardLock>(context)),
keyboard_layout_(MakeGarbageCollected<KeyboardLayout>(context)) {}
Keyboard::~Keyboard() = default;
ScriptPromise Keyboard::lock(ScriptState* state,
const Vector<String>& keycodes) {
return keyboard_lock_->lock(state, keycodes);
}
void Keyboard::unlock(ScriptState* state) {
keyboard_lock_->unlock(state);
}
ScriptPromise Keyboard::getLayoutMap(ScriptState* state) {
return keyboard_layout_->GetKeyboardLayoutMap(state);
}
void Keyboard::Trace(blink::Visitor* visitor) {
visitor->Trace(keyboard_lock_);
visitor->Trace(keyboard_layout_);
ScriptWrappable::Trace(visitor);
}
} // namespace blink
|