Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / browser / renderer_host / gamepad_browser_message_filter.h
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   bool OnMessageReceived(const IPC::Message& message) override;
26
27   // GamepadConsumer implementation.
28   void OnGamepadConnected(unsigned index,
29                           const blink::WebGamepad& gamepad) override;
30   void OnGamepadDisconnected(unsigned index,
31                              const blink::WebGamepad& gamepad) override;
32
33  private:
34   ~GamepadBrowserMessageFilter() override;
35
36   void OnGamepadStartPolling(base::SharedMemoryHandle* renderer_handle);
37   void OnGamepadStopPolling();
38
39   bool is_started_;
40
41   DISALLOW_COPY_AND_ASSIGN(GamepadBrowserMessageFilter);
42 };
43
44 }  // namespace content
45
46 #endif  // CONTENT_BROWSER_RENDERER_HOST_GAMEPAD_BROWSER_MESSAGE_FILTER_H_