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

Unified Diff: third_party/WebKit/Source/platform/vr/vr_dispatcher.h

Issue 1808203005: [OnionSoup] Moving VR service from content to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: third_party/WebKit/Source/platform/vr/vr_dispatcher.h
diff --git a/third_party/WebKit/Source/platform/vr/vr_dispatcher.h b/third_party/WebKit/Source/platform/vr/vr_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..6842f82eda43112c07c53d67ff4692b90a5d7829
--- /dev/null
+++ b/third_party/WebKit/Source/platform/vr/vr_dispatcher.h
@@ -0,0 +1,51 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BLINK_PLATFORM_VR_VR_DISPATCHER_H_
+#define BLINK_PLATFORM_VR_VR_DISPATCHER_H_
+
+#include "base/id_map.h"
+#include "content/common/vr_service.mojom.h"
+#include "platform/PlatformExport.h"
+#include "public/platform/modules/vr/WebVRClient.h"
+#include "wtf/Noncopyable.h"
+
+namespace blink {
+
+class PLATFORM_EXPORT VRDispatcher : public WebVRClient {
+ WTF_MAKE_NONCOPYABLE(VRDispatcher);
+ public:
+ static WebVRClient* create();
+ ~VRDispatcher() override;
+
+ // WebVRClient implementation.
+ void getDevices(WebVRGetDevicesCallback* callback) override;
+
+ void getSensorState(unsigned int index,
+ WebHMDSensorState& state) override;
+
+ void resetSensor(unsigned int index) override;
+
+ private:
+ VRDispatcher();
+
+ // Helper method that returns an initialized PermissionServicePtr.
+ content::VRServicePtr& GetVRServicePtr();
+
+ // Callback handlers
+ void OnGetDevices(int* request_id,
+ const mojo::Array<content::VRDeviceInfoPtr>& devices);
+ void OnGetSensorState(WebHMDSensorState* state,
+ const content::VRSensorStatePtr& mojo_state);
+
+ // Tracks requests sent to browser to match replies with callbacks.
+ // Owns callback objects.
+ IDMap<WebVRGetDevicesCallback, IDMapOwnPointer> pending_requests_;
haraken 2016/03/19 00:45:18 Hmm, IDMap looks nasty. Can we introduce a new ob
RaviKasibhatla 2016/03/21 15:12:01 Done.
+
+ content::VRServicePtr vr_service_;
+};
+
+} // namespace blink
+
+#endif // BLINK_PLATFORM_VR_VR_DISPATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698