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 "base/memory/weak_ptr.h" |
10 #include "content/browser/gamepad/gamepad_consumer.h" | 10 #include "content/browser/gamepad/gamepad_consumer.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 PP_Instance instance, | 30 PP_Instance instance, |
31 PP_Resource resource); | 31 PP_Resource resource); |
32 | 32 |
33 // Allows tests to specify a gamepad service to use rather than the global | 33 // Allows tests to specify a gamepad service to use rather than the global |
34 // singleton. The caller owns the gamepad_service pointer. | 34 // singleton. The caller owns the gamepad_service pointer. |
35 PepperGamepadHost(GamepadService* gamepad_service, | 35 PepperGamepadHost(GamepadService* gamepad_service, |
36 BrowserPpapiHost* host, | 36 BrowserPpapiHost* host, |
37 PP_Instance instance, | 37 PP_Instance instance, |
38 PP_Resource resource); | 38 PP_Resource resource); |
39 | 39 |
40 virtual ~PepperGamepadHost(); | 40 ~PepperGamepadHost() override; |
41 | 41 |
42 virtual int32_t OnResourceMessageReceived( | 42 int32_t OnResourceMessageReceived( |
43 const IPC::Message& msg, | 43 const IPC::Message& msg, |
44 ppapi::host::HostMessageContext* context) override; | 44 ppapi::host::HostMessageContext* context) override; |
45 | 45 |
46 // GamepadConsumer implementation. | 46 // GamepadConsumer implementation. |
47 virtual void OnGamepadConnected( | 47 void OnGamepadConnected(unsigned index, |
48 unsigned index, | 48 const blink::WebGamepad& gamepad) override {} |
49 const blink::WebGamepad& gamepad) override {} | 49 void OnGamepadDisconnected(unsigned index, |
50 virtual void OnGamepadDisconnected( | 50 const blink::WebGamepad& gamepad) override {} |
51 unsigned index, | |
52 const blink::WebGamepad& gamepad) override {} | |
53 | 51 |
54 private: | 52 private: |
55 int32_t OnRequestMemory(ppapi::host::HostMessageContext* context); | 53 int32_t OnRequestMemory(ppapi::host::HostMessageContext* context); |
56 | 54 |
57 void GotUserGesture(const ppapi::host::ReplyMessageContext& in_context); | 55 void GotUserGesture(const ppapi::host::ReplyMessageContext& in_context); |
58 | 56 |
59 BrowserPpapiHost* browser_ppapi_host_; | 57 BrowserPpapiHost* browser_ppapi_host_; |
60 | 58 |
61 GamepadService* gamepad_service_; | 59 GamepadService* gamepad_service_; |
62 | 60 |
63 bool is_started_; | 61 bool is_started_; |
64 | 62 |
65 base::WeakPtrFactory<PepperGamepadHost> weak_factory_; | 63 base::WeakPtrFactory<PepperGamepadHost> weak_factory_; |
66 | 64 |
67 DISALLOW_COPY_AND_ASSIGN(PepperGamepadHost); | 65 DISALLOW_COPY_AND_ASSIGN(PepperGamepadHost); |
68 }; | 66 }; |
69 | 67 |
70 } // namespace content | 68 } // namespace content |
71 | 69 |
72 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_GAMEPAD_HOST_H_ | 70 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_GAMEPAD_HOST_H_ |
OLD | NEW |