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

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

Issue 2815313002: Reland of Move ScriptState::GetExecutionContext (Part 5) (Closed)
Patch Set: Created 3 years, 8 months 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/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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/speech/SpeechGrammarList.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