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

Side by Side Diff: device/usb/usb_descriptors.cc

Issue 1874313002: Convert device 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 | « device/usb/usb_descriptors.h ('k') | device/usb/usb_descriptors_unittest.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 #include "device/usb/usb_descriptors.h" 5 #include "device/usb/usb_descriptors.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/barrier_closure.h" 13 #include "base/barrier_closure.h"
13 #include "base/bind.h" 14 #include "base/bind.h"
14 #include "device/usb/usb_device_handle.h" 15 #include "device/usb/usb_device_handle.h"
15 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
16 17
17 namespace device { 18 namespace device {
18 19
19 namespace { 20 namespace {
20 21
21 using IndexMap = std::map<uint8_t, base::string16>; 22 using IndexMap = std::map<uint8_t, base::string16>;
22 using IndexMapPtr = scoped_ptr<IndexMap>; 23 using IndexMapPtr = std::unique_ptr<IndexMap>;
23 24
24 // Standard USB requests and descriptor types: 25 // Standard USB requests and descriptor types:
25 const uint8_t kGetDescriptorRequest = 0x06; 26 const uint8_t kGetDescriptorRequest = 0x06;
26 const uint8_t kStringDescriptorType = 0x03; 27 const uint8_t kStringDescriptorType = 0x03;
27 28
28 const int kControlTransferTimeout = 60000; // 1 minute 29 const int kControlTransferTimeout = 60000; // 1 minute
29 30
30 struct UsbInterfaceAssociationDescriptor { 31 struct UsbInterfaceAssociationDescriptor {
31 UsbInterfaceAssociationDescriptor(uint8_t first_interface, 32 UsbInterfaceAssociationDescriptor(uint8_t first_interface,
32 uint8_t interface_count) 33 uint8_t interface_count)
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 callback.Run(std::move(index_map)); 251 callback.Run(std::move(index_map));
251 return; 252 return;
252 } 253 }
253 254
254 ReadStringDescriptor(device_handle, 0, 0, 255 ReadStringDescriptor(device_handle, 0, 0,
255 base::Bind(&OnReadLanguageIds, device_handle, 256 base::Bind(&OnReadLanguageIds, device_handle,
256 base::Passed(&index_map), callback)); 257 base::Passed(&index_map), callback));
257 } 258 }
258 259
259 } // namespace device 260 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_descriptors.h ('k') | device/usb/usb_descriptors_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698