OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "net/proxy/proxy_script_decider.h" | 5 #include "net/proxy/proxy_script_decider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // DNS suffix search paths. This is the same approach taken by Firefox, and | 46 // DNS suffix search paths. This is the same approach taken by Firefox, and |
47 // compatibility hasn't been an issue. | 47 // compatibility hasn't been an issue. |
48 // | 48 // |
49 // For more details, also check out this comment: | 49 // For more details, also check out this comment: |
50 // http://code.google.com/p/chromium/issues/detail?id=18575#c20 | 50 // http://code.google.com/p/chromium/issues/detail?id=18575#c20 |
51 namespace { | 51 namespace { |
52 const char kWpadUrl[] = "http://wpad/wpad.dat"; | 52 const char kWpadUrl[] = "http://wpad/wpad.dat"; |
53 const int kQuickCheckDelayMs = 1000; | 53 const int kQuickCheckDelayMs = 1000; |
54 }; | 54 }; |
55 | 55 |
56 base::Value* ProxyScriptDecider::PacSource::NetLogCallback( | 56 scoped_ptr<base::Value> ProxyScriptDecider::PacSource::NetLogCallback( |
57 const GURL* effective_pac_url, | 57 const GURL* effective_pac_url, |
58 NetLogCaptureMode /* capture_mode */) const { | 58 NetLogCaptureMode /* capture_mode */) const { |
59 base::DictionaryValue* dict = new base::DictionaryValue(); | 59 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
60 std::string source; | 60 std::string source; |
61 switch (type) { | 61 switch (type) { |
62 case PacSource::WPAD_DHCP: | 62 case PacSource::WPAD_DHCP: |
63 source = "WPAD DHCP"; | 63 source = "WPAD DHCP"; |
64 break; | 64 break; |
65 case PacSource::WPAD_DNS: | 65 case PacSource::WPAD_DNS: |
66 source = "WPAD DNS: "; | 66 source = "WPAD DNS: "; |
67 source += effective_pac_url->possibly_invalid_spec(); | 67 source += effective_pac_url->possibly_invalid_spec(); |
68 break; | 68 break; |
69 case PacSource::CUSTOM: | 69 case PacSource::CUSTOM: |
70 source = "Custom PAC URL: "; | 70 source = "Custom PAC URL: "; |
71 source += effective_pac_url->possibly_invalid_spec(); | 71 source += effective_pac_url->possibly_invalid_spec(); |
72 break; | 72 break; |
73 } | 73 } |
74 dict->SetString("source", source); | 74 dict->SetString("source", source); |
75 return dict; | 75 return dict.Pass(); |
76 } | 76 } |
77 | 77 |
78 ProxyScriptDecider::ProxyScriptDecider( | 78 ProxyScriptDecider::ProxyScriptDecider( |
79 ProxyScriptFetcher* proxy_script_fetcher, | 79 ProxyScriptFetcher* proxy_script_fetcher, |
80 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher, | 80 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher, |
81 NetLog* net_log) | 81 NetLog* net_log) |
82 : proxy_script_fetcher_(proxy_script_fetcher), | 82 : proxy_script_fetcher_(proxy_script_fetcher), |
83 dhcp_proxy_script_fetcher_(dhcp_proxy_script_fetcher), | 83 dhcp_proxy_script_fetcher_(dhcp_proxy_script_fetcher), |
84 current_pac_source_index_(0u), | 84 current_pac_source_index_(0u), |
85 pac_mandatory_(false), | 85 pac_mandatory_(false), |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 470 } |
471 | 471 |
472 // This is safe to call in any state. | 472 // This is safe to call in any state. |
473 if (dhcp_proxy_script_fetcher_) | 473 if (dhcp_proxy_script_fetcher_) |
474 dhcp_proxy_script_fetcher_->Cancel(); | 474 dhcp_proxy_script_fetcher_->Cancel(); |
475 | 475 |
476 DidComplete(); | 476 DidComplete(); |
477 } | 477 } |
478 | 478 |
479 } // namespace net | 479 } // namespace net |
OLD | NEW |