| OLD | NEW |
| 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 #include "chrome/browser/extensions/api/serial/serial_port_enumerator.h" | 5 #include "chrome/browser/extensions/api/serial/serial_port_enumerator.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 StringSet valid_patterns = GenerateValidPatterns(); | 74 StringSet valid_patterns = GenerateValidPatterns(); |
| 75 StringSet name_set; | 75 StringSet name_set; |
| 76 file_util::FileEnumerator enumerator( | 76 file_util::FileEnumerator enumerator( |
| 77 DEV_ROOT, false, FILES_AND_SYM_LINKS); | 77 DEV_ROOT, false, FILES_AND_SYM_LINKS); |
| 78 do { | 78 do { |
| 79 const FilePath next_device_path(enumerator.Next()); | 79 const FilePath next_device_path(enumerator.Next()); |
| 80 const std::string next_device = next_device_path.value(); | 80 const std::string next_device = next_device_path.value(); |
| 81 if (next_device.empty()) | 81 if (next_device.empty()) |
| 82 break; | 82 break; |
| 83 | 83 |
| 84 std::set<std::string>::const_iterator i = valid_patterns.begin(); | 84 StringSet::const_iterator i = valid_patterns.begin(); |
| 85 for (; i != valid_patterns.end(); ++i) { | 85 for (; i != valid_patterns.end(); ++i) { |
| 86 if (MatchPattern(next_device, *i)) { | 86 if (MatchPattern(next_device, *i)) { |
| 87 name_set.insert(next_device); | 87 name_set.insert(next_device); |
| 88 break; | 88 break; |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 } while (true); | 91 } while (true); |
| 92 | 92 |
| 93 return name_set; | 93 return name_set; |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace extensions | 96 } // namespace extensions |
| OLD | NEW |