OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROMEOS_NETWORK_SHILL_PROPERTY_UTIL_H_ | 5 #ifndef CHROMEOS_NETWORK_SHILL_PROPERTY_UTIL_H_ |
6 #define CHROMEOS_NETWORK_SHILL_PROPERTY_UTIL_H_ | 6 #define CHROMEOS_NETWORK_SHILL_PROPERTY_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // Matches ethernet networks (with or without EAP). | 68 // Matches ethernet networks (with or without EAP). |
69 static NetworkTypePattern Ethernet(); | 69 static NetworkTypePattern Ethernet(); |
70 | 70 |
71 static NetworkTypePattern WiFi(); | 71 static NetworkTypePattern WiFi(); |
72 static NetworkTypePattern Cellular(); | 72 static NetworkTypePattern Cellular(); |
73 static NetworkTypePattern VPN(); | 73 static NetworkTypePattern VPN(); |
74 static NetworkTypePattern Wimax(); | 74 static NetworkTypePattern Wimax(); |
75 | 75 |
76 // Matches only networks of exactly the type |shill_network_type|, which must | 76 // Matches only networks of exactly the type |shill_network_type|, which must |
77 // be one of the types defined in service_constants.h (e.g. | 77 // be one of the types defined in service_constants.h (e.g. |
78 // flimflam::kTypeWifi). | 78 // shill::kTypeWifi). |
79 // Note: Shill distinguishes Ethernet without EAP from Ethernet with EAP. If | 79 // Note: Shill distinguishes Ethernet without EAP from Ethernet with EAP. If |
80 // unsure, better use one of the matchers above. | 80 // unsure, better use one of the matchers above. |
81 static NetworkTypePattern Primitive(const std::string& shill_network_type); | 81 static NetworkTypePattern Primitive(const std::string& shill_network_type); |
82 | 82 |
83 bool Equals(const NetworkTypePattern& other) const; | 83 bool Equals(const NetworkTypePattern& other) const; |
84 bool MatchesType(const std::string& shill_network_type) const; | 84 bool MatchesType(const std::string& shill_network_type) const; |
85 | 85 |
86 // Returns true if this pattern matches at least one network type that | 86 // Returns true if this pattern matches at least one network type that |
87 // |other_pattern| matches (according to MatchesType). Thus MatchesPattern is | 87 // |other_pattern| matches (according to MatchesType). Thus MatchesPattern is |
88 // symmetric and reflexive but not transitive. | 88 // symmetric and reflexive but not transitive. |
89 // See the unit test for examples. | 89 // See the unit test for examples. |
90 bool MatchesPattern(const NetworkTypePattern& other_pattern) const; | 90 bool MatchesPattern(const NetworkTypePattern& other_pattern) const; |
91 | 91 |
92 std::string ToDebugString() const; | 92 std::string ToDebugString() const; |
93 | 93 |
94 private: | 94 private: |
95 explicit NetworkTypePattern(int pattern); | 95 explicit NetworkTypePattern(int pattern); |
96 | 96 |
97 // The bit array of the matching network types. | 97 // The bit array of the matching network types. |
98 int pattern_; | 98 int pattern_; |
99 | 99 |
100 DISALLOW_ASSIGN(NetworkTypePattern); | 100 DISALLOW_ASSIGN(NetworkTypePattern); |
101 }; | 101 }; |
102 | 102 |
103 } // namespace chromeos | 103 } // namespace chromeos |
104 | 104 |
105 #endif // CHROMEOS_NETWORK_SHILL_PROPERTY_UTIL_H_ | 105 #endif // CHROMEOS_NETWORK_SHILL_PROPERTY_UTIL_H_ |
OLD | NEW |