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

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

Issue 2584343002: WIP: working copy-no-compositor path
Patch Set: StatTracker destructor, delete old magic numbers, mojo export Created 3 years, 11 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/DocumentUserGestureToken.h" 10 #include "core/dom/DocumentUserGestureToken.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // TODO(dcheng): Why does this need to check both frame and domWindow? 116 // TODO(dcheng): Why does this need to check both frame and domWindow?
117 if (frame() && frame()->domWindow()) { 117 if (frame() && frame()->domWindow()) {
118 UserGestureIndicator gestureIndicator( 118 UserGestureIndicator gestureIndicator(
119 DocumentUserGestureToken::create(frame()->document())); 119 DocumentUserGestureToken::create(frame()->document()));
120 event->setTarget(frame()->domWindow()); 120 event->setTarget(frame()->domWindow());
121 frame()->domWindow()->dispatchEvent(event); 121 frame()->domWindow()->dispatchEvent(event);
122 } 122 }
123 } 123 }
124 124
125 void NavigatorVR::pageVisibilityChanged() { 125 void NavigatorVR::pageVisibilityChanged() {
126 VLOG(1) << __FUNCTION__;
126 if (!page()) 127 if (!page())
127 return; 128 return;
128 if (m_controller) { 129 if (m_controller) {
130 VLOG(1) << __FUNCTION__ << ": isPageVisible=" << page()->isPageVisible() << " m_listeningForActivate=" << m_listeningForActivate;
129 m_controller->setListeningForActivate(page()->isPageVisible() && 131 m_controller->setListeningForActivate(page()->isPageVisible() &&
130 m_listeningForActivate); 132 m_listeningForActivate);
131 } 133 }
132 } 134 }
133 135
134 void NavigatorVR::didAddEventListener(LocalDOMWindow* window, 136 void NavigatorVR::didAddEventListener(LocalDOMWindow* window,
135 const AtomicString& eventType) { 137 const AtomicString& eventType) {
138 VLOG(1) << __FUNCTION__ << ": eventType=" << eventType;
136 if (eventType == EventTypeNames::vrdisplayactivate) { 139 if (eventType == EventTypeNames::vrdisplayactivate) {
137 controller()->setListeningForActivate(true); 140 controller()->setListeningForActivate(true);
138 m_listeningForActivate = true; 141 m_listeningForActivate = true;
139 } else if (eventType == EventTypeNames::vrdisplayconnect) { 142 } else if (eventType == EventTypeNames::vrdisplayconnect) {
140 // If the page is listening for connection events make sure we've created a 143 // If the page is listening for connection events make sure we've created a
141 // controller so that we'll be notified of new devices. 144 // controller so that we'll be notified of new devices.
142 controller(); 145 controller();
143 } 146 }
144 } 147 }
145 148
146 void NavigatorVR::didRemoveEventListener(LocalDOMWindow* window, 149 void NavigatorVR::didRemoveEventListener(LocalDOMWindow* window,
147 const AtomicString& eventType) { 150 const AtomicString& eventType) {
151 VLOG(1) << __FUNCTION__ << ": eventType=" << eventType;
148 if (eventType == EventTypeNames::vrdisplayactivate && 152 if (eventType == EventTypeNames::vrdisplayactivate &&
149 !window->hasEventListeners(EventTypeNames::vrdisplayactivate)) { 153 !window->hasEventListeners(EventTypeNames::vrdisplayactivate)) {
150 controller()->setListeningForActivate(false); 154 controller()->setListeningForActivate(false);
151 m_listeningForActivate = false; 155 m_listeningForActivate = false;
152 } 156 }
153 } 157 }
154 158
155 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) { 159 void NavigatorVR::didRemoveAllEventListeners(LocalDOMWindow* window) {
160 VLOG(1) << __FUNCTION__;
156 if (m_controller) { 161 if (m_controller) {
157 m_controller->setListeningForActivate(false); 162 m_controller->setListeningForActivate(false);
158 m_listeningForActivate = false; 163 m_listeningForActivate = false;
159 } 164 }
160 } 165 }
161 166
162 } // namespace blink 167 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698