OLD | NEW |
(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 "base/id_map.h" |
| 9 #include "content/public/renderer/render_frame_observer.h" |
| 10 #include "third_party/WebKit/public/platform/WebVR.h" |
| 11 #include "third_party/WebKit/public/platform/WebVRClient.h" |
| 12 #include "third_party/WebKit/public/platform/WebVector.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 class VRDispatcher : |
| 17 public RenderFrameObserver, |
| 18 NON_EXPORTED_BASE(public blink::WebVRClient){ |
| 19 public: |
| 20 VRDispatcher(RenderFrame* render_frame); |
| 21 ~VRDispatcher(); |
| 22 |
| 23 // RenderFrameObserver implementation. |
| 24 bool OnMessageReceived(const IPC::Message& message) override; |
| 25 |
| 26 // blink::WebVRClient implementation. |
| 27 void getDevices(blink::WebVRGetDevicesCallback* callback) override; |
| 28 |
| 29 void getSensorState( |
| 30 unsigned int index, blink::WebHMDSensorState& state) override; |
| 31 |
| 32 void resetSensor(unsigned int index) override; |
| 33 |
| 34 private: |
| 35 // IPC Handlers |
| 36 void OnGetDevicesSuccess(int request_id, |
| 37 const std::vector<blink::WebVRDevice>& devices); |
| 38 void OnGetDevicesError(int request_id); |
| 39 |
| 40 // Tracks requests sent to browser to match replies with callbacks. |
| 41 // Owns callback objects. |
| 42 IDMap<blink::WebVRGetDevicesCallback, IDMapOwnPointer> pending_requests_; |
| 43 |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(VRDispatcher); |
| 46 }; |
| 47 |
| 48 } // namespace content |
| 49 |
| 50 #endif // CONTENT_RENDERER_VR_DISPATCHER_H_ |
OLD | NEW |