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 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_GAMEPAD_BROWSER_MESSAGE_FILTER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_GAMEPAD_BROWSER_MESSAGE_FILTER_H_ 7 8 #include "base/compiler_specific.h" 9 #include "base/memory/shared_memory.h" 10 #include "content/browser/gamepad/gamepad_consumer.h" 11 #include "content/public/browser/browser_message_filter.h" 12 13 namespace content { 14 15 class GamepadService; 16 class RenderProcessHost; 17 18 class GamepadBrowserMessageFilter : 19 public BrowserMessageFilter, 20 public GamepadConsumer { 21 public: 22 GamepadBrowserMessageFilter(); 23 24 // BrowserMessageFilter implementation. 25 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 26 27 // GamepadConsumer implementation. 28 virtual void OnGamepadConnected( 29 unsigned index, 30 const blink::WebGamepad& gamepad) OVERRIDE; 31 virtual void OnGamepadDisconnected( 32 unsigned index, 33 const blink::WebGamepad& gamepad) OVERRIDE; 34 35 private: 36 virtual ~GamepadBrowserMessageFilter(); 37 38 void OnGamepadStartPolling(base::SharedMemoryHandle* renderer_handle); 39 void OnGamepadStopPolling(); 40 41 bool is_started_; 42 43 DISALLOW_COPY_AND_ASSIGN(GamepadBrowserMessageFilter); 44 }; 45 46 } // namespace content 47 48 #endif // CONTENT_BROWSER_RENDERER_HOST_GAMEPAD_BROWSER_MESSAGE_FILTER_H_ 49