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

Side by Side Diff: net/proxy/dhcp_proxy_script_fetcher_factory.cc

Issue 6831025: Adds support for the DHCP portion of the WPAD (proxy auto-discovery) protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leaks in unit test. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h"
6
7 #include "net/base/net_errors.h"
8 #include "net/proxy/dhcp_proxy_script_fetcher.h"
9
10 #if defined(OS_WIN)
11 #include "net/proxy/dhcp_proxy_script_fetcher_win.h"
12 #endif
13
14 namespace net {
15
16 DhcpProxyScriptFetcherFactory::DhcpProxyScriptFetcherFactory()
17 : feature_enabled_(false) {
18 // TODO(joi): Change this default, and the comment on |set_enabled()|,
19 // when the time is right.
20 set_enabled(false);
21 }
22
23 DhcpProxyScriptFetcher* DhcpProxyScriptFetcherFactory::Create(
24 URLRequestContext* context) {
25 if (!feature_enabled_) {
26 return new DoNothingDhcpProxyScriptFetcher();
27 } else {
28 DCHECK(IsSupported());
29 DhcpProxyScriptFetcher* ret = NULL;
30 #if defined(OS_WIN)
31 ret = new DhcpProxyScriptFetcherWin(context);
32 #endif
33 DCHECK(ret);
34 return ret;
35 }
36 }
37
38 void DhcpProxyScriptFetcherFactory::set_enabled(bool enabled) {
39 if (IsSupported()) {
40 feature_enabled_ = enabled;
41 }
42 }
43
44 bool DhcpProxyScriptFetcherFactory::enabled() const {
45 return feature_enabled_;
46 }
47
48 // static
49 bool DhcpProxyScriptFetcherFactory::IsSupported() {
50 #if defined(OS_WIN)
51 return true;
52 #else
53 return false;
54 #endif
55 }
56
57 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698