| 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 #include "net/proxy/proxy_config.h" | 5 #include "net/proxy/proxy_config.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_tokenizer.h" | 8 #include "base/string_tokenizer.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "net/proxy/proxy_info.h" | 11 #include "net/proxy/proxy_info.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 DCHECK_EQ(TYPE_PROXY_PER_SCHEME, type); | 151 DCHECK_EQ(TYPE_PROXY_PER_SCHEME, type); |
| 152 if (scheme == "http") | 152 if (scheme == "http") |
| 153 return &proxy_for_http; | 153 return &proxy_for_http; |
| 154 if (scheme == "https") | 154 if (scheme == "https") |
| 155 return &proxy_for_https; | 155 return &proxy_for_https; |
| 156 if (scheme == "ftp") | 156 if (scheme == "ftp") |
| 157 return &proxy_for_ftp; | 157 return &proxy_for_ftp; |
| 158 return NULL; // No mapping for this scheme. | 158 return NULL; // No mapping for this scheme. |
| 159 } | 159 } |
| 160 | 160 |
| 161 ProxyConfig::ProxyConfig() : auto_detect_(false), id_(INVALID_ID) { | 161 ProxyConfig::ProxyConfig() |
| 162 : auto_detect_(false), pac_mandatory_(false), |
| 163 block_everything_(false), id_(INVALID_ID) { |
| 162 } | 164 } |
| 163 | 165 |
| 164 ProxyConfig::ProxyConfig(const ProxyConfig& config) | 166 ProxyConfig::ProxyConfig(const ProxyConfig& config) |
| 165 : auto_detect_(config.auto_detect_), | 167 : auto_detect_(config.auto_detect_), |
| 166 pac_url_(config.pac_url_), | 168 pac_url_(config.pac_url_), |
| 169 pac_mandatory_(config.pac_mandatory_), |
| 167 proxy_rules_(config.proxy_rules_), | 170 proxy_rules_(config.proxy_rules_), |
| 171 block_everything_(config.block_everything_), |
| 168 id_(config.id_) { | 172 id_(config.id_) { |
| 169 } | 173 } |
| 170 | 174 |
| 171 ProxyConfig::~ProxyConfig() { | 175 ProxyConfig::~ProxyConfig() { |
| 172 } | 176 } |
| 173 | 177 |
| 174 ProxyConfig& ProxyConfig::operator=(const ProxyConfig& config) { | 178 ProxyConfig& ProxyConfig::operator=(const ProxyConfig& config) { |
| 175 auto_detect_ = config.auto_detect_; | 179 auto_detect_ = config.auto_detect_; |
| 176 pac_url_ = config.pac_url_; | 180 pac_url_ = config.pac_url_; |
| 181 pac_mandatory_ = config.pac_mandatory_; |
| 177 proxy_rules_ = config.proxy_rules_; | 182 proxy_rules_ = config.proxy_rules_; |
| 183 block_everything_ = config.block_everything_; |
| 178 id_ = config.id_; | 184 id_ = config.id_; |
| 179 return *this; | 185 return *this; |
| 180 } | 186 } |
| 181 | 187 |
| 182 bool ProxyConfig::Equals(const ProxyConfig& other) const { | 188 bool ProxyConfig::Equals(const ProxyConfig& other) const { |
| 183 // The two configs can have different IDs. We are just interested in if they | 189 // The two configs can have different IDs. We are just interested in if they |
| 184 // have the same settings. | 190 // have the same settings. |
| 185 return auto_detect_ == other.auto_detect_ && | 191 return auto_detect_ == other.auto_detect_ && |
| 186 pac_url_ == other.pac_url_ && | 192 pac_url_ == other.pac_url_ && |
| 187 proxy_rules_.Equals(other.proxy_rules()); | 193 pac_mandatory_ == other.pac_mandatory_ && |
| 194 proxy_rules_.Equals(other.proxy_rules()) && |
| 195 block_everything_ == other.block_everything_; |
| 188 } | 196 } |
| 189 | 197 |
| 190 bool ProxyConfig::HasAutomaticSettings() const { | 198 bool ProxyConfig::HasAutomaticSettings() const { |
| 191 return auto_detect_ || has_pac_url(); | 199 return auto_detect_ || has_pac_url(); |
| 192 } | 200 } |
| 193 | 201 |
| 194 void ProxyConfig::ClearAutomaticSettings() { | 202 void ProxyConfig::ClearAutomaticSettings() { |
| 195 auto_detect_ = false; | 203 auto_detect_ = false; |
| 196 pac_url_ = GURL(); | 204 pac_url_ = GURL(); |
| 197 } | 205 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 247 } |
| 240 | 248 |
| 241 dict->Set("bypass_list", list); | 249 dict->Set("bypass_list", list); |
| 242 } | 250 } |
| 243 } | 251 } |
| 244 | 252 |
| 245 return dict; | 253 return dict; |
| 246 } | 254 } |
| 247 | 255 |
| 248 } // namespace net | 256 } // namespace net |
| 249 | |
| OLD | NEW |