Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/WebKit/Source/modules/keyboard_lock/NavigatorKeyboardLock.cpp

Issue 2940933003: DO NOT SUBMIT results of new clang-format (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/keyboard_lock/NavigatorKeyboardLock.h" 5 #include "modules/keyboard_lock/NavigatorKeyboardLock.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "platform/bindings/V8Binding.h" 10 #include "platform/bindings/V8Binding.h"
(...skipping 15 matching lines...) Expand all
26 ProvideTo(navigator, SupplementName(), supplement); 26 ProvideTo(navigator, SupplementName(), supplement);
27 } 27 }
28 return *supplement; 28 return *supplement;
29 } 29 }
30 30
31 // static 31 // static
32 ScriptPromise NavigatorKeyboardLock::requestKeyboardLock( 32 ScriptPromise NavigatorKeyboardLock::requestKeyboardLock(
33 ScriptState* state, 33 ScriptState* state,
34 Navigator& navigator, 34 Navigator& navigator,
35 const Vector<String>& keycodes) { 35 const Vector<String>& keycodes) {
36 return NavigatorKeyboardLock::From(navigator).requestKeyboardLock( 36 return NavigatorKeyboardLock::From(navigator).requestKeyboardLock(state,
37 state, keycodes); 37 keycodes);
38 } 38 }
39 39
40 ScriptPromise NavigatorKeyboardLock::requestKeyboardLock( 40 ScriptPromise NavigatorKeyboardLock::requestKeyboardLock(
41 ScriptState* state, 41 ScriptState* state,
42 const Vector<String>& keycodes) { 42 const Vector<String>& keycodes) {
43 DCHECK(state); 43 DCHECK(state);
44 if (request_keylock_resolver_) { 44 if (request_keylock_resolver_) {
45 // TODO(zijiehe): Reject with a DOMException once it has been defined in the 45 // TODO(zijiehe): Reject with a DOMException once it has been defined in the
46 // spec. See https://github.com/w3c/keyboard-lock/issues/18. 46 // spec. See https://github.com/w3c/keyboard-lock/issues/18.
47 return ScriptPromise::Reject( 47 return ScriptPromise::Reject(
48 state, V8String(state->GetIsolate(), 48 state, V8String(state->GetIsolate(),
49 "Last requestKeyboardLock() has not finished yet.")); 49 "Last requestKeyboardLock() has not finished yet."));
50 } 50 }
51 51
52 if (!EnsureServiceConnected()) { 52 if (!EnsureServiceConnected()) {
53 return ScriptPromise::Reject( 53 return ScriptPromise::Reject(
54 state, V8String(state->GetIsolate(), "Current frame is detached.")); 54 state, V8String(state->GetIsolate(), "Current frame is detached."));
55 } 55 }
56 56
57 request_keylock_resolver_ = ScriptPromiseResolver::Create(state); 57 request_keylock_resolver_ = ScriptPromiseResolver::Create(state);
58 service_->RequestKeyboardLock( 58 service_->RequestKeyboardLock(
59 keycodes, 59 keycodes,
60 ConvertToBaseCallback(WTF::Bind( 60 ConvertToBaseCallback(WTF::Bind(
61 &NavigatorKeyboardLock::LockRequestFinished, WrapPersistent(this)))); 61 &NavigatorKeyboardLock::LockRequestFinished, WrapPersistent(this))));
62 return request_keylock_resolver_->Promise(); 62 return request_keylock_resolver_->Promise();
63 } 63 }
64 64
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 const char* NavigatorKeyboardLock::SupplementName() { 105 const char* NavigatorKeyboardLock::SupplementName() {
106 return "NavigatorKeyboardLock"; 106 return "NavigatorKeyboardLock";
107 } 107 }
108 108
109 DEFINE_TRACE(NavigatorKeyboardLock) { 109 DEFINE_TRACE(NavigatorKeyboardLock) {
110 visitor->Trace(request_keylock_resolver_); 110 visitor->Trace(request_keylock_resolver_);
111 Supplement<Navigator>::Trace(visitor); 111 Supplement<Navigator>::Trace(visitor);
112 } 112 }
113 113
114 } // namespace blink 114 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698