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

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

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_RAW_INPUT_DATA_FETCHER_WIN_H_ 5 #ifndef CONTENT_BROWSER_GAMEPAD_RAW_INPUT_DATA_FETCHER_WIN_H_
6 #define CONTENT_BROWSER_GAMEPAD_RAW_INPUT_DATA_FETCHER_WIN_H_ 6 #define CONTENT_BROWSER_GAMEPAD_RAW_INPUT_DATA_FETCHER_WIN_H_
7 7
8 #include "build/build_config.h"
9
10 #include <stdint.h> 8 #include <stdint.h>
11 #include <stdlib.h> 9 #include <stdlib.h>
12 #include <Unknwn.h> 10 #include <Unknwn.h>
13 #include <WinDef.h> 11 #include <WinDef.h>
14 #include <windows.h> 12 #include <windows.h>
13 #include <hidsdi.h>
15 14
16 #include <hidsdi.h>
17 #include <map> 15 #include <map>
16 #include <memory>
18 #include <vector> 17 #include <vector>
19 18
20 #include "base/macros.h" 19 #include "base/macros.h"
21 #include "base/memory/scoped_ptr.h"
22 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
23 #include "base/message_loop/message_loop.h" 21 #include "base/message_loop/message_loop.h"
24 #include "base/scoped_native_library.h" 22 #include "base/scoped_native_library.h"
25 #include "base/win/message_window.h" 23 #include "base/win/message_window.h"
24 #include "build/build_config.h"
26 #include "content/browser/gamepad/gamepad_data_fetcher.h" 25 #include "content/browser/gamepad/gamepad_data_fetcher.h"
27 #include "content/browser/gamepad/gamepad_standard_mappings.h" 26 #include "content/browser/gamepad/gamepad_standard_mappings.h"
28 #include "third_party/WebKit/public/platform/WebGamepads.h" 27 #include "third_party/WebKit/public/platform/WebGamepads.h"
29 28
30 namespace content { 29 namespace content {
31 30
32 struct RawGamepadAxis { 31 struct RawGamepadAxis {
33 HIDP_VALUE_CAPS caps; 32 HIDP_VALUE_CAPS caps;
34 float value; 33 float value;
35 bool active; 34 bool active;
36 unsigned long bitmask; 35 unsigned long bitmask;
37 }; 36 };
38 37
39 struct RawGamepadInfo { 38 struct RawGamepadInfo {
40 RawGamepadInfo(); 39 RawGamepadInfo();
41 ~RawGamepadInfo(); 40 ~RawGamepadInfo();
42 41
43 HANDLE handle; 42 HANDLE handle;
44 scoped_ptr<uint8_t[]> ppd_buffer; 43 std::unique_ptr<uint8_t[]> ppd_buffer;
45 PHIDP_PREPARSED_DATA preparsed_data; 44 PHIDP_PREPARSED_DATA preparsed_data;
46 45
47 uint32_t report_id; 46 uint32_t report_id;
48 uint32_t vendor_id; 47 uint32_t vendor_id;
49 uint32_t product_id; 48 uint32_t product_id;
50 49
51 wchar_t id[blink::WebGamepad::idLengthCap]; 50 wchar_t id[blink::WebGamepad::idLengthCap];
52 51
53 uint32_t buttons_length; 52 uint32_t buttons_length;
54 bool buttons[blink::WebGamepad::buttonsLengthCap]; 53 bool buttons[blink::WebGamepad::buttonsLengthCap];
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 USAGE Usage, PLONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, 112 USAGE Usage, PLONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData,
114 PCHAR Report, ULONG ReportLength); 113 PCHAR Report, ULONG ReportLength);
115 typedef BOOLEAN (__stdcall *HidDGetStringFunc)( 114 typedef BOOLEAN (__stdcall *HidDGetStringFunc)(
116 HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength); 115 HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength);
117 116
118 // Get functions from dynamically loaded hid.dll. Returns true if loading was 117 // Get functions from dynamically loaded hid.dll. Returns true if loading was
119 // successful. 118 // successful.
120 bool GetHidDllFunctions(); 119 bool GetHidDllFunctions();
121 120
122 base::ScopedNativeLibrary hid_dll_; 121 base::ScopedNativeLibrary hid_dll_;
123 scoped_ptr<base::win::MessageWindow> window_; 122 std::unique_ptr<base::win::MessageWindow> window_;
124 bool rawinput_available_; 123 bool rawinput_available_;
125 bool filter_xinput_; 124 bool filter_xinput_;
126 bool events_monitored_; 125 bool events_monitored_;
127 126
128 std::map<HANDLE, RawGamepadInfo*> controllers_; 127 std::map<HANDLE, RawGamepadInfo*> controllers_;
129 128
130 // Function pointers to HID functionality, retrieved in 129 // Function pointers to HID functionality, retrieved in
131 // |GetHidDllFunctions|. 130 // |GetHidDllFunctions|.
132 HidPGetCapsFunc hidp_get_caps_; 131 HidPGetCapsFunc hidp_get_caps_;
133 HidPGetButtonCapsFunc hidp_get_button_caps_; 132 HidPGetButtonCapsFunc hidp_get_button_caps_;
134 HidPGetValueCapsFunc hidp_get_value_caps_; 133 HidPGetValueCapsFunc hidp_get_value_caps_;
135 HidPGetUsagesExFunc hidp_get_usages_ex_; 134 HidPGetUsagesExFunc hidp_get_usages_ex_;
136 HidPGetUsageValueFunc hidp_get_usage_value_; 135 HidPGetUsageValueFunc hidp_get_usage_value_;
137 HidPGetScaledUsageValueFunc hidp_get_scaled_usage_value_; 136 HidPGetScaledUsageValueFunc hidp_get_scaled_usage_value_;
138 HidDGetStringFunc hidd_get_product_string_; 137 HidDGetStringFunc hidd_get_product_string_;
139 138
140 DISALLOW_COPY_AND_ASSIGN(RawInputDataFetcher); 139 DISALLOW_COPY_AND_ASSIGN(RawInputDataFetcher);
141 }; 140 };
142 141
143 } // namespace content 142 } // namespace content
144 143
145 #endif // CONTENT_BROWSER_GAMEPAD_RAW_INPUT_DATA_FETCHER_WIN_H_ 144 #endif // CONTENT_BROWSER_GAMEPAD_RAW_INPUT_DATA_FETCHER_WIN_H_
OLDNEW
« no previous file with comments | « content/browser/gamepad/gamepad_test_helpers.cc ('k') | content/browser/gamepad/raw_input_data_fetcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698