| Index: content/browser/gamepad/gamepad_provider.h
|
| diff --git a/content/browser/gamepad/gamepad_provider.h b/content/browser/gamepad/gamepad_provider.h
|
| index 5f10f137a14ed8311b94a25d7242fa9596ef227f..435f845600910b6de8234ab41ee26fe4ab22d7ef 100644
|
| --- a/content/browser/gamepad/gamepad_provider.h
|
| +++ b/content/browser/gamepad/gamepad_provider.h
|
| @@ -17,6 +17,7 @@
|
| #include "base/synchronization/lock.h"
|
| #include "base/system_monitor/system_monitor.h"
|
| #include "content/common/content_export.h"
|
| +#include "third_party/WebKit/public/platform/WebGamepads.h"
|
|
|
| namespace base {
|
| class MessageLoopProxy;
|
| @@ -43,6 +44,8 @@ class CONTENT_EXPORT GamepadProvider :
|
| base::SharedMemoryHandle GetSharedMemoryHandleForProcess(
|
| base::ProcessHandle renderer_process);
|
|
|
| + void GetCurrentGamepadData(blink::WebGamepads* data);
|
| +
|
| // Pause and resume the background polling thread. Can be called from any
|
| // thread.
|
| void Pause();
|
| @@ -70,6 +73,13 @@ class CONTENT_EXPORT GamepadProvider :
|
| void DoPoll();
|
| void ScheduleDoPoll();
|
|
|
| + void OnGamepadConnectionChange(bool connected,
|
| + int index,
|
| + const blink::WebGamepad& pad);
|
| + void DispatchGamepadConnectionChange(bool connected,
|
| + int index,
|
| + const blink::WebGamepad& pad);
|
| +
|
| GamepadHardwareBuffer* SharedMemoryAsHardwareBuffer();
|
|
|
| // Checks the gamepad state to see if the user has interacted with it.
|
| @@ -112,9 +122,29 @@ class CONTENT_EXPORT GamepadProvider :
|
| base::Lock devices_changed_lock_;
|
| bool devices_changed_;
|
|
|
| - // When polling_thread_ is running, members below are only to be used
|
| - // from that thread.
|
| + bool ever_had_user_gesture_;
|
| +
|
| + struct PadState {
|
| + PadState() : connected(false) {}
|
| + bool Match(const blink::WebGamepad& pad) const;
|
| + void SetPad(const blink::WebGamepad& pad);
|
| + void SetDisconnected();
|
| + void AsWebGamepad(blink::WebGamepad* pad);
|
| +
|
| + bool connected;
|
| + unsigned axes_length;
|
| + unsigned buttons_length;
|
| + blink::WebUChar id[blink::WebGamepad::idLengthCap];
|
| + blink::WebUChar mapping[blink::WebGamepad::mappingLengthCap];
|
| + };
|
| +
|
| + // Used to detect connections and disconnections.
|
| + scoped_ptr<PadState[]> pad_states_;
|
| +
|
| + // Only used on the polling thread.
|
| scoped_ptr<GamepadDataFetcher> data_fetcher_;
|
| +
|
| + base::Lock shared_memory_lock_;
|
| base::SharedMemory gamepad_shared_memory_;
|
|
|
| // Polling is done on this background thread.
|
|
|