| 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 #ifndef NET_PROXY_PROXY_SCRIPT_DECIDER_H_ | 5 #ifndef NET_PROXY_PROXY_SCRIPT_DECIDER_H_ |
| 6 #define NET_PROXY_PROXY_SCRIPT_DECIDER_H_ | 6 #define NET_PROXY_PROXY_SCRIPT_DECIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/string16.h" | 13 #include "base/string16.h" |
| 13 #include "base/time.h" | 14 #include "base/time.h" |
| 14 #include "base/timer.h" | 15 #include "base/timer.h" |
| 15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 16 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
| 17 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
| 18 #include "net/base/net_log.h" | 19 #include "net/base/net_log.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 struct PacSource { | 83 struct PacSource { |
| 83 enum Type { | 84 enum Type { |
| 84 WPAD_DHCP, | 85 WPAD_DHCP, |
| 85 WPAD_DNS, | 86 WPAD_DNS, |
| 86 CUSTOM | 87 CUSTOM |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 PacSource(Type type, const GURL& url) | 90 PacSource(Type type, const GURL& url) |
| 90 : type(type), url(url) {} | 91 : type(type), url(url) {} |
| 91 | 92 |
| 93 // Returns a Value representing the PacSource. |effective_pac_url| must |
| 94 // be non-NULL and point to the URL derived from information contained in |
| 95 // |this|, if Type is not WPAD_DHCP. |
| 96 base::Value* NetLogCallback(const GURL* effective_pac_url, |
| 97 NetLog::LogLevel log_level) const; |
| 98 |
| 92 Type type; | 99 Type type; |
| 93 GURL url; // Empty unless |type == PAC_SOURCE_CUSTOM|. | 100 GURL url; // Empty unless |type == PAC_SOURCE_CUSTOM|. |
| 94 }; | 101 }; |
| 95 | 102 |
| 96 typedef std::vector<PacSource> PacSourceList; | 103 typedef std::vector<PacSource> PacSourceList; |
| 97 | 104 |
| 98 enum State { | 105 enum State { |
| 99 STATE_NONE, | 106 STATE_NONE, |
| 100 STATE_WAIT, | 107 STATE_WAIT, |
| 101 STATE_WAIT_COMPLETE, | 108 STATE_WAIT_COMPLETE, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 124 // Tries restarting using the next fallback PAC URL: | 131 // Tries restarting using the next fallback PAC URL: |
| 125 // |pac_sources_[++current_pac_source_index]|. | 132 // |pac_sources_[++current_pac_source_index]|. |
| 126 // Returns OK and rewinds the state machine when there | 133 // Returns OK and rewinds the state machine when there |
| 127 // is something to try, otherwise returns |error|. | 134 // is something to try, otherwise returns |error|. |
| 128 int TryToFallbackPacSource(int error); | 135 int TryToFallbackPacSource(int error); |
| 129 | 136 |
| 130 // Gets the initial state (we skip fetching when the | 137 // Gets the initial state (we skip fetching when the |
| 131 // ProxyResolver doesn't |expect_pac_bytes()|. | 138 // ProxyResolver doesn't |expect_pac_bytes()|. |
| 132 State GetStartState() const; | 139 State GetStartState() const; |
| 133 | 140 |
| 134 NetLogStringParameter* CreateNetLogParameterAndDetermineURL( | 141 void DetermineURL(const PacSource& pac_source, GURL* effective_pac_url); |
| 135 const PacSource& pac_source, GURL* effective_pac_url); | |
| 136 | 142 |
| 137 // Returns the current PAC URL we are fetching/testing. | 143 // Returns the current PAC URL we are fetching/testing. |
| 138 const PacSource& current_pac_source() const; | 144 const PacSource& current_pac_source() const; |
| 139 | 145 |
| 140 void OnWaitTimerFired(); | 146 void OnWaitTimerFired(); |
| 141 void DidComplete(); | 147 void DidComplete(); |
| 142 void Cancel(); | 148 void Cancel(); |
| 143 | 149 |
| 144 ProxyResolver* resolver_; | 150 ProxyResolver* resolver_; |
| 145 ProxyScriptFetcher* proxy_script_fetcher_; | 151 ProxyScriptFetcher* proxy_script_fetcher_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 170 ProxyConfig effective_config_; | 176 ProxyConfig effective_config_; |
| 171 scoped_refptr<ProxyResolverScriptData> script_data_; | 177 scoped_refptr<ProxyResolverScriptData> script_data_; |
| 172 | 178 |
| 173 | 179 |
| 174 DISALLOW_COPY_AND_ASSIGN(ProxyScriptDecider); | 180 DISALLOW_COPY_AND_ASSIGN(ProxyScriptDecider); |
| 175 }; | 181 }; |
| 176 | 182 |
| 177 } // namespace net | 183 } // namespace net |
| 178 | 184 |
| 179 #endif // NET_PROXY_PROXY_SCRIPT_DECIDER_H_ | 185 #endif // NET_PROXY_PROXY_SCRIPT_DECIDER_H_ |
| OLD | NEW |