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

Side by Side Diff: extensions/browser/api/usb/usb_api.h

Issue 1902873002: Convert //extensions/browser/api 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
« no previous file with comments | « extensions/browser/api/test/test_api.cc ('k') | extensions/browser/api/usb/usb_api.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 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 EXTENSIONS_BROWSER_API_USB_USB_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_USB_USB_API_H_
6 #define EXTENSIONS_BROWSER_API_USB_USB_API_H_ 6 #define EXTENSIONS_BROWSER_API_USB_USB_API_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory>
11 #include <string> 12 #include <string>
12 #include <vector> 13 #include <vector>
13 14
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "device/usb/usb_device.h" 17 #include "device/usb/usb_device.h"
18 #include "device/usb/usb_device_filter.h" 18 #include "device/usb/usb_device_filter.h"
19 #include "device/usb/usb_device_handle.h" 19 #include "device/usb/usb_device_handle.h"
20 #include "extensions/browser/api/api_resource_manager.h" 20 #include "extensions/browser/api/api_resource_manager.h"
21 #include "extensions/browser/extension_function.h" 21 #include "extensions/browser/extension_function.h"
22 #include "extensions/common/api/usb.h" 22 #include "extensions/common/api/usb.h"
23 #include "net/base/io_buffer.h" 23 #include "net/base/io_buffer.h"
24 24
25 namespace extensions { 25 namespace extensions {
26 26
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // ExtensionFunction: 76 // ExtensionFunction:
77 ResponseAction Run() override; 77 ResponseAction Run() override;
78 78
79 void OnGetDevicesComplete( 79 void OnGetDevicesComplete(
80 const std::vector<scoped_refptr<device::UsbDevice>>& devices); 80 const std::vector<scoped_refptr<device::UsbDevice>>& devices);
81 void OnDeviceOpened(scoped_refptr<device::UsbDeviceHandle> device_handle); 81 void OnDeviceOpened(scoped_refptr<device::UsbDeviceHandle> device_handle);
82 void OpenComplete(); 82 void OpenComplete();
83 83
84 uint16_t vendor_id_; 84 uint16_t vendor_id_;
85 uint16_t product_id_; 85 uint16_t product_id_;
86 scoped_ptr<base::ListValue> result_; 86 std::unique_ptr<base::ListValue> result_;
87 base::Closure barrier_; 87 base::Closure barrier_;
88 88
89 DISALLOW_COPY_AND_ASSIGN(UsbFindDevicesFunction); 89 DISALLOW_COPY_AND_ASSIGN(UsbFindDevicesFunction);
90 }; 90 };
91 91
92 class UsbGetDevicesFunction : public UsbPermissionCheckingFunction { 92 class UsbGetDevicesFunction : public UsbPermissionCheckingFunction {
93 public: 93 public:
94 DECLARE_EXTENSION_FUNCTION("usb.getDevices", USB_GETDEVICES) 94 DECLARE_EXTENSION_FUNCTION("usb.getDevices", USB_GETDEVICES)
95 95
96 UsbGetDevicesFunction(); 96 UsbGetDevicesFunction();
(...skipping 21 matching lines...) Expand all
118 118
119 private: 119 private:
120 ~UsbGetUserSelectedDevicesFunction() override; 120 ~UsbGetUserSelectedDevicesFunction() override;
121 121
122 // ExtensionFunction: 122 // ExtensionFunction:
123 ResponseAction Run() override; 123 ResponseAction Run() override;
124 124
125 void OnDevicesChosen( 125 void OnDevicesChosen(
126 const std::vector<scoped_refptr<device::UsbDevice>>& devices); 126 const std::vector<scoped_refptr<device::UsbDevice>>& devices);
127 127
128 scoped_ptr<DevicePermissionsPrompt> prompt_; 128 std::unique_ptr<DevicePermissionsPrompt> prompt_;
129 129
130 DISALLOW_COPY_AND_ASSIGN(UsbGetUserSelectedDevicesFunction); 130 DISALLOW_COPY_AND_ASSIGN(UsbGetUserSelectedDevicesFunction);
131 }; 131 };
132 132
133 class UsbGetConfigurationsFunction : public UsbPermissionCheckingFunction { 133 class UsbGetConfigurationsFunction : public UsbPermissionCheckingFunction {
134 public: 134 public:
135 DECLARE_EXTENSION_FUNCTION("usb.getConfigurations", USB_GETCONFIGURATIONS); 135 DECLARE_EXTENSION_FUNCTION("usb.getConfigurations", USB_GETCONFIGURATIONS);
136 136
137 UsbGetConfigurationsFunction(); 137 UsbGetConfigurationsFunction();
138 138
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 UsbResetDeviceFunction(); 362 UsbResetDeviceFunction();
363 363
364 private: 364 private:
365 ~UsbResetDeviceFunction() override; 365 ~UsbResetDeviceFunction() override;
366 366
367 // ExtensionFunction: 367 // ExtensionFunction:
368 ResponseAction Run() override; 368 ResponseAction Run() override;
369 369
370 void OnComplete(bool success); 370 void OnComplete(bool success);
371 371
372 scoped_ptr<extensions::api::usb::ResetDevice::Params> parameters_; 372 std::unique_ptr<extensions::api::usb::ResetDevice::Params> parameters_;
373 373
374 DISALLOW_COPY_AND_ASSIGN(UsbResetDeviceFunction); 374 DISALLOW_COPY_AND_ASSIGN(UsbResetDeviceFunction);
375 }; 375 };
376 } // namespace extensions 376 } // namespace extensions
377 377
378 #endif // EXTENSIONS_BROWSER_API_USB_USB_API_H_ 378 #endif // EXTENSIONS_BROWSER_API_USB_USB_API_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/test/test_api.cc ('k') | extensions/browser/api/usb/usb_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698