Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Side by Side Diff: net/proxy/proxy_config.h

Issue 6871019: Enable (optional) blocking of webrequests in case a PAC script cannot be fetched or is invalid. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_CONFIG_H_ 5 #ifndef NET_PROXY_PROXY_CONFIG_H_
6 #define NET_PROXY_PROXY_CONFIG_H_ 6 #define NET_PROXY_PROXY_CONFIG_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 void set_pac_url(const GURL& url) { 143 void set_pac_url(const GURL& url) {
144 pac_url_ = url; 144 pac_url_ = url;
145 } 145 }
146 146
147 const GURL& pac_url() const { 147 const GURL& pac_url() const {
148 return pac_url_; 148 return pac_url_;
149 } 149 }
150 150
151 void set_pac_mandatory(bool enable_pac_mandatory) {
152 pac_mandatory_ = enable_pac_mandatory;
153 }
154
155 bool pac_mandatory() const {
156 return pac_mandatory_;
157 }
158
151 bool has_pac_url() const { 159 bool has_pac_url() const {
152 return pac_url_.is_valid(); 160 return pac_url_.is_valid();
153 } 161 }
154 162
155 void set_auto_detect(bool enable_auto_detect) { 163 void set_auto_detect(bool enable_auto_detect) {
156 auto_detect_ = enable_auto_detect; 164 auto_detect_ = enable_auto_detect;
157 } 165 }
158 166
159 bool auto_detect() const { 167 bool auto_detect() const {
160 return auto_detect_; 168 return auto_detect_;
161 } 169 }
162 170
163 // Helpers to construct some common proxy configurations. 171 // Helpers to construct some common proxy configurations.
164 172
165 static ProxyConfig CreateDirect() { 173 static ProxyConfig CreateDirect() {
166 return ProxyConfig(); 174 return ProxyConfig();
167 } 175 }
168 176
169 static ProxyConfig CreateAutoDetect() { 177 static ProxyConfig CreateAutoDetect() {
170 ProxyConfig config; 178 ProxyConfig config;
171 config.set_auto_detect(true); 179 config.set_auto_detect(true);
172 return config; 180 return config;
173 } 181 }
174 182
175 static ProxyConfig CreateFromCustomPacURL(const GURL& pac_url) { 183 static ProxyConfig CreateFromCustomPacURL(const GURL& pac_url) {
176 ProxyConfig config; 184 ProxyConfig config;
177 config.set_pac_url(pac_url); 185 config.set_pac_url(pac_url);
186 // By default fall back to direct connection in case PAC script fails.
187 config.set_pac_mandatory(false);
178 return config; 188 return config;
179 } 189 }
180 190
181 private: 191 private:
182 // True if the proxy configuration should be auto-detected. 192 // True if the proxy configuration should be auto-detected.
183 bool auto_detect_; 193 bool auto_detect_;
184 194
185 // If non-empty, indicates the URL of the proxy auto-config file to use. 195 // If non-empty, indicates the URL of the proxy auto-config file to use.
186 GURL pac_url_; 196 GURL pac_url_;
187 197
198 // If true, blocks all traffic in case fetching the pac script from |pac_url_|
199 // fails. Only valid if pac_url_ is non-empty.
eroman 2011/05/03 09:45:24 minor nit: enclose enclose "pac_url_" as in |pac_u
battre 2011/05/03 09:55:14 Done.
200 bool pac_mandatory_;
201
188 // Manual proxy settings. 202 // Manual proxy settings.
189 ProxyRules proxy_rules_; 203 ProxyRules proxy_rules_;
190 204
191 int id_; 205 int id_;
192 }; 206 };
193 207
194 } // namespace net 208 } // namespace net
195 209
196 210
197 211
198 #endif // NET_PROXY_PROXY_CONFIG_H_ 212 #endif // NET_PROXY_PROXY_CONFIG_H_
OLDNEW
« no previous file with comments | « net/base/net_error_list.h ('k') | net/proxy/proxy_config.cc » ('j') | net/proxy/proxy_config.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698