OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/vr/NavigatorVR.h" | 5 #include "modules/vr/NavigatorVR.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
| 11 #include "core/dom/ExecutionContext.h" |
11 #include "core/dom/Fullscreen.h" | 12 #include "core/dom/Fullscreen.h" |
12 #include "core/frame/LocalDOMWindow.h" | 13 #include "core/frame/LocalDOMWindow.h" |
13 #include "core/frame/LocalFrame.h" | 14 #include "core/frame/LocalFrame.h" |
14 #include "core/frame/Navigator.h" | 15 #include "core/frame/Navigator.h" |
15 #include "core/frame/UseCounter.h" | 16 #include "core/frame/UseCounter.h" |
16 #include "core/page/Page.h" | 17 #include "core/page/Page.h" |
17 #include "modules/vr/VRController.h" | 18 #include "modules/vr/VRController.h" |
18 #include "modules/vr/VRDisplay.h" | 19 #include "modules/vr/VRDisplay.h" |
19 #include "modules/vr/VRGetDevicesCallback.h" | 20 #include "modules/vr/VRGetDevicesCallback.h" |
20 #include "modules/vr/VRPose.h" | 21 #include "modules/vr/VRPose.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 ScriptPromise NavigatorVR::getVRDisplays(ScriptState* script_state) { | 67 ScriptPromise NavigatorVR::getVRDisplays(ScriptState* script_state) { |
67 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); | 68 ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); |
68 ScriptPromise promise = resolver->Promise(); | 69 ScriptPromise promise = resolver->Promise(); |
69 | 70 |
70 if (!GetDocument()) { | 71 if (!GetDocument()) { |
71 RejectNavigatorDetached(resolver); | 72 RejectNavigatorDetached(resolver); |
72 return promise; | 73 return promise; |
73 } | 74 } |
74 | 75 |
75 UseCounter::Count(*GetDocument(), UseCounter::kVRGetDisplays); | 76 UseCounter::Count(*GetDocument(), UseCounter::kVRGetDisplays); |
76 ExecutionContext* execution_context = script_state->GetExecutionContext(); | 77 ExecutionContext* execution_context = ExecutionContext::From(script_state); |
77 if (!execution_context->IsSecureContext()) | 78 if (!execution_context->IsSecureContext()) |
78 UseCounter::Count(*GetDocument(), UseCounter::kVRGetDisplaysInsecureOrigin); | 79 UseCounter::Count(*GetDocument(), UseCounter::kVRGetDisplaysInsecureOrigin); |
79 | 80 |
80 Platform::Current()->RecordRapporURL("VR.WebVR.GetDisplays", | 81 Platform::Current()->RecordRapporURL("VR.WebVR.GetDisplays", |
81 GetDocument()->Url()); | 82 GetDocument()->Url()); |
82 | 83 |
83 Controller()->GetDisplays(resolver); | 84 Controller()->GetDisplays(resolver); |
84 | 85 |
85 return promise; | 86 return promise; |
86 } | 87 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 181 |
181 void NavigatorVR::DidRemoveAllEventListeners(LocalDOMWindow* window) { | 182 void NavigatorVR::DidRemoveAllEventListeners(LocalDOMWindow* window) { |
182 if (!controller_) | 183 if (!controller_) |
183 return; | 184 return; |
184 | 185 |
185 controller_->SetListeningForActivate(false); | 186 controller_->SetListeningForActivate(false); |
186 listening_for_activate_ = false; | 187 listening_for_activate_ = false; |
187 } | 188 } |
188 | 189 |
189 } // namespace blink | 190 } // namespace blink |
OLD | NEW |