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

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

Issue 1157163003: Remove ProxyResolver::(Cancel)SetPacScript and LegacyProxyResolverFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-proxy-resolver-refactor
Patch Set: Created 5 years, 6 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
« no previous file with comments | « net/proxy/proxy_resolver_winhttp.cc ('k') | net/proxy/proxy_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_service.h" 5 #include "net/proxy/proxy_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override { 168 ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override {
169 *config = ProxyConfig::CreateDirect(); 169 *config = ProxyConfig::CreateDirect();
170 config->set_source(PROXY_CONFIG_SOURCE_UNKNOWN); 170 config->set_source(PROXY_CONFIG_SOURCE_UNKNOWN);
171 return CONFIG_VALID; 171 return CONFIG_VALID;
172 } 172 }
173 }; 173 };
174 174
175 // Proxy resolver that fails every time. 175 // Proxy resolver that fails every time.
176 class ProxyResolverNull : public ProxyResolver { 176 class ProxyResolverNull : public ProxyResolver {
177 public: 177 public:
178 ProxyResolverNull() : ProxyResolver(false /*expects_pac_bytes*/) {} 178 ProxyResolverNull() {}
179 179
180 // ProxyResolver implementation. 180 // ProxyResolver implementation.
181 int GetProxyForURL(const GURL& url, 181 int GetProxyForURL(const GURL& url,
182 ProxyInfo* results, 182 ProxyInfo* results,
183 const CompletionCallback& callback, 183 const CompletionCallback& callback,
184 RequestHandle* request, 184 RequestHandle* request,
185 const BoundNetLog& net_log) override { 185 const BoundNetLog& net_log) override {
186 return ERR_NOT_IMPLEMENTED; 186 return ERR_NOT_IMPLEMENTED;
187 } 187 }
188 188
189 void CancelRequest(RequestHandle request) override { NOTREACHED(); } 189 void CancelRequest(RequestHandle request) override { NOTREACHED(); }
190 190
191 LoadState GetLoadState(RequestHandle request) const override { 191 LoadState GetLoadState(RequestHandle request) const override {
192 NOTREACHED(); 192 NOTREACHED();
193 return LOAD_STATE_IDLE; 193 return LOAD_STATE_IDLE;
194 } 194 }
195 195
196 void CancelSetPacScript() override { NOTREACHED(); }
197
198 int SetPacScript(
199 const scoped_refptr<ProxyResolverScriptData>& /*script_data*/,
200 const CompletionCallback& /*callback*/) override {
201 return ERR_NOT_IMPLEMENTED;
202 }
203 }; 196 };
204 197
205 // ProxyResolver that simulates a PAC script which returns 198 // ProxyResolver that simulates a PAC script which returns
206 // |pac_string| for every single URL. 199 // |pac_string| for every single URL.
207 class ProxyResolverFromPacString : public ProxyResolver { 200 class ProxyResolverFromPacString : public ProxyResolver {
208 public: 201 public:
209 explicit ProxyResolverFromPacString(const std::string& pac_string) 202 explicit ProxyResolverFromPacString(const std::string& pac_string)
210 : ProxyResolver(false /*expects_pac_bytes*/), 203 : pac_string_(pac_string) {}
211 pac_string_(pac_string) {}
212 204
213 int GetProxyForURL(const GURL& url, 205 int GetProxyForURL(const GURL& url,
214 ProxyInfo* results, 206 ProxyInfo* results,
215 const CompletionCallback& callback, 207 const CompletionCallback& callback,
216 RequestHandle* request, 208 RequestHandle* request,
217 const BoundNetLog& net_log) override { 209 const BoundNetLog& net_log) override {
218 results->UsePacString(pac_string_); 210 results->UsePacString(pac_string_);
219 return OK; 211 return OK;
220 } 212 }
221 213
222 void CancelRequest(RequestHandle request) override { NOTREACHED(); } 214 void CancelRequest(RequestHandle request) override { NOTREACHED(); }
223 215
224 LoadState GetLoadState(RequestHandle request) const override { 216 LoadState GetLoadState(RequestHandle request) const override {
225 NOTREACHED(); 217 NOTREACHED();
226 return LOAD_STATE_IDLE; 218 return LOAD_STATE_IDLE;
227 } 219 }
228 220
229 void CancelSetPacScript() override { NOTREACHED(); }
230
231 int SetPacScript(const scoped_refptr<ProxyResolverScriptData>& pac_script,
232 const CompletionCallback& callback) override {
233 return OK;
234 }
235
236 private: 221 private:
237 const std::string pac_string_; 222 const std::string pac_string_;
238 }; 223 };
239 224
240 // Creates ProxyResolvers using a platform-specific implementation. 225 // Creates ProxyResolvers using a platform-specific implementation.
241 class ProxyResolverFactoryForSystem : public MultiThreadedProxyResolverFactory { 226 class ProxyResolverFactoryForSystem : public MultiThreadedProxyResolverFactory {
242 public: 227 public:
243 explicit ProxyResolverFactoryForSystem(size_t max_num_threads) 228 explicit ProxyResolverFactoryForSystem(size_t max_num_threads)
244 : MultiThreadedProxyResolverFactory(max_num_threads, 229 : MultiThreadedProxyResolverFactory(max_num_threads,
245 false /*expects_pac_bytes*/) {} 230 false /*expects_pac_bytes*/) {}
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 State previous_state = ResetProxyConfig(false); 1642 State previous_state = ResetProxyConfig(false);
1658 if (previous_state != STATE_NONE) 1643 if (previous_state != STATE_NONE)
1659 ApplyProxyConfigIfAvailable(); 1644 ApplyProxyConfigIfAvailable();
1660 } 1645 }
1661 1646
1662 void ProxyService::OnDNSChanged() { 1647 void ProxyService::OnDNSChanged() {
1663 OnIPAddressChanged(); 1648 OnIPAddressChanged();
1664 } 1649 }
1665 1650
1666 } // namespace net 1651 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_resolver_winhttp.cc ('k') | net/proxy/proxy_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698