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

Unified Diff: device/vr/vr_display_impl.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/vr/vr_display_impl.h ('k') | device/vr/vr_display_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_display_impl.cc
diff --git a/device/vr/vr_display_impl.cc b/device/vr/vr_display_impl.cc
index 9a3bf63e2f679282a359da5e3e7e82bb285b4a92..b462ebc943dbd1d2998edb6f393d83df256aa211 100644
--- a/device/vr/vr_display_impl.cc
+++ b/device/vr/vr_display_impl.cc
@@ -10,29 +10,48 @@
namespace device {
-VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service)
+VRDisplayImpl::VRDisplayImpl(device::VRDevice* device,
+ VRServiceImpl* service,
+ mojom::VRServiceClient* service_client,
+ mojom::VRDisplayInfoPtr display_info)
: binding_(this),
device_(device),
service_(service),
weak_ptr_factory_(this) {
- base::Callback<void(mojom::VRDisplayInfoPtr)> callback = base::Bind(
- &VRDisplayImpl::OnVRDisplayInfoCreated, weak_ptr_factory_.GetWeakPtr());
- device->GetVRDevice(callback);
-}
-
-void VRDisplayImpl::OnVRDisplayInfoCreated(
- mojom::VRDisplayInfoPtr display_info) {
- if (service_->client() && display_info) {
- service_->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(),
- mojo::MakeRequest(&client_),
- std::move(display_info));
- }
+ device_->AddDisplay(this);
+ service_client->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(),
+ mojo::MakeRequest(&client_),
+ std::move(display_info));
}
VRDisplayImpl::~VRDisplayImpl() {
device_->RemoveDisplay(this);
}
+void VRDisplayImpl::OnChanged(mojom::VRDisplayInfoPtr vr_device_info) {
+ client_->OnChanged(std::move(vr_device_info));
+}
+
+void VRDisplayImpl::OnExitPresent() {
+ client_->OnExitPresent();
+}
+
+void VRDisplayImpl::OnBlur() {
+ client_->OnBlur();
+}
+
+void VRDisplayImpl::OnFocus() {
+ client_->OnFocus();
+}
+
+void VRDisplayImpl::OnActivate(mojom::VRDisplayEventReason reason) {
+ client_->OnActivate(reason);
+}
+
+void VRDisplayImpl::OnDeactivate(mojom::VRDisplayEventReason reason) {
+ client_->OnDeactivate(reason);
+}
+
void VRDisplayImpl::ResetPose() {
if (!device_->IsAccessAllowed(this))
return;
« no previous file with comments | « device/vr/vr_display_impl.h ('k') | device/vr/vr_display_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698