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

Unified Diff: device/vr/vr_device_manager.h

Issue 2488273002: Revert of mojo VR interface simplified (Closed)
Patch Set: Created 4 years, 1 month 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_device.cc ('k') | device/vr/vr_device_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_device_manager.h
diff --git a/device/vr/vr_device_manager.h b/device/vr/vr_device_manager.h
index b8b9fdaf10eb2c6a96458023398321bbd2715327..2a3bc206dcd916391a4cc8821b476dd8fe1ca1bc 100644
--- a/device/vr/vr_device_manager.h
+++ b/device/vr/vr_device_manager.h
@@ -15,6 +15,7 @@
#include "base/memory/linked_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
+#include "device/vr/vr_client_dispatcher.h"
#include "device/vr/vr_device.h"
#include "device/vr/vr_device_provider.h"
#include "device/vr/vr_export.h"
@@ -24,20 +25,36 @@
namespace device {
-class VRDeviceManager {
+class VRDeviceManager : public VRClientDispatcher {
public:
DEVICE_VR_EXPORT virtual ~VRDeviceManager();
// Returns the VRDeviceManager singleton.
static VRDeviceManager* GetInstance();
+ // Gets a VRDevice instance if the specified service is allowed to access it.
+ DEVICE_VR_EXPORT static VRDevice* GetAllowedDevice(VRServiceImpl* service,
+ unsigned int index);
+
// Adds a listener for device manager events. VRDeviceManager does not own
// this object.
void AddService(VRServiceImpl* service);
void RemoveService(VRServiceImpl* service);
- DEVICE_VR_EXPORT bool GetVRDevices(VRServiceImpl* service);
- DEVICE_VR_EXPORT unsigned int GetNumberOfConnectedDevices();
+ DEVICE_VR_EXPORT mojo::Array<VRDisplayPtr> GetVRDevices();
+
+ // Manage presentation to only allow a single service and device at a time.
+ DEVICE_VR_EXPORT bool RequestPresent(VRServiceImpl* service,
+ unsigned int index,
+ bool secure_origin);
+ DEVICE_VR_EXPORT void ExitPresent(VRServiceImpl* service, unsigned int index);
+ void SubmitFrame(VRServiceImpl* service, unsigned int index, VRPosePtr pose);
+
+ // VRClientDispatcher implementation
+ void OnDeviceChanged(VRDisplayPtr device) override;
+ void OnDeviceConnectionStatusChanged(VRDevice* device,
+ bool is_connected) override;
+ void OnPresentEnded(VRDevice* device) override;
private:
friend class VRDeviceManagerTest;
@@ -72,6 +89,10 @@
using ServiceList = std::vector<VRServiceImpl*>;
ServiceList services_;
+ // Only one service and device is allowed to present at a time.
+ VRServiceImpl* presenting_service_;
+ VRDevice* presenting_device_;
+
// For testing. If true will not delete self when consumer count reaches 0.
bool keep_alive_;
« no previous file with comments | « device/vr/vr_device.cc ('k') | device/vr/vr_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698