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/serial/serial_device_enumerator_mac.cc

Issue 1226673003: Move MatchPattern to its own header and the base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « content/test/image_decoder_test.cc ('k') | extensions/common/manifest_handlers/webview_info.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/serial/serial_device_enumerator_mac.h" 5 #include "device/serial/serial_device_enumerator_mac.h"
6 6
7 #include "base/files/file_enumerator.h" 7 #include "base/files/file_enumerator.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/pattern.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 13
13 namespace device { 14 namespace device {
14 15
15 // static 16 // static
16 scoped_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() { 17 scoped_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() {
17 return scoped_ptr<SerialDeviceEnumerator>(new SerialDeviceEnumeratorMac()); 18 return scoped_ptr<SerialDeviceEnumerator>(new SerialDeviceEnumeratorMac());
18 } 19 }
19 20
20 SerialDeviceEnumeratorMac::SerialDeviceEnumeratorMac() {} 21 SerialDeviceEnumeratorMac::SerialDeviceEnumeratorMac() {}
(...skipping 18 matching lines...) Expand all
39 mojo::Array<serial::DeviceInfoPtr> devices(0); 40 mojo::Array<serial::DeviceInfoPtr> devices(0);
40 base::FileEnumerator enumerator(kDevRoot, false, kFilesAndSymLinks); 41 base::FileEnumerator enumerator(kDevRoot, false, kFilesAndSymLinks);
41 do { 42 do {
42 const base::FilePath next_device_path(enumerator.Next()); 43 const base::FilePath next_device_path(enumerator.Next());
43 const std::string next_device = next_device_path.value(); 44 const std::string next_device = next_device_path.value();
44 if (next_device.empty()) 45 if (next_device.empty())
45 break; 46 break;
46 47
47 std::set<std::string>::const_iterator i = valid_patterns.begin(); 48 std::set<std::string>::const_iterator i = valid_patterns.begin();
48 for (; i != valid_patterns.end(); ++i) { 49 for (; i != valid_patterns.end(); ++i) {
49 if (MatchPattern(next_device, *i)) { 50 if (base::MatchPattern(next_device, *i)) {
50 serial::DeviceInfoPtr info(serial::DeviceInfo::New()); 51 serial::DeviceInfoPtr info(serial::DeviceInfo::New());
51 info->path = next_device; 52 info->path = next_device;
52 devices.push_back(info.Pass()); 53 devices.push_back(info.Pass());
53 break; 54 break;
54 } 55 }
55 } 56 }
56 } while (true); 57 } while (true);
57 return devices.Pass(); 58 return devices.Pass();
58 } 59 }
59 60
60 } // namespace device 61 } // namespace device
OLDNEW
« no previous file with comments | « content/test/image_decoder_test.cc ('k') | extensions/common/manifest_handlers/webview_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698