| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_RENDERER_HOST_GAMEPAD_BROWSER_MESSAGE_FILTER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_GAMEPAD_BROWSER_MESSAGE_FILTER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_GAMEPAD_BROWSER_MESSAGE_FILTER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_GAMEPAD_BROWSER_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| 11 #include "content/browser/gamepad/gamepad_consumer.h" | |
| 12 #include "content/public/browser/browser_message_filter.h" | 11 #include "content/public/browser/browser_message_filter.h" |
| 12 #include "device/gamepad/gamepad_consumer.h" |
| 13 |
| 14 namespace device { |
| 15 |
| 16 class GamepadService; |
| 17 |
| 18 } |
| 13 | 19 |
| 14 namespace content { | 20 namespace content { |
| 15 | 21 |
| 16 class GamepadService; | |
| 17 class RenderProcessHost; | 22 class RenderProcessHost; |
| 18 | 23 |
| 19 class GamepadBrowserMessageFilter : | 24 class GamepadBrowserMessageFilter : |
| 20 public BrowserMessageFilter, | 25 public BrowserMessageFilter, |
| 21 public GamepadConsumer { | 26 public device::GamepadConsumer { |
| 22 public: | 27 public: |
| 23 GamepadBrowserMessageFilter(); | 28 GamepadBrowserMessageFilter(); |
| 24 | 29 |
| 25 // BrowserMessageFilter implementation. | 30 // BrowserMessageFilter implementation. |
| 26 bool OnMessageReceived(const IPC::Message& message) override; | 31 bool OnMessageReceived(const IPC::Message& message) override; |
| 27 | 32 |
| 28 // GamepadConsumer implementation. | 33 // GamepadConsumer implementation. |
| 29 void OnGamepadConnected(unsigned index, | 34 void OnGamepadConnected(unsigned index, |
| 30 const blink::WebGamepad& gamepad) override; | 35 const blink::WebGamepad& gamepad) override; |
| 31 void OnGamepadDisconnected(unsigned index, | 36 void OnGamepadDisconnected(unsigned index, |
| 32 const blink::WebGamepad& gamepad) override; | 37 const blink::WebGamepad& gamepad) override; |
| 33 | 38 |
| 34 private: | 39 private: |
| 35 ~GamepadBrowserMessageFilter() override; | 40 ~GamepadBrowserMessageFilter() override; |
| 36 | 41 |
| 37 void OnGamepadStartPolling(base::SharedMemoryHandle* renderer_handle); | 42 void OnGamepadStartPolling(base::SharedMemoryHandle* renderer_handle); |
| 38 void OnGamepadStopPolling(); | 43 void OnGamepadStopPolling(); |
| 39 | 44 |
| 40 bool is_started_; | 45 bool is_started_; |
| 41 | 46 |
| 42 DISALLOW_COPY_AND_ASSIGN(GamepadBrowserMessageFilter); | 47 DISALLOW_COPY_AND_ASSIGN(GamepadBrowserMessageFilter); |
| 43 }; | 48 }; |
| 44 | 49 |
| 45 } // namespace content | 50 } // namespace content |
| 46 | 51 |
| 47 #endif // CONTENT_BROWSER_RENDERER_HOST_GAMEPAD_BROWSER_MESSAGE_FILTER_H_ | 52 #endif // CONTENT_BROWSER_RENDERER_HOST_GAMEPAD_BROWSER_MESSAGE_FILTER_H_ |
| OLD | NEW |