| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_PORT_ENUMERATOR_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_PORT_ENUMERATOR_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/gtest_prod_util.h" | |
| 12 | |
| 13 FORWARD_DECLARE_TEST(SerialPortEnumeratorTest, ValidPortNamePatterns); | |
| 14 FORWARD_DECLARE_TEST(SerialPortEnumeratorTest, InvalidPortNamePatterns); | |
| 15 | |
| 16 namespace extensions { | |
| 17 | |
| 18 class APIResourceEventNotifier; | |
| 19 | |
| 20 // Discovers and enumerates likely serial ports on the current machine. | |
| 21 class SerialPortEnumerator { | |
| 22 public: | |
| 23 typedef std::set<std::string> StringSet; | |
| 24 | |
| 25 // Returns true if the given port name (e.g., "/dev/tty.usbmodemXXX") is in | |
| 26 // the supplied set of names of serial ports that exist on this machine. | |
| 27 static bool DoesPortExist(const StringSet& name_set, | |
| 28 const std::string& port_name); | |
| 29 | |
| 30 static StringSet GenerateValidSerialPortNames(); | |
| 31 | |
| 32 private: | |
| 33 // Returns a StringSet of patterns to be used with MatchPattern. | |
| 34 static StringSet GenerateValidPatterns(); | |
| 35 | |
| 36 FRIEND_TEST_ALL_PREFIXES(::SerialPortEnumeratorTest, ValidPortNamePatterns); | |
| 37 FRIEND_TEST_ALL_PREFIXES(::SerialPortEnumeratorTest, InvalidPortNamePatterns); | |
| 38 }; | |
| 39 | |
| 40 } // namespace extensions | |
| 41 | |
| 42 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_PORT_ENUMERATOR_H_ | |
| OLD | NEW |