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

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

Issue 2746233002: Fixes 2D-to-WebVR site transitions when browsing in VR. (Closed)
Patch Set: Fixed export Created 3 years, 9 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
« no previous file with comments | « device/vr/vr_device.h ('k') | device/vr/vr_device_manager.h » ('j') | 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_display_impl.h" 7 #include "device/vr/vr_display_impl.h"
8 8
9 namespace device { 9 namespace device {
10 10
(...skipping 22 matching lines...) Expand all
33 return (!presenting_display_ || presenting_display_ == display); 33 return (!presenting_display_ || presenting_display_ == display);
34 } 34 }
35 35
36 bool VRDevice::CheckPresentingDisplay(VRDisplayImpl* display) { 36 bool VRDevice::CheckPresentingDisplay(VRDisplayImpl* display) {
37 return (presenting_display_ && presenting_display_ == display); 37 return (presenting_display_ && presenting_display_ == display);
38 } 38 }
39 39
40 void VRDevice::OnChanged() { 40 void VRDevice::OnChanged() {
41 base::Callback<void(mojom::VRDisplayInfoPtr)> callback = base::Bind( 41 base::Callback<void(mojom::VRDisplayInfoPtr)> callback = base::Bind(
42 &VRDevice::OnVRDisplayInfoCreated, weak_ptr_factory_.GetWeakPtr()); 42 &VRDevice::OnVRDisplayInfoCreated, weak_ptr_factory_.GetWeakPtr());
43 GetVRDevice(callback); 43 CreateVRDisplayInfo(callback);
44 } 44 }
45 45
46 void VRDevice::OnVRDisplayInfoCreated(mojom::VRDisplayInfoPtr vr_device_info) { 46 void VRDevice::OnVRDisplayInfoCreated(mojom::VRDisplayInfoPtr vr_device_info) {
47 if (vr_device_info.is_null()) 47 if (vr_device_info.is_null())
48 return; 48 return;
49 for (auto* display : displays_) 49 for (auto* display : displays_)
50 display->client()->OnChanged(vr_device_info.Clone()); 50 display->OnChanged(vr_device_info.Clone());
51 } 51 }
52 52
53 void VRDevice::OnExitPresent() { 53 void VRDevice::OnExitPresent() {
54 if (!presenting_display_) 54 if (!presenting_display_)
55 return; 55 return;
56 auto it = displays_.find(presenting_display_); 56 auto it = displays_.find(presenting_display_);
57 CHECK(it != displays_.end()); 57 CHECK(it != displays_.end());
58 (*it)->client()->OnExitPresent(); 58 (*it)->OnExitPresent();
59 SetPresentingDisplay(nullptr); 59 SetPresentingDisplay(nullptr);
60 } 60 }
61 61
62 void VRDevice::OnBlur() { 62 void VRDevice::OnBlur() {
63 for (auto* display : displays_) 63 for (auto* display : displays_)
64 display->client()->OnBlur(); 64 display->OnBlur();
65 } 65 }
66 66
67 void VRDevice::OnFocus() { 67 void VRDevice::OnFocus() {
68 for (auto* display : displays_) 68 for (auto* display : displays_)
69 display->client()->OnFocus(); 69 display->OnFocus();
70 } 70 }
71 71
72 void VRDevice::OnActivate(mojom::VRDisplayEventReason reason) { 72 void VRDevice::OnActivate(mojom::VRDisplayEventReason reason) {
73 for (auto* display : displays_) 73 for (auto* display : displays_)
74 display->client()->OnActivate(reason); 74 display->OnActivate(reason);
75 } 75 }
76 76
77 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) { 77 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) {
78 for (auto* display : displays_) 78 for (auto* display : displays_)
79 display->client()->OnDeactivate(reason); 79 display->OnDeactivate(reason);
80 } 80 }
81 81
82 void VRDevice::SetPresentingDisplay(VRDisplayImpl* display) { 82 void VRDevice::SetPresentingDisplay(VRDisplayImpl* display) {
83 presenting_display_ = display; 83 presenting_display_ = display;
84 } 84 }
85 85
86 } // namespace device 86 } // namespace device
OLDNEW
« no previous file with comments | « device/vr/vr_device.h ('k') | device/vr/vr_device_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698