OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 NET_PROXY_PROXY_BYPASS_RULES_H_ | 5 #ifndef NET_PROXY_PROXY_BYPASS_RULES_H_ |
6 #define NET_PROXY_PROXY_BYPASS_RULES_H_ | 6 #define NET_PROXY_PROXY_BYPASS_RULES_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // suffix tests rather than hostname tests (so "google.com" would actually | 146 // suffix tests rather than hostname tests (so "google.com" would actually |
147 // match "*google.com"). This is used for KDE which interprets every rule as | 147 // match "*google.com"). This is used for KDE which interprets every rule as |
148 // a suffix test. It is less flexible, since with the suffix matching format | 148 // a suffix test. It is less flexible, since with the suffix matching format |
149 // you can't match an individual host. | 149 // you can't match an individual host. |
150 // | 150 // |
151 // Returns true if the rule was successfully added. | 151 // Returns true if the rule was successfully added. |
152 // | 152 // |
153 // NOTE: Use AddRuleFromString() unless you truly need this behavior. | 153 // NOTE: Use AddRuleFromString() unless you truly need this behavior. |
154 bool AddRuleFromStringUsingSuffixMatching(const std::string& raw); | 154 bool AddRuleFromStringUsingSuffixMatching(const std::string& raw); |
155 | 155 |
| 156 // Converts the rules to string representation. Inverse operation to |
| 157 // ParseFromString(). |
| 158 std::string ToString() const; |
| 159 |
156 // Removes all the rules. | 160 // Removes all the rules. |
157 void Clear(); | 161 void Clear(); |
158 | 162 |
159 // Sets |*this| to |other|. | 163 // Sets |*this| to |other|. |
160 void AssignFrom(const ProxyBypassRules& other); | 164 void AssignFrom(const ProxyBypassRules& other); |
161 | 165 |
162 private: | 166 private: |
163 // The following are variants of ParseFromString() and AddRuleFromString(), | 167 // The following are variants of ParseFromString() and AddRuleFromString(), |
164 // which additionally prefix hostname patterns with a wildcard if | 168 // which additionally prefix hostname patterns with a wildcard if |
165 // |use_hostname_suffix_matching| was true. | 169 // |use_hostname_suffix_matching| was true. |
166 void ParseFromStringInternal(const std::string& raw, | 170 void ParseFromStringInternal(const std::string& raw, |
167 bool use_hostname_suffix_matching); | 171 bool use_hostname_suffix_matching); |
168 bool AddRuleFromStringInternal(const std::string& raw, | 172 bool AddRuleFromStringInternal(const std::string& raw, |
169 bool use_hostname_suffix_matching); | 173 bool use_hostname_suffix_matching); |
170 bool AddRuleFromStringInternalWithLogging(const std::string& raw, | 174 bool AddRuleFromStringInternalWithLogging(const std::string& raw, |
171 bool use_hostname_suffix_matching); | 175 bool use_hostname_suffix_matching); |
172 | 176 |
173 RuleList rules_; | 177 RuleList rules_; |
174 }; | 178 }; |
175 | 179 |
176 } // namespace net | 180 } // namespace net |
177 | 181 |
178 #endif // NET_PROXY_PROXY_BYPASS_RULES_H_ | 182 #endif // NET_PROXY_PROXY_BYPASS_RULES_H_ |
OLD | NEW |