| 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_GAMEPAD_GAMEPAD_SERVICE_H_ | 5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ |
| 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ | 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
| 14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "device/gamepad/gamepad_provider.h" | 17 #include "device/gamepad/gamepad_provider.h" |
| 18 #include "mojo/public/cpp/system/buffer.h" |
| 18 | 19 |
| 19 namespace blink { | 20 namespace blink { |
| 20 class WebGamepad; | 21 class WebGamepad; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace device { | 24 namespace device { |
| 24 class GamepadConsumer; | 25 class GamepadConsumer; |
| 25 class GamepadDataFetcher; | 26 class GamepadDataFetcher; |
| 26 class GamepadProvider; | 27 class GamepadProvider; |
| 27 } | 28 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // Registers the given closure for calling when the user has interacted with | 68 // Registers the given closure for calling when the user has interacted with |
| 68 // the device. This callback will only be issued once. Should only be called | 69 // the device. This callback will only be issued once. Should only be called |
| 69 // while a consumer is active. | 70 // while a consumer is active. |
| 70 void RegisterForUserGesture(const base::Closure& closure); | 71 void RegisterForUserGesture(const base::Closure& closure); |
| 71 | 72 |
| 72 // Returns the shared memory handle of the gamepad data duplicated into the | 73 // Returns the shared memory handle of the gamepad data duplicated into the |
| 73 // given process. | 74 // given process. |
| 74 base::SharedMemoryHandle GetSharedMemoryHandleForProcess( | 75 base::SharedMemoryHandle GetSharedMemoryHandleForProcess( |
| 75 base::ProcessHandle handle); | 76 base::ProcessHandle handle); |
| 76 | 77 |
| 78 // Returns a new mojo::ScopedSharedBuffer handle of the gamepad data. |
| 79 mojo::ScopedSharedBufferHandle GetSharedBufferHandle(); |
| 80 |
| 77 // Stop/join with the background thread in GamepadProvider |provider_|. | 81 // Stop/join with the background thread in GamepadProvider |provider_|. |
| 78 void Terminate(); | 82 void Terminate(); |
| 79 | 83 |
| 80 // Called on IO thread when a gamepad is connected. | 84 // Called on IO thread when a gamepad is connected. |
| 81 void OnGamepadConnected(int index, const blink::WebGamepad& pad); | 85 void OnGamepadConnected(int index, const blink::WebGamepad& pad); |
| 82 | 86 |
| 83 // Called on IO thread when a gamepad is disconnected. | 87 // Called on IO thread when a gamepad is disconnected. |
| 84 void OnGamepadDisconnected(int index, const blink::WebGamepad& pad); | 88 void OnGamepadDisconnected(int index, const blink::WebGamepad& pad); |
| 85 | 89 |
| 86 private: | 90 private: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 int num_active_consumers_; | 134 int num_active_consumers_; |
| 131 | 135 |
| 132 bool gesture_callback_pending_; | 136 bool gesture_callback_pending_; |
| 133 | 137 |
| 134 DISALLOW_COPY_AND_ASSIGN(GamepadService); | 138 DISALLOW_COPY_AND_ASSIGN(GamepadService); |
| 135 }; | 139 }; |
| 136 | 140 |
| 137 } // namespace content | 141 } // namespace content |
| 138 | 142 |
| 139 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ | 143 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_SERVICE_H_ |
| OLD | NEW |