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