Chromium Code Reviews| Index: content/browser/gamepad/gamepad_data_fetcher.h |
| diff --git a/content/browser/gamepad/gamepad_data_fetcher.h b/content/browser/gamepad/gamepad_data_fetcher.h |
| index a395fd9b0d20a931090b6a5feefbc285975465e2..394849a7bcdae3f851458c71a91a74f01492a81c 100644 |
| --- a/content/browser/gamepad/gamepad_data_fetcher.h |
| +++ b/content/browser/gamepad/gamepad_data_fetcher.h |
| @@ -5,55 +5,36 @@ |
| #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_DATA_FETCHER_H_ |
| #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_DATA_FETCHER_H_ |
| -#include <stdint.h> |
| - |
| -#include "build/build_config.h" |
| -#include "content/browser/gamepad/gamepad_standard_mappings.h" |
| -#include "third_party/WebKit/public/platform/WebGamepads.h" |
| +#include "content/browser/gamepad/gamepad_provider.h" |
| +#include "content/common/content_export.h" |
| namespace content { |
| -// Abstract interface for imlementing platform- (and test-) specific behaviro |
| +// Abstract interface for imlementing platform- (and test-) specific behavior |
| // for getting the gamepad data. |
| -class GamepadDataFetcher { |
| +class CONTENT_EXPORT GamepadDataFetcher { |
| public: |
| + GamepadDataFetcher(); |
| virtual ~GamepadDataFetcher() {} |
| - virtual void GetGamepadData(blink::WebGamepads* pads, |
| - bool devices_changed_hint) = 0; |
| - virtual void PauseHint(bool paused) {} |
| - |
| -#if !defined(OS_ANDROID) |
| - struct PadState { |
| - // Gamepad data, unmapped. |
| - blink::WebGamepad data; |
| - // Functions to map from device data to standard layout, if available. May |
| - // be null if no mapping is available. |
| - GamepadStandardMappingFunction mapper; |
| + virtual void GetGamepadData(bool devices_changed_hint) = 0; |
| + virtual void PauseHint(bool paused) {} |
| - // Sanitization masks |
| - // axis_mask and button_mask are bitfields that represent the reset state of |
| - // each input. If a button or axis has ever reported 0 in the past the |
| - // corresponding bit will be set to 1. |
| + GamepadProvider* provider() { return provider_; } |
| - // If we ever increase the max axis count this will need to be updated. |
| - static_assert(blink::WebGamepad::axesLengthCap <= |
| - std::numeric_limits<uint32_t>::digits, |
| - "axis_mask is not large enough"); |
| - uint32_t axis_mask; |
| + protected: |
| + friend GamepadProvider; |
| - // If we ever increase the max button count this will need to be updated. |
| - static_assert(blink::WebGamepad::buttonsLengthCap <= |
| - std::numeric_limits<uint32_t>::digits, |
| - "button_mask is not large enough"); |
| - uint32_t button_mask; |
| - }; |
| + // To be called by the GamepadProvider on the polling thread; |
| + void InitializeProvider(GamepadProvider* provider); |
| - void MapAndSanitizeGamepadData(PadState* pad_state, blink::WebGamepad* pad); |
| + // This call will happen on the gamepad polling thread. Any initialization |
| + // that needs to happen on that thread should be done here, not in the |
| + // constructor. |
| + virtual void OnAddedToProvider() {}; |
|
scottmg
2016/01/18 22:54:51
Stray ;
|
| - protected: |
| - PadState pad_state_[blink::WebGamepads::itemsLengthCap]; |
| -#endif |
| + private: |
| + GamepadProvider* provider_; |
| }; |
| } // namespace content |