move SK_DISABLE_DITHER_32BIT_GRADIENT from SkUserConfig.h to skia.gyp, so we can...
[chromium-blink-merge.git] / net / base / host_mapping_rules.h
blobaa0fb77d85eb1575edf7e1abc46dcabc4e7dfd03
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
3 // found in the LICENSE file.
5 #ifndef NET_BASE_HOST_MAPPING_RULES_H_
6 #define NET_BASE_HOST_MAPPING_RULES_H_
8 #include <string>
9 #include <vector>
10 #include "base/basictypes.h"
11 #include "net/base/net_export.h"
13 namespace net {
15 class HostPortPair;
17 class NET_EXPORT_PRIVATE HostMappingRules {
18 public:
19 HostMappingRules();
20 ~HostMappingRules();
22 // Modifies |*host_port| based on the current rules. Returns true if the
23 // RequestInfo was modified, false otherwise.
24 bool RewriteHost(HostPortPair* host_port) const;
26 // Adds a rule to this mapper. The format of the rule can be one of:
28 // "MAP" <hostname_pattern> <replacement_host> [":" <replacement_port>]
29 // "EXCLUDE" <hostname_pattern>
31 // The <replacement_host> can be either a hostname, or an IP address literal.
33 // Returns true if the rule was successfully parsed and added.
34 bool AddRuleFromString(const std::string& rule_string);
36 // Sets the rules from a comma separated list of rules.
37 void SetRulesFromString(const std::string& rules_string);
39 private:
40 struct MapRule;
41 struct ExclusionRule;
43 typedef std::vector<MapRule> MapRuleList;
44 typedef std::vector<ExclusionRule> ExclusionRuleList;
46 MapRuleList map_rules_;
47 ExclusionRuleList exclusion_rules_;
49 DISALLOW_COPY_AND_ASSIGN(HostMappingRules);
52 } // namespace net
54 #endif // NET_BASE_HOST_MAPPING_RULES_H_