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

Side by Side Diff: device/vr/vr_device.cc

Issue 2548893002: Prevent new events from being sent to WebVR pages that are being closed. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "device/vr/vr_device.h" 5 #include "device/vr/vr_device.h"
6 #include "device/vr/vr_device_provider.h" 6 #include "device/vr/vr_device_provider.h"
7 #include "device/vr/vr_service_impl.h" 7 #include "device/vr/vr_service_impl.h"
8 8
9 namespace device { 9 namespace device {
10 10
(...skipping 13 matching lines...) Expand all
24 24
25 void VRDevice::SetSecureOrigin(bool secure_origin) {} 25 void VRDevice::SetSecureOrigin(bool secure_origin) {}
26 26
27 void VRDevice::AddService(VRServiceImpl* service) { 27 void VRDevice::AddService(VRServiceImpl* service) {
28 // Create a VRDisplayImpl for this service/device pair 28 // Create a VRDisplayImpl for this service/device pair
29 VRDisplayImpl* display_impl = service->GetVRDisplayImpl(this); 29 VRDisplayImpl* display_impl = service->GetVRDisplayImpl(this);
30 displays_.insert(std::make_pair(service, display_impl)); 30 displays_.insert(std::make_pair(service, display_impl));
31 } 31 }
32 32
33 void VRDevice::RemoveService(VRServiceImpl* service) { 33 void VRDevice::RemoveService(VRServiceImpl* service) {
34 displays_.erase(service);
34 if (IsPresentingService(service)) 35 if (IsPresentingService(service))
35 ExitPresent(); 36 ExitPresent();
36 displays_.erase(service);
37 } 37 }
38 38
39 bool VRDevice::IsAccessAllowed(VRServiceImpl* service) { 39 bool VRDevice::IsAccessAllowed(VRServiceImpl* service) {
40 return (!presenting_service_ || presenting_service_ == service); 40 return (!presenting_service_ || presenting_service_ == service);
41 } 41 }
42 42
43 bool VRDevice::IsPresentingService(VRServiceImpl* service) { 43 bool VRDevice::IsPresentingService(VRServiceImpl* service) {
44 return (presenting_service_ && presenting_service_ == service); 44 return (presenting_service_ && presenting_service_ == service);
45 } 45 }
46 46
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) { 79 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) {
80 for (const auto& display : displays_) 80 for (const auto& display : displays_)
81 display.second->client()->OnDeactivate(reason); 81 display.second->client()->OnDeactivate(reason);
82 } 82 }
83 83
84 void VRDevice::SetPresentingService(VRServiceImpl* service) { 84 void VRDevice::SetPresentingService(VRServiceImpl* service) {
85 presenting_service_ = service; 85 presenting_service_ = service;
86 } 86 }
87 87
88 } // namespace device 88 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698