Chromium Code Reviews| Index: content/renderer/vr_dispatcher.h |
| diff --git a/content/renderer/vr_dispatcher.h b/content/renderer/vr_dispatcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b5acc52d8aaa1c3f6e6b7564d3e17c98d37e2e38 |
| --- /dev/null |
| +++ b/content/renderer/vr_dispatcher.h |
| @@ -0,0 +1,50 @@ |
| +// 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 CONTENT_RENDERER_VR_DISPATCHER_H_ |
| +#define CONTENT_RENDERER_VR_DISPATCHER_H_ |
| + |
| +#include "base/id_map.h" |
| +#include "content/public/renderer/render_frame_observer.h" |
| +#include "third_party/WebKit/public/platform/WebVR.h" |
| +#include "third_party/WebKit/public/platform/WebVRClient.h" |
| +#include "third_party/WebKit/public/platform/WebVector.h" |
| + |
| +namespace content { |
| + |
| +class VRDispatcher : |
| + public RenderFrameObserver, |
| + NON_EXPORTED_BASE(public blink::WebVRClient){ |
|
mdempsky
2015/05/11 19:25:02
Nit: Missing a space between ")" and "{". Please
|
| + public: |
| + VRDispatcher(RenderFrame* render_frame); |
|
mdempsky
2015/05/11 19:25:01
Nit: Add "explicit".
|
| + ~VRDispatcher(); |
| + |
| + // RenderFrameObserver implementation. |
| + bool OnMessageReceived(const IPC::Message& message) override; |
| + |
| + // blink::WebVRClient implementation. |
|
mdempsky
2015/05/11 19:25:01
Since blink::WebVRClient is a private base class,
mdempsky
2015/05/11 19:34:47
Oops, disregard this. I misunderstood the purpose
|
| + void getDevices(blink::WebVRGetDevicesCallback* callback) override; |
| + |
| + void getSensorState( |
| + unsigned int index, blink::WebHMDSensorState& state) override; |
| + |
| + void resetSensor(unsigned int index) override; |
| + |
| + private: |
| + // IPC Handlers |
| + void OnGetDevicesSuccess(int request_id, |
| + const std::vector<blink::WebVRDevice>& devices); |
| + void OnGetDevicesError(int request_id); |
| + |
| + // Tracks requests sent to browser to match replies with callbacks. |
| + // Owns callback objects. |
| + IDMap<blink::WebVRGetDevicesCallback, IDMapOwnPointer> pending_requests_; |
| + |
| + |
| + DISALLOW_COPY_AND_ASSIGN(VRDispatcher); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_VR_DISPATCHER_H_ |