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

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
171 void set_block_everything(bool enable_block_everything) {
eroman 2011/04/26 21:47:17 I would rather not have this bool here, since it i
battre 2011/04/27 17:02:58 I have introduced the int. I don't know whether th
172 block_everything_ = enable_block_everything;
173 }
174
175 bool block_everything() const {
176 return block_everything_;
177 }
178
163 // Helpers to construct some common proxy configurations. 179 // Helpers to construct some common proxy configurations.
164 180
165 static ProxyConfig CreateDirect() { 181 static ProxyConfig CreateDirect() {
166 return ProxyConfig(); 182 return ProxyConfig();
167 } 183 }
168 184
169 static ProxyConfig CreateAutoDetect() { 185 static ProxyConfig CreateAutoDetect() {
170 ProxyConfig config; 186 ProxyConfig config;
171 config.set_auto_detect(true); 187 config.set_auto_detect(true);
172 return config; 188 return config;
173 } 189 }
174 190
175 static ProxyConfig CreateFromCustomPacURL(const GURL& pac_url) { 191 static ProxyConfig CreateFromCustomPacURL(const GURL& pac_url) {
176 ProxyConfig config; 192 ProxyConfig config;
177 config.set_pac_url(pac_url); 193 config.set_pac_url(pac_url);
178 return config; 194 return config;
179 } 195 }
180 196
181 private: 197 private:
182 // True if the proxy configuration should be auto-detected. 198 // True if the proxy configuration should be auto-detected.
183 bool auto_detect_; 199 bool auto_detect_;
184 200
185 // If non-empty, indicates the URL of the proxy auto-config file to use. 201 // If non-empty, indicates the URL of the proxy auto-config file to use.
186 GURL pac_url_; 202 GURL pac_url_;
187 203
204 // If true, blocks all traffic in case fetching the pac script from |pac_url_|
205 // fails. Only valid if pac_url_ is non-empty.
206 bool pac_mandatory_;
207
188 // Manual proxy settings. 208 // Manual proxy settings.
189 ProxyRules proxy_rules_; 209 ProxyRules proxy_rules_;
190 210
211 // If true, no traffic can be sent.
212 bool block_everything_;
213
191 int id_; 214 int id_;
192 }; 215 };
193 216
194 } // namespace net 217 } // namespace net
195 218
196 219
197 220
198 #endif // NET_PROXY_PROXY_CONFIG_H_ 221 #endif // NET_PROXY_PROXY_CONFIG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698