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 ScriptPromise promise = resolver->promise(); | 50 ScriptPromise promise = resolver->promise(); |
51 | 51 |
52 Document* document = m_frame ? m_frame->document() : 0; | 52 Document* document = m_frame ? m_frame->document() : 0; |
53 | 53 |
54 if (!document || !controller()) { | 54 if (!document || !controller()) { |
55 DOMException* exception = DOMException::create(InvalidStateError, "The o bject is no longer associated to a document."); | 55 DOMException* exception = DOMException::create(InvalidStateError, "The o bject is no longer associated to a document."); |
56 resolver->reject(exception); | 56 resolver->reject(exception); |
57 return promise; | 57 return promise; |
58 } | 58 } |
59 | 59 |
60 ExecutionContext* executionContext = scriptState->getExecutionContext(); | |
61 String errorMessage; | |
62 if (executionContext->isSecureContext(errorMessage)) { | |
63 UseCounter::count(*document, UseCounter::VRGetDisplays); | |
64 } else { | |
65 UseCounter::count(*document, UseCounter::VRGetDisplaysInsecureOrigin); | |
66 } | |
67 | |
60 UseCounter::count(*document, UseCounter::VRGetDisplays); | 68 UseCounter::count(*document, UseCounter::VRGetDisplays); |
amp
2016/10/05 20:43:14
Shouldn't this be removed since you are now counti
billorr
2016/10/05 21:01:03
Acknowledged.
ddorwin
2016/10/05 21:32:43
We definitely don't want to call this twice (thoug
billorr
2016/10/05 21:55:27
Acknowledged.
billorr
2016/10/05 22:47:55
Done.
billorr
2016/10/05 22:47:55
Done.
| |
61 | 69 |
62 controller()->getDisplays(resolver); | 70 controller()->getDisplays(resolver); |
63 | 71 |
64 return promise; | 72 return promise; |
65 } | 73 } |
66 | 74 |
67 VRController* NavigatorVR::controller() | 75 VRController* NavigatorVR::controller() |
68 { | 76 { |
69 if (!frame()) | 77 if (!frame()) |
70 return 0; | 78 return 0; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 } | 120 } |
113 | 121 |
114 void NavigatorVR::fireVREvent(VRDisplayEvent* event) | 122 void NavigatorVR::fireVREvent(VRDisplayEvent* event) |
115 { | 123 { |
116 if (m_frame && m_frame->localDOMWindow()) { | 124 if (m_frame && m_frame->localDOMWindow()) { |
117 m_frame->localDOMWindow()->enqueueWindowEvent(event); | 125 m_frame->localDOMWindow()->enqueueWindowEvent(event); |
118 } | 126 } |
119 } | 127 } |
120 | 128 |
121 } // namespace blink | 129 } // namespace blink |
OLD | NEW |