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

Side by Side Diff: third_party/WebKit/Source/modules/vr/NavigatorVR.cpp

Issue 2567173002: Clean up Document::isSecureContext (Closed)
Patch Set: Created 4 years 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 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/DocumentUserGestureToken.h" 10 #include "core/dom/DocumentUserGestureToken.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 if (!document || !controller()) { 55 if (!document || !controller()) {
56 DOMException* exception = DOMException::create( 56 DOMException* exception = DOMException::create(
57 InvalidStateError, "The object is no longer associated to a document."); 57 InvalidStateError, "The object is no longer associated to a document.");
58 resolver->reject(exception); 58 resolver->reject(exception);
59 return promise; 59 return promise;
60 } 60 }
61 61
62 UseCounter::count(*document, UseCounter::VRGetDisplays); 62 UseCounter::count(*document, UseCounter::VRGetDisplays);
63 ExecutionContext* executionContext = scriptState->getExecutionContext(); 63 ExecutionContext* executionContext = scriptState->getExecutionContext();
64 String errorMessage; 64 if (!executionContext->isSecureContext())
65 if (!executionContext->isSecureContext(errorMessage))
66 UseCounter::count(*document, UseCounter::VRGetDisplaysInsecureOrigin); 65 UseCounter::count(*document, UseCounter::VRGetDisplaysInsecureOrigin);
67 66
68 Platform::current()->recordRapporURL("VR.WebVR.GetDisplays", document->url()); 67 Platform::current()->recordRapporURL("VR.WebVR.GetDisplays", document->url());
69 68
70 controller()->getDisplays(resolver); 69 controller()->getDisplays(resolver);
71 70
72 return promise; 71 return promise;
73 } 72 }
74 73
75 VRController* NavigatorVR::controller() { 74 VRController* NavigatorVR::controller() {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 153 }
155 154
156 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) { 155 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) {
157 if (m_controller) { 156 if (m_controller) {
158 m_controller->setListeningForActivate(false); 157 m_controller->setListeningForActivate(false);
159 m_listeningForActivate = false; 158 m_listeningForActivate = false;
160 } 159 }
161 } 160 }
162 161
163 } // namespace blink 162 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/notifications/Notification.cpp ('k') | third_party/WebKit/Source/modules/vr/VRDisplay.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698