Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: content/browser/gamepad/platform_data_fetcher_win.h

Issue 10781023: use Loadlibrary/GetProcAddress for XInput, rather than /DELAYLOAD (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fixes Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/gamepad/platform_data_fetcher_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_PLATFORM_DATA_FETCHER_WIN_H_ 5 #ifndef CONTENT_BROWSER_GAMEPAD_PLATFORM_DATA_FETCHER_WIN_H_
6 #define CONTENT_BROWSER_GAMEPAD_PLATFORM_DATA_FETCHER_WIN_H_ 6 #define CONTENT_BROWSER_GAMEPAD_PLATFORM_DATA_FETCHER_WIN_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #ifndef WIN32_LEAN_AND_MEAN 10 #ifndef WIN32_LEAN_AND_MEAN
11 #define WIN32_LEAN_AND_MEAN 11 #define WIN32_LEAN_AND_MEAN
12 #endif 12 #endif
13 #include <windows.h> 13 #include <windows.h>
14 #include <XInput.h> 14 #include <XInput.h>
15 15
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/scoped_native_library.h"
18 #include "content/browser/gamepad/data_fetcher.h" 19 #include "content/browser/gamepad/data_fetcher.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 class GamepadPlatformDataFetcherWin : public GamepadDataFetcher { 23 class GamepadPlatformDataFetcherWin : public GamepadDataFetcher {
23 public: 24 public:
24 GamepadPlatformDataFetcherWin(); 25 GamepadPlatformDataFetcherWin();
26 virtual ~GamepadPlatformDataFetcherWin();
25 virtual void GetGamepadData(WebKit::WebGamepads* pads, 27 virtual void GetGamepadData(WebKit::WebGamepads* pads,
26 bool devices_changed_hint) OVERRIDE; 28 bool devices_changed_hint) OVERRIDE;
27 private: 29 private:
30 // The three function types we use from xinput1_3.dll.
31 typedef void (WINAPI *XInputEnableFunc)(BOOL enable);
32 typedef DWORD (WINAPI *XInputGetCapabilitiesFunc)(
33 DWORD dwUserIndex, DWORD dwFlags, XINPUT_CAPABILITIES* pCapabilities);
34 typedef DWORD (WINAPI *XInputGetStateFunc)(
35 DWORD dwUserIndex, XINPUT_STATE* pState);
36
37 // Get functions from dynamically loaded xinput1_3.dll. We don't use
38 // DELAYLOAD because the import library for Win8 SDK pulls xinput1_4 which
39 // isn't redistributable. Returns true if loading was successful. We include
40 // xinput1_3.dll with Chrome.
41 bool GetXinputDllFunctions();
42
43 base::ScopedNativeLibrary xinput_dll_;
28 bool xinput_available_; 44 bool xinput_available_;
29 45
46 // Function pointers to XInput functionality, retrieved in
47 // |GetXinputDllFunctions|.
48 XInputEnableFunc xinput_enable_;
49 XInputGetCapabilitiesFunc xinput_get_capabilities_;
50 XInputGetStateFunc xinput_get_state_;
51
30 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherWin); 52 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherWin);
31 }; 53 };
32 54
33 } // namespace content 55 } // namespace content
34 56
35 #endif // CONTENT_BROWSER_GAMEPAD_PLATFORM_DATA_FETCHER_WIN_H_ 57 #endif // CONTENT_BROWSER_GAMEPAD_PLATFORM_DATA_FETCHER_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/gamepad/platform_data_fetcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698