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

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: Updated to use Mojo as requested by eng review Created 5 years, 6 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.
Ken Rockot(use gerrit already) 2015/05/31 23:43:47 so should this file be gone now?
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() : BrowserMessageFilter(VRMsgStart) {
13 }
14
15 VRMessageFilter::~VRMessageFilter() {
16 }
17
18 void VRMessageFilter::OnDestruct() const {
19 BrowserThread::DeleteOnIOThread::Destruct(this);
20 }
21
22 bool VRMessageFilter::OnMessageReceived(const IPC::Message& message) {
23 bool handled = true;
24 IPC_BEGIN_MESSAGE_MAP(VRMessageFilter, message)
25 IPC_MESSAGE_HANDLER(VRHostMsg_GetVRDevices, OnGetVRDevices)
26 IPC_MESSAGE_HANDLER(VRHostMsg_GetSensorState, OnGetSensorState)
27 IPC_MESSAGE_HANDLER(VRHostMsg_ResetSensor, OnResetSensor)
28 IPC_MESSAGE_UNHANDLED(handled = false)
29 IPC_END_MESSAGE_MAP()
30 return handled;
31 }
32
33 void VRMessageFilter::OnGetVRDevices(int32_t render_frame_id, int request_id) {
34 std::vector<blink::WebVRDevice> devices;
35 GetServiceInstance()->GetVRDevices(&devices);
36 Send(new VRMsg_GetDevicesSuccess(render_frame_id, request_id, devices));
37 }
38
39 void VRMessageFilter::OnGetSensorState(int32_t render_frame_id,
40 unsigned int index,
41 blink::WebHMDSensorState* state) {
42 VRDevice* device = GetServiceInstance()->GetDevice(index);
43 if (device)
44 device->GetSensorState(state);
45 }
46
47 void VRMessageFilter::OnResetSensor(int32_t render_frame_id,
48 unsigned int index) {
49 VRDevice* device = GetServiceInstance()->GetDevice(index);
50 if (device)
51 device->ResetSensor();
52 }
53
54 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698