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

Side by Side Diff: content/browser/gamepad/gamepad_platform_data_fetcher_mac.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 (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_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_ 5 #ifndef CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_
6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_ 6 #define CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_
7 7
8 #include <CoreFoundation/CoreFoundation.h>
9 #include <IOKit/hid/IOHIDManager.h>
8 #include <stddef.h> 10 #include <stddef.h>
9 11
12 #include <memory>
13
10 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
11 #include "base/mac/scoped_cftyperef.h" 15 #include "base/mac/scoped_cftyperef.h"
12 #include "base/macros.h" 16 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "build/build_config.h" 17 #include "build/build_config.h"
15 #include "content/browser/gamepad/gamepad_data_fetcher.h" 18 #include "content/browser/gamepad/gamepad_data_fetcher.h"
16 #include "content/browser/gamepad/xbox_data_fetcher_mac.h" 19 #include "content/browser/gamepad/xbox_data_fetcher_mac.h"
17 #include "content/common/gamepad_hardware_buffer.h" 20 #include "content/common/gamepad_hardware_buffer.h"
18 21
19 #include <CoreFoundation/CoreFoundation.h>
20 #include <IOKit/hid/IOHIDManager.h>
21
22 #if defined(__OBJC__) 22 #if defined(__OBJC__)
23 @class NSArray; 23 @class NSArray;
24 #else 24 #else
25 class NSArray; 25 class NSArray;
26 #endif 26 #endif
27 27
28 namespace content { 28 namespace content {
29 29
30 class GamepadPlatformDataFetcherMac : public GamepadDataFetcher, 30 class GamepadPlatformDataFetcherMac : public GamepadDataFetcher,
31 public XboxDataFetcher::Delegate { 31 public XboxDataFetcher::Delegate {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void XboxDeviceAdd(XboxController* device) override; 67 void XboxDeviceAdd(XboxController* device) override;
68 void XboxDeviceRemove(XboxController* device) override; 68 void XboxDeviceRemove(XboxController* device) override;
69 void XboxValueChanged(XboxController* device, 69 void XboxValueChanged(XboxController* device,
70 const XboxController::Data& data) override; 70 const XboxController::Data& data) override;
71 71
72 void RegisterForNotifications(); 72 void RegisterForNotifications();
73 void UnregisterFromNotifications(); 73 void UnregisterFromNotifications();
74 74
75 void SanitizeGamepadData(size_t index, blink::WebGamepad* pad); 75 void SanitizeGamepadData(size_t index, blink::WebGamepad* pad);
76 76
77 scoped_ptr<XboxDataFetcher> xbox_fetcher_; 77 std::unique_ptr<XboxDataFetcher> xbox_fetcher_;
78 78
79 // Side-band data that's not passed to the consumer, but we need to maintain 79 // Side-band data that's not passed to the consumer, but we need to maintain
80 // to update data_. 80 // to update data_.
81 struct AssociatedData { 81 struct AssociatedData {
82 bool is_xbox; 82 bool is_xbox;
83 union { 83 union {
84 struct { 84 struct {
85 IOHIDDeviceRef device_ref; 85 IOHIDDeviceRef device_ref;
86 IOHIDElementRef button_elements[blink::WebGamepad::buttonsLengthCap]; 86 IOHIDElementRef button_elements[blink::WebGamepad::buttonsLengthCap];
87 IOHIDElementRef axis_elements[blink::WebGamepad::axesLengthCap]; 87 IOHIDElementRef axis_elements[blink::WebGamepad::axesLengthCap];
88 CFIndex axis_minimums[blink::WebGamepad::axesLengthCap]; 88 CFIndex axis_minimums[blink::WebGamepad::axesLengthCap];
89 CFIndex axis_maximums[blink::WebGamepad::axesLengthCap]; 89 CFIndex axis_maximums[blink::WebGamepad::axesLengthCap];
90 } hid; 90 } hid;
91 struct { 91 struct {
92 XboxController* device; 92 XboxController* device;
93 UInt32 location_id; 93 UInt32 location_id;
94 } xbox; 94 } xbox;
95 }; 95 };
96 }; 96 };
97 AssociatedData associated_[blink::WebGamepads::itemsLengthCap]; 97 AssociatedData associated_[blink::WebGamepads::itemsLengthCap];
98 98
99 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherMac); 99 DISALLOW_COPY_AND_ASSIGN(GamepadPlatformDataFetcherMac);
100 }; 100 };
101 101
102 } // namespace content 102 } // namespace content
103 103
104 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_ 104 #endif // CONTENT_BROWSER_GAMEPAD_GAMEPAD_PLATFORM_DATA_FETCHER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698