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_PEPPER_PEPPER_GAMEPAD_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_GAMEPAD_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_GAMEPAD_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_GAMEPAD_HOST_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/weak_ptr.h" |
9 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
10 #include "ppapi/host/resource_host.h" | 11 #include "ppapi/host/resource_host.h" |
11 | 12 |
| 13 namespace ppapi { |
| 14 namespace proxy { |
| 15 class ResourceMessageReplyParams; |
| 16 } |
| 17 } |
| 18 |
12 namespace content { | 19 namespace content { |
13 | 20 |
14 class BrowserPpapiHost; | 21 class BrowserPpapiHost; |
| 22 class GamepadService; |
15 | 23 |
16 class CONTENT_EXPORT PepperGamepadHost : public ppapi::host::ResourceHost { | 24 class CONTENT_EXPORT PepperGamepadHost : public ppapi::host::ResourceHost { |
17 public: | 25 public: |
18 PepperGamepadHost(BrowserPpapiHost* host, | 26 PepperGamepadHost(BrowserPpapiHost* host, |
19 PP_Instance instance, | 27 PP_Instance instance, |
20 PP_Resource resource); | 28 PP_Resource resource); |
| 29 |
| 30 // Allows tests to specify a gamepad service to use rather than the global |
| 31 // singleton. The caller owns the gamepad_service pointer. |
| 32 PepperGamepadHost(GamepadService* gamepad_service, |
| 33 BrowserPpapiHost* host, |
| 34 PP_Instance instance, |
| 35 PP_Resource resource); |
| 36 |
21 virtual ~PepperGamepadHost(); | 37 virtual ~PepperGamepadHost(); |
22 | 38 |
23 virtual int32_t OnResourceMessageReceived( | 39 virtual int32_t OnResourceMessageReceived( |
24 const IPC::Message& msg, | 40 const IPC::Message& msg, |
25 ppapi::host::HostMessageContext* context) OVERRIDE; | 41 ppapi::host::HostMessageContext* context) OVERRIDE; |
26 | 42 |
27 private: | 43 private: |
28 int32_t OnMsgRequestMemory(ppapi::host::HostMessageContext* context); | 44 int32_t OnMsgRequestMemory(ppapi::host::HostMessageContext* context); |
29 | 45 |
| 46 void GotUserGesture(const ppapi::proxy::ResourceMessageReplyParams& params); |
| 47 |
30 BrowserPpapiHost* browser_ppapi_host_; | 48 BrowserPpapiHost* browser_ppapi_host_; |
31 | 49 |
| 50 GamepadService* gamepad_service_; |
| 51 |
| 52 bool is_started_; |
| 53 |
| 54 base::WeakPtrFactory<PepperGamepadHost> weak_factory_; |
| 55 |
32 DISALLOW_COPY_AND_ASSIGN(PepperGamepadHost); | 56 DISALLOW_COPY_AND_ASSIGN(PepperGamepadHost); |
33 }; | 57 }; |
34 | 58 |
35 } // namespace content | 59 } // namespace content |
36 | 60 |
37 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_GAMEPAD_HOST_H_ | 61 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_GAMEPAD_HOST_H_ |
OLD | NEW |