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

Side by Side Diff: chrome/browser/extensions/api/serial/serial_port_enumerator_posix.cc

Issue 10855002: Change the type of file_type parameter to int, as the parameter actually takes or-ed bitmasks, (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix missing comma. Created 8 years, 4 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 #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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // 58 //
59 // Caching seems undesirable. Many devices can be dynamically added to and 59 // Caching seems undesirable. Many devices can be dynamically added to and
60 // removed from the system, so we really do want to regenerate the set each 60 // removed from the system, so we really do want to regenerate the set each
61 // time. 61 // time.
62 // 62 //
63 // TODO(miket): this might be refactorable into serial_connection.cc, if 63 // TODO(miket): this might be refactorable into serial_connection.cc, if
64 // Windows serial-port enumeration also entails looking through a directory. 64 // Windows serial-port enumeration also entails looking through a directory.
65 SerialPortEnumerator::StringSet 65 SerialPortEnumerator::StringSet
66 SerialPortEnumerator::GenerateValidSerialPortNames() { 66 SerialPortEnumerator::GenerateValidSerialPortNames() {
67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
68 const FilePath DEV_ROOT("/dev"); 68 const FilePath kDevRoot("/dev");
69 const file_util::FileEnumerator::FileType FILES_AND_SYM_LINKS = 69 const int kFilesAndSymLinks =
70 static_cast<file_util::FileEnumerator::FileType>( 70 file_util::FileEnumerator::FILES |
71 file_util::FileEnumerator::FILES | 71 file_util::FileEnumerator::SHOW_SYM_LINKS;
72 file_util::FileEnumerator::SHOW_SYM_LINKS);
73 72
74 StringSet valid_patterns = GenerateValidPatterns(); 73 StringSet valid_patterns = GenerateValidPatterns();
75 StringSet name_set; 74 StringSet name_set;
76 file_util::FileEnumerator enumerator( 75 file_util::FileEnumerator enumerator(
77 DEV_ROOT, false, FILES_AND_SYM_LINKS); 76 kDevRoot, false, kFilesAndSymLinks);
78 do { 77 do {
79 const FilePath next_device_path(enumerator.Next()); 78 const FilePath next_device_path(enumerator.Next());
80 const std::string next_device = next_device_path.value(); 79 const std::string next_device = next_device_path.value();
81 if (next_device.empty()) 80 if (next_device.empty())
82 break; 81 break;
83 82
84 StringSet::const_iterator i = valid_patterns.begin(); 83 StringSet::const_iterator i = valid_patterns.begin();
85 for (; i != valid_patterns.end(); ++i) { 84 for (; i != valid_patterns.end(); ++i) {
86 if (MatchPattern(next_device, *i)) { 85 if (MatchPattern(next_device, *i)) {
87 name_set.insert(next_device); 86 name_set.insert(next_device);
88 break; 87 break;
89 } 88 }
90 } 89 }
91 } while (true); 90 } while (true);
92 91
93 return name_set; 92 return name_set;
94 } 93 }
95 94
96 } // namespace extensions 95 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/camera_detector.cc ('k') | chrome/browser/extensions/sandboxed_unpacker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698