OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_RENDERER_RENDERER_GAMEPAD_PROVIDER_H_ | 5 #ifndef CONTENT_GAMEPAD_RENDERER_PROVIDER_H_ |
6 #define CONTENT_PUBLIC_RENDERER_RENDERER_GAMEPAD_PROVIDER_H_ | 6 #define CONTENT_GAMEPAD_RENDERER_PROVIDER_H_ |
7 | |
8 #include "content/public/renderer/platform_event_observer.h" | |
9 | 7 |
10 namespace blink { | 8 namespace blink { |
11 class WebGamepadListener; | 9 class WebGamepadListener; |
12 class WebGamepads; | 10 class WebGamepads; |
13 } | 11 } |
14 | 12 |
15 namespace content { | 13 namespace content { |
16 | 14 |
17 // Provides gamepad data and events for blink. | 15 // Provides gamepad data and events for blink. |
18 class RendererGamepadProvider | 16 class RendererGamepadProvider { |
19 : public PlatformEventObserver<blink::WebGamepadListener> { | |
20 public: | 17 public: |
21 explicit RendererGamepadProvider(RenderThread* thread) | |
22 : PlatformEventObserver<blink::WebGamepadListener>(thread) { } | |
23 // Provides latest snapshot of gamepads. | 18 // Provides latest snapshot of gamepads. |
24 virtual void SampleGamepads(blink::WebGamepads& gamepads) = 0; | 19 virtual void SampleGamepads(blink::WebGamepads& gamepads) = 0; |
25 | 20 |
| 21 // Registers listener for be notified of events. |
| 22 virtual void SetGamepadListener(blink::WebGamepadListener* listener) = 0; |
| 23 |
26 protected: | 24 protected: |
27 virtual ~RendererGamepadProvider() {} | 25 virtual ~RendererGamepadProvider() {} |
28 | |
29 DISALLOW_COPY_AND_ASSIGN(RendererGamepadProvider); | |
30 }; | 26 }; |
31 | 27 |
32 } // namespace content | 28 } // namespace content |
33 | 29 |
34 #endif | 30 #endif |
OLD | NEW |