| OLD | NEW |
| 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 #ifndef DEVICE_VR_VR_DEVICE_H | 5 #ifndef DEVICE_VR_VR_DEVICE_H |
| 6 #define DEVICE_VR_VR_DEVICE_H | 6 #define DEVICE_VR_VR_DEVICE_H |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "device/vr/vr_export.h" | 9 #include "device/vr/vr_export.h" |
| 10 #include "device/vr/vr_service.mojom.h" | 10 #include "device/vr/vr_service.mojom.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 const unsigned int VR_DEVICE_LAST_ID = 0xFFFFFFFF; | 25 const unsigned int VR_DEVICE_LAST_ID = 0xFFFFFFFF; |
| 26 | 26 |
| 27 class DEVICE_VR_EXPORT VRDevice { | 27 class DEVICE_VR_EXPORT VRDevice { |
| 28 public: | 28 public: |
| 29 VRDevice(); | 29 VRDevice(); |
| 30 virtual ~VRDevice(); | 30 virtual ~VRDevice(); |
| 31 | 31 |
| 32 unsigned int id() const { return id_; } | 32 unsigned int id() const { return id_; } |
| 33 | 33 |
| 34 virtual mojom::VRDisplayInfoPtr GetVRDevice() = 0; | 34 virtual mojom::VRDisplayInfoPtr GetVRDevice() = 0; |
| 35 virtual mojom::VRPosePtr GetPose(VRServiceImpl* service) = 0; | 35 virtual mojom::VRPosePtr GetPose() = 0; |
| 36 virtual void ResetPose(VRServiceImpl* service) = 0; | 36 virtual void ResetPose() = 0; |
| 37 | 37 |
| 38 virtual bool RequestPresent(VRServiceImpl* service, bool secure_origin) = 0; | 38 virtual bool RequestPresent(bool secure_origin) = 0; |
| 39 virtual void ExitPresent(VRServiceImpl* service) = 0; | 39 virtual void ExitPresent() = 0; |
| 40 virtual void SubmitFrame(VRServiceImpl* service, mojom::VRPosePtr pose) = 0; | 40 virtual void SubmitFrame(mojom::VRPosePtr pose) = 0; |
| 41 virtual void UpdateLayerBounds(VRServiceImpl* service, | 41 virtual void UpdateLayerBounds(mojom::VRLayerBoundsPtr leftBounds, |
| 42 mojom::VRLayerBoundsPtr leftBounds, | |
| 43 mojom::VRLayerBoundsPtr rightBounds) = 0; | 42 mojom::VRLayerBoundsPtr rightBounds) = 0; |
| 44 | 43 |
| 45 virtual void AddService(VRServiceImpl* service); | 44 virtual void AddService(VRServiceImpl* service); |
| 46 virtual void RemoveService(VRServiceImpl* service); | 45 virtual void RemoveService(VRServiceImpl* service); |
| 47 | 46 |
| 48 // TODO(shaobo.yan@intel.com): Checks should be done against VRDisplayImpl and | 47 // TODO(shaobo.yan@intel.com): Checks should be done against VRDisplayImpl and |
| 49 // the name should be considered. | 48 // the name should be considered. |
| 50 virtual bool IsAccessAllowed(VRServiceImpl* service); | 49 virtual bool IsAccessAllowed(VRServiceImpl* service); |
| 51 virtual bool IsPresentingService(VRServiceImpl* service); | 50 virtual bool IsPresentingService(VRServiceImpl* service); |
| 52 | 51 |
| 53 virtual void OnDisplayChanged(); | 52 virtual void OnDisplayChanged(); |
| 54 virtual void OnExitPresent(VRServiceImpl* service); | 53 virtual void OnExitPresent(); |
| 55 virtual void OnDisplayBlur(); | 54 virtual void OnDisplayBlur(); |
| 56 virtual void OnDisplayFocus(); | 55 virtual void OnDisplayFocus(); |
| 57 | 56 |
| 58 protected: | 57 protected: |
| 58 friend class VRDisplayImpl; |
| 59 |
| 60 void SetPresentingService(VRServiceImpl* service); |
| 61 |
| 62 private: |
| 59 // Each Service have one VRDisplay with one VRDevice. | 63 // Each Service have one VRDisplay with one VRDevice. |
| 60 // TODO(shaobo.yan@intel.com): Since the VRDisplayImpl knows its VRServiceImpl | 64 // TODO(shaobo.yan@intel.com): Since the VRDisplayImpl knows its VRServiceImpl |
| 61 // we should | 65 // we should |
| 62 // only need to store the VRDisplayImpl. | 66 // only need to store the VRDisplayImpl. |
| 63 using DisplayClientMap = std::map<VRServiceImpl*, VRDisplayImpl*>; | 67 using DisplayClientMap = std::map<VRServiceImpl*, VRDisplayImpl*>; |
| 64 DisplayClientMap displays_; | 68 DisplayClientMap displays_; |
| 65 | 69 |
| 66 // TODO(shaobo.yan@intel.com): Should track presenting VRDisplayImpl instead. | 70 // TODO(shaobo.yan@intel.com): Should track presenting VRDisplayImpl instead. |
| 67 VRServiceImpl* presenting_service_; | 71 VRServiceImpl* presenting_service_; |
| 68 | 72 |
| 69 private: | |
| 70 unsigned int id_; | 73 unsigned int id_; |
| 71 | 74 |
| 72 static unsigned int next_id_; | 75 static unsigned int next_id_; |
| 73 | 76 |
| 74 DISALLOW_COPY_AND_ASSIGN(VRDevice); | 77 DISALLOW_COPY_AND_ASSIGN(VRDevice); |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 } // namespace device | 80 } // namespace device |
| 78 | 81 |
| 79 #endif // DEVICE_VR_VR_DEVICE_H | 82 #endif // DEVICE_VR_VR_DEVICE_H |
| OLD | NEW |