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

Side by Side Diff: device/vr/vr_display_impl.h

Issue 2746233002: Fixes 2D-to-WebVR site transitions when browsing in VR. (Closed)
Patch Set: 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef DEVICE_VR_VR_DISPLAY_IMPL_H 5 #ifndef DEVICE_VR_VR_DISPLAY_IMPL_H
6 #define DEVICE_VR_VR_DISPLAY_IMPL_H 6 #define DEVICE_VR_VR_DISPLAY_IMPL_H
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "device/vr/vr_device.h" 12 #include "device/vr/vr_device.h"
13 #include "device/vr/vr_export.h" 13 #include "device/vr/vr_export.h"
14 #include "device/vr/vr_service.mojom.h" 14 #include "device/vr/vr_service.mojom.h"
15 #include "mojo/public/cpp/bindings/binding.h" 15 #include "mojo/public/cpp/bindings/binding.h"
16 16
17 namespace device { 17 namespace device {
18 18
19 class VRServiceImpl; 19 class VRServiceImpl;
20 20
21 // Browser process representation of a VRDevice within a WebVR site session
22 // (see VRServiceImpl). VRDisplayImpl receives/sends VR device events
23 // from/to mojom::VRDisplayClient (the render process representation of a VR
24 // device).
25 // VRDisplayImpl objects are owned by their respective VRServiceImpl instances.
21 class VRDisplayImpl : public mojom::VRDisplay { 26 class VRDisplayImpl : public mojom::VRDisplay {
22 public: 27 public:
23 VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service); 28 VRDisplayImpl(device::VRDevice* device,
29 VRServiceImpl* service,
30 mojom::VRServiceClient* service_client,
31 mojom::VRDisplayInfoPtr display_info);
24 ~VRDisplayImpl() override; 32 ~VRDisplayImpl() override;
25 33
26 mojom::VRDisplayClient* client() { return client_.get(); } 34 virtual void OnChanged(mojom::VRDisplayInfoPtr vr_device_info);
35 virtual void OnExitPresent();
36 virtual void OnBlur();
37 virtual void OnFocus();
38 virtual void OnActivate(mojom::VRDisplayEventReason reason);
39 virtual void OnDeactivate(mojom::VRDisplayEventReason reason);
27 40
28 private: 41 private:
29 friend class VRDisplayImplTest; 42 friend class VRDisplayImplTest;
30 friend class VRServiceImpl; 43 friend class VRServiceImpl;
31 44
32 void ResetPose() override; 45 void ResetPose() override;
33 46
34 void RequestPresent(bool secure_origin, 47 void RequestPresent(bool secure_origin,
35 const RequestPresentCallback& callback) override; 48 const RequestPresentCallback& callback) override;
36 void ExitPresent() override; 49 void ExitPresent() override;
37 void SubmitFrame(mojom::VRPosePtr pose) override; 50 void SubmitFrame(mojom::VRPosePtr pose) override;
38 51
39 void UpdateLayerBounds(int16_t frame_index, 52 void UpdateLayerBounds(int16_t frame_index,
40 mojom::VRLayerBoundsPtr left_bounds, 53 mojom::VRLayerBoundsPtr left_bounds,
41 mojom::VRLayerBoundsPtr right_bounds) override; 54 mojom::VRLayerBoundsPtr right_bounds) override;
42 void GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) override; 55 void GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) override;
43 56
44 void RequestPresentResult(const RequestPresentCallback& callback, 57 void RequestPresentResult(const RequestPresentCallback& callback,
45 bool secure_origin, 58 bool secure_origin,
46 bool success); 59 bool success);
47 60
48 void OnVRDisplayInfoCreated(mojom::VRDisplayInfoPtr display_info);
49
50 mojo::Binding<mojom::VRDisplay> binding_; 61 mojo::Binding<mojom::VRDisplay> binding_;
51 mojom::VRDisplayClientPtr client_; 62 mojom::VRDisplayClientPtr client_;
52 device::VRDevice* device_; 63 device::VRDevice* device_;
53 VRServiceImpl* service_; 64 VRServiceImpl* service_;
54 65
55 base::WeakPtrFactory<VRDisplayImpl> weak_ptr_factory_; 66 base::WeakPtrFactory<VRDisplayImpl> weak_ptr_factory_;
56 }; 67 };
57 68
58 } // namespace device 69 } // namespace device
59 70
60 #endif // DEVICE_VR_VR_DISPLAY_IMPL_H 71 #endif // DEVICE_VR_VR_DISPLAY_IMPL_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698