Enables compositing support for webview.
[chromium-blink-merge.git] / net / proxy / proxy_info.cc
blob26018cf94dc5aa3207329f2a9de8c9beb2cecc6c
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.
5 #include "net/proxy/proxy_info.h"
7 #include "net/proxy/proxy_retry_info.h"
9 namespace net {
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) {
18 ProxyInfo::~ProxyInfo() {
21 void ProxyInfo::Use(const ProxyInfo& other) {
22 proxy_list_ = other.proxy_list_;
23 proxy_retry_info_ = other.proxy_retry_info_;
24 config_id_ = other.config_id_;
25 config_source_ = other.config_source_;
26 did_bypass_proxy_ = other.did_bypass_proxy_;
27 did_use_pac_script_ = other.did_use_pac_script_;
30 void ProxyInfo::UseDirect() {
31 Reset();
32 proxy_list_.SetSingleProxyServer(ProxyServer::Direct());
35 void ProxyInfo::UseDirectWithBypassedProxy() {
36 UseDirect();
37 did_bypass_proxy_ = true;
40 void ProxyInfo::UseNamedProxy(const std::string& proxy_uri_list) {
41 Reset();
42 proxy_list_.Set(proxy_uri_list);
45 void ProxyInfo::UseProxyServer(const ProxyServer& proxy_server) {
46 Reset();
47 proxy_list_.SetSingleProxyServer(proxy_server);
50 std::string ProxyInfo::ToPacString() const {
51 return proxy_list_.ToPacString();
54 bool ProxyInfo::Fallback(const BoundNetLog& net_log) {
55 return proxy_list_.Fallback(&proxy_retry_info_, net_log);
58 void ProxyInfo::DeprioritizeBadProxies(
59 const ProxyRetryInfoMap& proxy_retry_info) {
60 proxy_list_.DeprioritizeBadProxies(proxy_retry_info);
63 void ProxyInfo::RemoveProxiesWithoutScheme(int scheme_bit_field) {
64 proxy_list_.RemoveProxiesWithoutScheme(scheme_bit_field);
67 void ProxyInfo::Reset() {
68 proxy_list_.Clear();
69 proxy_retry_info_.clear();
70 config_id_ = ProxyConfig::kInvalidConfigID;
71 config_source_ = PROXY_CONFIG_SOURCE_UNKNOWN;
72 did_bypass_proxy_ = false;
73 did_use_pac_script_ = false;
76 } // namespace net