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" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 Document* document = frame() ? frame()->document() : 0; | 50 Document* document = frame() ? frame()->document() : 0; |
51 | 51 |
52 if (!document || !controller()) { | 52 if (!document || !controller()) { |
53 DOMException* exception = DOMException::create( | 53 DOMException* exception = DOMException::create( |
54 InvalidStateError, "The object is no longer associated to a document."); | 54 InvalidStateError, "The object is no longer associated to a document."); |
55 resolver->reject(exception); | 55 resolver->reject(exception); |
56 return promise; | 56 return promise; |
57 } | 57 } |
58 | 58 |
59 UseCounter::count(*document, UseCounter::VRGetDisplays); | 59 UseCounter::count(*document, UseCounter::VRGetDisplays); |
| 60 ExecutionContext* executionContext = scriptState->getExecutionContext(); |
| 61 String errorMessage; |
| 62 if (!executionContext->isSecureContext(errorMessage)) |
| 63 UseCounter::count(*document, UseCounter::VRGetDisplaysInsecureOrigin); |
60 | 64 |
61 controller()->getDisplays(resolver); | 65 controller()->getDisplays(resolver); |
62 | 66 |
63 return promise; | 67 return promise; |
64 } | 68 } |
65 | 69 |
66 VRController* NavigatorVR::controller() { | 70 VRController* NavigatorVR::controller() { |
67 if (!frame()) | 71 if (!frame()) |
68 return 0; | 72 return 0; |
69 | 73 |
(...skipping 30 matching lines...) Expand all Loading... |
100 } | 104 } |
101 } | 105 } |
102 | 106 |
103 void NavigatorVR::fireVREvent(VRDisplayEvent* event) { | 107 void NavigatorVR::fireVREvent(VRDisplayEvent* event) { |
104 if (frame() && frame()->localDOMWindow()) { | 108 if (frame() && frame()->localDOMWindow()) { |
105 frame()->localDOMWindow()->enqueueWindowEvent(event); | 109 frame()->localDOMWindow()->enqueueWindowEvent(event); |
106 } | 110 } |
107 } | 111 } |
108 | 112 |
109 } // namespace blink | 113 } // namespace blink |
OLD | NEW |