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

Side by Side Diff: content/browser/renderer_host/vr_message_filter.cc

Issue 829803003: Adding Chrome-side WebVR interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't install message filter unless enable flag is present. Created 5 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 unified diff | Download patch
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 #include "content/browser/renderer_host/vr_message_filter.h"
6
7 #include "content/common/vr_messages.h"
8 #include "third_party/WebKit/public/platform/WebVR.h"
9
10 namespace content {
11
12 VRMessageFilter::VRMessageFilter()
13 : BrowserMessageFilter(VRMsgStart) {
14 }
15
16 VRMessageFilter::~VRMessageFilter() {
17 }
18
19 void VRMessageFilter::OnDestruct() const {
20 BrowserThread::DeleteOnIOThread::Destruct(this);
21 }
22
23 bool VRMessageFilter::OnMessageReceived(
24 const IPC::Message& message) {
25 bool handled = true;
26 IPC_BEGIN_MESSAGE_MAP(VRMessageFilter, message)
27 IPC_MESSAGE_HANDLER(VRHostMsg_GetVRDevices,
28 OnGetVRDevices)
29 IPC_MESSAGE_HANDLER(VRHostMsg_GetSensorState,
30 OnGetSensorState)
31 IPC_MESSAGE_HANDLER(VRHostMsg_ResetSensor,
32 OnResetSensor)
33 IPC_MESSAGE_HANDLER(VRHostMsg_GetRenderTargetRects,
34 OnGetRenderTargetRects)
35 IPC_MESSAGE_UNHANDLED(handled = false)
36 IPC_END_MESSAGE_MAP()
37 return handled;
38 }
39
40 void VRMessageFilter::OnGetVRDevices(
41 std::vector<blink::WebVRDevice>* devices) {
42 GetServiceInstance()->GetVRDevices(devices);
43 }
44
45 void VRMessageFilter::OnGetSensorState(
46 unsigned int index, blink::WebHMDSensorState* state) {
47 VRDevice* device = GetServiceInstance()->GetDevice(index);
48 if (device) {
49 device->GetSensorState(state);
jdduke (slow) 2015/03/30 15:19:47 So, these methods appear to be getting called on t
50 }
51 }
52
53 void VRMessageFilter::OnResetSensor(unsigned int index) {
54 VRDevice* device = GetServiceInstance()->GetDevice(index);
55 if (device) {
56 device->ResetSensor();
57 }
58 }
59
60 void VRMessageFilter::OnGetRenderTargetRects(
61 unsigned index,
62 blink::WebVRFieldOfView leftFov,
63 blink::WebVRFieldOfView rightFov,
64 blink::WebVRVector4* leftRect,
65 blink::WebVRVector4* rightRect) {
66 VRDevice* device = GetServiceInstance()->GetDevice(index);
67 if (device) {
68 device->GetRenderTargetRects(leftFov, rightFov, leftRect, rightRect);
jdduke (slow) 2015/03/30 15:19:47 Apologies if you've already gone over this, but I
69 }
70 }
71
72 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698