| 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 // Define the default data fetcher that GamepadProvider will use if none is | 5 // Define the default data fetcher that GamepadProvider will use if none is |
| 6 // supplied. (GamepadPlatformDataFetcher). | 6 // supplied. (GamepadPlatformDataFetcher). |
| 7 | 7 |
| 8 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_H_ | 8 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_H_ |
| 9 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_H_ | 9 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_H_ |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 15 #include "content/browser/gamepad/gamepad_data_fetcher.h" | 14 #include "content/browser/gamepad/gamepad_data_fetcher.h" |
| 16 #include "content/browser/gamepad/gamepad_provider.h" | |
| 17 | 15 |
| 18 #if defined(OS_ANDROID) | 16 #if defined(OS_ANDROID) |
| 19 #include "content/browser/gamepad/gamepad_platform_data_fetcher_android.h" | 17 #include "content/browser/gamepad/gamepad_platform_data_fetcher_android.h" |
| 20 #elif defined(OS_WIN) | 18 #elif defined(OS_WIN) |
| 21 #include "content/browser/gamepad/gamepad_platform_data_fetcher_win.h" | 19 #include "content/browser/gamepad/gamepad_platform_data_fetcher_win.h" |
| 22 #include "content/browser/gamepad/raw_input_data_fetcher_win.h" | |
| 23 #elif defined(OS_MACOSX) | 20 #elif defined(OS_MACOSX) |
| 24 #include "content/browser/gamepad/gamepad_platform_data_fetcher_mac.h" | 21 #include "content/browser/gamepad/gamepad_platform_data_fetcher_mac.h" |
| 25 #include "content/browser/gamepad/xbox_data_fetcher_mac.h" | |
| 26 #elif defined(OS_LINUX) | 22 #elif defined(OS_LINUX) |
| 27 #include "content/browser/gamepad/gamepad_platform_data_fetcher_linux.h" | 23 #include "content/browser/gamepad/gamepad_platform_data_fetcher_linux.h" |
| 28 #endif | 24 #endif |
| 29 | 25 |
| 30 namespace content { | 26 namespace content { |
| 31 | 27 |
| 32 void AddGamepadPlatformDataFetchers(GamepadProvider* provider) { | |
| 33 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
| 34 | 29 |
| 35 provider->AddGamepadDataFetcher(scoped_ptr<GamepadDataFetcher>( | 30 typedef GamepadPlatformDataFetcherAndroid GamepadPlatformDataFetcher; |
| 36 new GamepadPlatformDataFetcherAndroid())); | |
| 37 | 31 |
| 38 #elif defined(OS_WIN) | 32 #elif defined(OS_WIN) |
| 39 | 33 |
| 40 provider->AddGamepadDataFetcher(scoped_ptr<GamepadDataFetcher>( | 34 typedef GamepadPlatformDataFetcherWin GamepadPlatformDataFetcher; |
| 41 new GamepadPlatformDataFetcherWin())); | |
| 42 provider->AddGamepadDataFetcher(scoped_ptr<GamepadDataFetcher>( | |
| 43 new RawInputDataFetcher())); | |
| 44 | 35 |
| 45 #elif defined(OS_MACOSX) | 36 #elif defined(OS_MACOSX) |
| 46 | 37 |
| 47 provider->AddGamepadDataFetcher(scoped_ptr<GamepadDataFetcher>( | 38 typedef GamepadPlatformDataFetcherMac GamepadPlatformDataFetcher; |
| 48 new GamepadPlatformDataFetcherMac())); | |
| 49 provider->AddGamepadDataFetcher(scoped_ptr<GamepadDataFetcher>( | |
| 50 new XboxDataFetcher())); | |
| 51 | 39 |
| 52 #elif defined(OS_LINUX) && defined(USE_UDEV) | 40 #elif defined(OS_LINUX) && defined(USE_UDEV) |
| 53 | 41 |
| 54 provider->AddGamepadDataFetcher(scoped_ptr<GamepadDataFetcher>( | 42 typedef GamepadPlatformDataFetcherLinux GamepadPlatformDataFetcher; |
| 55 new GamepadPlatformDataFetcherLinux())); | 43 |
| 44 #else |
| 45 |
| 46 class GamepadDataFetcherEmpty : public GamepadDataFetcher { |
| 47 public: |
| 48 GamepadDataFetcherEmpty(); |
| 49 |
| 50 void GetGamepadData(blink::WebGamepads* pads, |
| 51 bool devices_changed_hint) override; |
| 52 |
| 53 private: |
| 54 DISALLOW_COPY_AND_ASSIGN(GamepadDataFetcherEmpty); |
| 55 }; |
| 56 typedef GamepadDataFetcherEmpty GamepadPlatformDataFetcher; |
| 56 | 57 |
| 57 #endif | 58 #endif |
| 58 } | |
| 59 | 59 |
| 60 } // namespace content | 60 } // namespace content |
| 61 | 61 |
| 62 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_H_ | 62 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_H_ |
| OLD | NEW |