| 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 #include "net/proxy/proxy_info.h" | |
| 6 | |
| 7 #include "net/proxy/proxy_retry_info.h" | |
| 8 | |
| 9 namespace net { | |
| 10 | |
| 11 ProxyInfo::ProxyInfo() | |
| 12 : config_id_(ProxyConfig::kInvalidConfigID), | |
| 13 config_source_(PROXY_CONFIG_SOURCE_UNKNOWN), | |
| 14 did_bypass_proxy_(false), | |
| 15 did_use_pac_script_(false) { | |
| 16 } | |
| 17 | |
| 18 ProxyInfo::~ProxyInfo() { | |
| 19 } | |
| 20 | |
| 21 void ProxyInfo::Use(const ProxyInfo& other) { | |
| 22 proxy_resolve_start_time_ = other.proxy_resolve_start_time_; | |
| 23 proxy_resolve_end_time_ = other.proxy_resolve_end_time_; | |
| 24 proxy_list_ = other.proxy_list_; | |
| 25 proxy_retry_info_ = other.proxy_retry_info_; | |
| 26 config_id_ = other.config_id_; | |
| 27 config_source_ = other.config_source_; | |
| 28 did_bypass_proxy_ = other.did_bypass_proxy_; | |
| 29 did_use_pac_script_ = other.did_use_pac_script_; | |
| 30 } | |
| 31 | |
| 32 void ProxyInfo::UseDirect() { | |
| 33 Reset(); | |
| 34 proxy_list_.SetSingleProxyServer(ProxyServer::Direct()); | |
| 35 } | |
| 36 | |
| 37 void ProxyInfo::UseDirectWithBypassedProxy() { | |
| 38 UseDirect(); | |
| 39 did_bypass_proxy_ = true; | |
| 40 } | |
| 41 | |
| 42 void ProxyInfo::UseNamedProxy(const std::string& proxy_uri_list) { | |
| 43 Reset(); | |
| 44 proxy_list_.Set(proxy_uri_list); | |
| 45 } | |
| 46 | |
| 47 void ProxyInfo::UseProxyServer(const ProxyServer& proxy_server) { | |
| 48 Reset(); | |
| 49 proxy_list_.SetSingleProxyServer(proxy_server); | |
| 50 } | |
| 51 | |
| 52 void ProxyInfo::UsePacString(const std::string& pac_string) { | |
| 53 Reset(); | |
| 54 proxy_list_.SetFromPacString(pac_string); | |
| 55 } | |
| 56 | |
| 57 void ProxyInfo::UseProxyList(const ProxyList& proxy_list) { | |
| 58 Reset(); | |
| 59 proxy_list_ = proxy_list; | |
| 60 } | |
| 61 | |
| 62 void ProxyInfo::OverrideProxyList(const ProxyList& proxy_list) { | |
| 63 proxy_list_ = proxy_list; | |
| 64 } | |
| 65 | |
| 66 std::string ProxyInfo::ToPacString() const { | |
| 67 return proxy_list_.ToPacString(); | |
| 68 } | |
| 69 | |
| 70 bool ProxyInfo::Fallback(int net_error, const BoundNetLog& net_log) { | |
| 71 return proxy_list_.Fallback(&proxy_retry_info_, net_error, net_log); | |
| 72 } | |
| 73 | |
| 74 void ProxyInfo::DeprioritizeBadProxies( | |
| 75 const ProxyRetryInfoMap& proxy_retry_info) { | |
| 76 proxy_list_.DeprioritizeBadProxies(proxy_retry_info); | |
| 77 } | |
| 78 | |
| 79 void ProxyInfo::RemoveProxiesWithoutScheme(int scheme_bit_field) { | |
| 80 proxy_list_.RemoveProxiesWithoutScheme(scheme_bit_field); | |
| 81 } | |
| 82 | |
| 83 void ProxyInfo::Reset() { | |
| 84 proxy_resolve_start_time_ = base::TimeTicks(); | |
| 85 proxy_resolve_end_time_ = base::TimeTicks(); | |
| 86 proxy_list_.Clear(); | |
| 87 proxy_retry_info_.clear(); | |
| 88 config_id_ = ProxyConfig::kInvalidConfigID; | |
| 89 config_source_ = PROXY_CONFIG_SOURCE_UNKNOWN; | |
| 90 did_bypass_proxy_ = false; | |
| 91 did_use_pac_script_ = false; | |
| 92 } | |
| 93 | |
| 94 } // namespace net | |
| OLD | NEW |