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

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: use FILE_PATH_LITERAL 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
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/scoped_native_library.h"
jochen (gone - plz use gerrit) 2012/07/19 14:34:04 nit. alphabetical order
scottmg 2012/07/19 16:45:16 Done.
17 #include "base/compiler_specific.h" 18 #include "base/compiler_specific.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();
25 virtual void GetGamepadData(WebKit::WebGamepads* pads, 26 virtual void GetGamepadData(WebKit::WebGamepads* pads,
26 bool devices_changed_hint) OVERRIDE; 27 bool devices_changed_hint) OVERRIDE;
jochen (gone - plz use gerrit) 2012/07/19 14:34:04 virtual destructor missing
scottmg 2012/07/19 16:45:16 Done.
27 private: 28 private:
29 base::ScopedNativeLibrary xinput_dll_;
28 bool xinput_available_; 30 bool xinput_available_;
29 31
32 // The three functions we use from xinput1_3.dll.
33 typedef void (WINAPI *XInputEnableFunc)(BOOL enable);
34 typedef DWORD (WINAPI *XInputGetCapabilitiesFunc)(
35 DWORD dwUserIndex, DWORD dwFlags, XINPUT_CAPABILITIES* pCapabilities);
36 typedef DWORD (WINAPI *XInputGetStateFunc)(
37 DWORD dwUserIndex, XINPUT_STATE* pState);
38 XInputEnableFunc xinput_enable_;
39 XInputGetCapabilitiesFunc xinput_get_capabilities_;
40 XInputGetStateFunc xinput_get_state_;
41
42 // Get functions from dynamically loaded xinput1_3.dll. We don't use
43 // DELAYLOAD because the import library for Win8 SDK pulls xinput1_4 which
44 // isn't redistributable. Returns true if loading was successful. We include
45 // xinput1_3.dll with Chrome.
46 bool GetXinputDllFunctions();
jochen (gone - plz use gerrit) 2012/07/19 14:34:04 the style guide requires typedefs first, the funct
scottmg 2012/07/19 16:45:16 Done.
47
30 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherWin); 48 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherWin);
31 }; 49 };
32 50
33 } // namespace content 51 } // namespace content
34 52
35 #endif // CONTENT_BROWSER_GAMEPAD_PLATFORM_DATA_FETCHER_WIN_H_ 53 #endif // CONTENT_BROWSER_GAMEPAD_PLATFORM_DATA_FETCHER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698