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

Unified Diff: device/vr/vr_service_impl.h

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_service.mojom ('k') | device/vr/vr_service_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_service_impl.h
diff --git a/device/vr/vr_service_impl.h b/device/vr/vr_service_impl.h
index ba8b6b162dd3949158b6676a41159a3ba858dc60..a004cea944bafbddeba490ccc5ec47234d69b4fe 100644
--- a/device/vr/vr_service_impl.h
+++ b/device/vr/vr_service_impl.h
@@ -17,6 +17,11 @@
namespace device {
+// Browser process representation of a WebVR site session. Instantiated through
+// Mojo once the user loads a page containing WebVR.
+// It instantiates a VRDisplayImpl for each newly connected VRDisplay and sends
+// the display's info to the render process through its connected
+// mojom::VRServiceClient.
class VRServiceImpl : public mojom::VRService {
public:
DEVICE_VR_EXPORT VRServiceImpl();
@@ -25,26 +30,25 @@ class VRServiceImpl : public mojom::VRService {
DEVICE_VR_EXPORT static void Create(
mojo::InterfaceRequest<mojom::VRService> request);
- mojom::VRServiceClient* client() { return client_.get(); }
-
- DEVICE_VR_EXPORT VRDisplayImpl* GetVRDisplayImpl(VRDevice* device);
-
// mojom::VRService implementation
+ // Adds this service to the VRDeviceManager.
void SetClient(mojom::VRServiceClientPtr service_client,
const SetClientCallback& callback) override;
bool listening_for_activate() { return listening_for_activate_; }
+ // Tells the render process that a new VR device is available.
+ void ConnectDevice(VRDevice* device);
+
private:
friend class FakeVRServiceClient;
friend class VRDeviceManagerTest;
- friend class VRDisplayImpl;
friend class VRDisplayImplTest;
friend class VRServiceImplTest;
- void RemoveDevice(VRDevice* device);
-
void SetListeningForActivate(bool listening) override;
+ void OnVRDisplayInfoCreated(VRDevice* device,
+ mojom::VRDisplayInfoPtr display_info);
std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>> displays_;
@@ -52,6 +56,11 @@ class VRServiceImpl : public mojom::VRService {
bool listening_for_activate_;
+ base::WeakPtrFactory<VRServiceImpl> weak_ptr_factory_;
+
+ // Getter for testing.
+ DEVICE_VR_EXPORT VRDisplayImpl* GetVRDisplayImplForTesting(VRDevice* device);
+
DISALLOW_COPY_AND_ASSIGN(VRServiceImpl);
};
« no previous file with comments | « device/vr/vr_service.mojom ('k') | device/vr/vr_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698