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

Side by Side Diff: content/renderer/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: Rebase to ToT! Created 4 years, 7 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
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/vr/vr_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_VR_DISPATCHER_H_
6 #define CONTENT_RENDERER_VR_DISPATCHER_H_
7
8 #include <vector>
9
10 #include "base/id_map.h"
11 #include "base/macros.h"
12 #include "content/common/vr_service.mojom.h"
13 #include "third_party/WebKit/public/platform/WebVector.h"
14 #include "third_party/WebKit/public/platform/modules/vr/WebVR.h"
15 #include "third_party/WebKit/public/platform/modules/vr/WebVRClient.h"
16
17 namespace content {
18
19 class ServiceRegistry;
20
21 class VRDispatcher : NON_EXPORTED_BASE(public blink::WebVRClient) {
22 public:
23 explicit VRDispatcher(ServiceRegistry* service_registry);
24 ~VRDispatcher() override;
25
26 // blink::WebVRClient implementation.
27 void getDevices(blink::WebVRGetDevicesCallback* callback) override;
28
29 void getSensorState(unsigned int index,
30 blink::WebHMDSensorState& state) override;
31
32 void resetSensor(unsigned int index) override;
33
34 private:
35 // Helper method that returns an initialized PermissionServicePtr.
36 mojom::VRServicePtr& GetVRServicePtr();
37
38 // Callback handlers
39 void OnGetDevices(int request_id,
40 const mojo::Array<mojom::VRDeviceInfoPtr>& devices);
41 static void OnGetSensorState(blink::WebHMDSensorState* state,
42 const mojom::VRSensorStatePtr& mojo_state);
43
44 // Tracks requests sent to browser to match replies with callbacks.
45 // Owns callback objects.
46 IDMap<blink::WebVRGetDevicesCallback, IDMapOwnPointer> pending_requests_;
47
48 ServiceRegistry* service_registry_;
49 mojom::VRServicePtr vr_service_;
50
51 DISALLOW_COPY_AND_ASSIGN(VRDispatcher);
52 };
53
54 } // namespace content
55
56 #endif // CONTENT_RENDERER_VR_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/vr/vr_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698