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

Side by Side Diff: net/proxy/proxy_resolver_winhttp.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, 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
« no previous file with comments | « net/proxy/proxy_resolver_v8_tracing.cc ('k') | net/proxy/proxy_service.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) 2011 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 #include "net/proxy/proxy_resolver_winhttp.h" 5 #include "net/proxy/proxy_resolver_winhttp.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <winhttp.h> 8 #include <winhttp.h>
9 9
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 28 matching lines...) Expand all
39 // ProxyResolver implementation: 39 // ProxyResolver implementation:
40 int GetProxyForURL(const GURL& url, 40 int GetProxyForURL(const GURL& url,
41 ProxyInfo* results, 41 ProxyInfo* results,
42 const CompletionCallback& /*callback*/, 42 const CompletionCallback& /*callback*/,
43 RequestHandle* /*request*/, 43 RequestHandle* /*request*/,
44 const BoundNetLog& /*net_log*/) override; 44 const BoundNetLog& /*net_log*/) override;
45 void CancelRequest(RequestHandle request) override; 45 void CancelRequest(RequestHandle request) override;
46 46
47 LoadState GetLoadState(RequestHandle request) const override; 47 LoadState GetLoadState(RequestHandle request) const override;
48 48
49 void CancelSetPacScript() override;
50
51 int SetPacScript(const scoped_refptr<ProxyResolverScriptData>& script_data,
52 const CompletionCallback& /*callback*/) override;
53
54 private: 49 private:
55 bool OpenWinHttpSession(); 50 bool OpenWinHttpSession();
56 void CloseWinHttpSession(); 51 void CloseWinHttpSession();
57 52
58 // Proxy configuration is cached on the session handle. 53 // Proxy configuration is cached on the session handle.
59 HINTERNET session_handle_; 54 HINTERNET session_handle_;
60 55
61 const GURL pac_url_; 56 const GURL pac_url_;
62 57
63 DISALLOW_COPY_AND_ASSIGN(ProxyResolverWinHttp); 58 DISALLOW_COPY_AND_ASSIGN(ProxyResolverWinHttp);
64 }; 59 };
65 60
66 ProxyResolverWinHttp::ProxyResolverWinHttp( 61 ProxyResolverWinHttp::ProxyResolverWinHttp(
67 const scoped_refptr<ProxyResolverScriptData>& script_data) 62 const scoped_refptr<ProxyResolverScriptData>& script_data)
68 : ProxyResolver(false /*expects_pac_bytes*/), 63 : session_handle_(NULL),
69 session_handle_(NULL),
70 pac_url_(script_data->type() == ProxyResolverScriptData::TYPE_AUTO_DETECT 64 pac_url_(script_data->type() == ProxyResolverScriptData::TYPE_AUTO_DETECT
71 ? GURL("http://wpad/wpad.dat") 65 ? GURL("http://wpad/wpad.dat")
72 : script_data->url()) { 66 : script_data->url()) {
73 } 67 }
74 68
75 ProxyResolverWinHttp::~ProxyResolverWinHttp() { 69 ProxyResolverWinHttp::~ProxyResolverWinHttp() {
76 CloseWinHttpSession(); 70 CloseWinHttpSession();
77 } 71 }
78 72
79 int ProxyResolverWinHttp::GetProxyForURL(const GURL& query_url, 73 int ProxyResolverWinHttp::GetProxyForURL(const GURL& query_url,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void ProxyResolverWinHttp::CancelRequest(RequestHandle request) { 156 void ProxyResolverWinHttp::CancelRequest(RequestHandle request) {
163 // This is a synchronous ProxyResolver; no possibility for async requests. 157 // This is a synchronous ProxyResolver; no possibility for async requests.
164 NOTREACHED(); 158 NOTREACHED();
165 } 159 }
166 160
167 LoadState ProxyResolverWinHttp::GetLoadState(RequestHandle request) const { 161 LoadState ProxyResolverWinHttp::GetLoadState(RequestHandle request) const {
168 NOTREACHED(); 162 NOTREACHED();
169 return LOAD_STATE_IDLE; 163 return LOAD_STATE_IDLE;
170 } 164 }
171 165
172 void ProxyResolverWinHttp::CancelSetPacScript() {
173 NOTREACHED();
174 }
175
176 int ProxyResolverWinHttp::SetPacScript(
177 const scoped_refptr<ProxyResolverScriptData>& script_data,
178 const CompletionCallback& /*callback*/) {
179 NOTREACHED();
180 return ERR_NOT_IMPLEMENTED;
181 }
182
183 bool ProxyResolverWinHttp::OpenWinHttpSession() { 166 bool ProxyResolverWinHttp::OpenWinHttpSession() {
184 DCHECK(!session_handle_); 167 DCHECK(!session_handle_);
185 session_handle_ = WinHttpOpen(NULL, 168 session_handle_ = WinHttpOpen(NULL,
186 WINHTTP_ACCESS_TYPE_NO_PROXY, 169 WINHTTP_ACCESS_TYPE_NO_PROXY,
187 WINHTTP_NO_PROXY_NAME, 170 WINHTTP_NO_PROXY_NAME,
188 WINHTTP_NO_PROXY_BYPASS, 171 WINHTTP_NO_PROXY_BYPASS,
189 0); 172 0);
190 if (!session_handle_) 173 if (!session_handle_)
191 return false; 174 return false;
192 175
(...skipping 23 matching lines...) Expand all
216 int ProxyResolverFactoryWinHttp::CreateProxyResolver( 199 int ProxyResolverFactoryWinHttp::CreateProxyResolver(
217 const scoped_refptr<ProxyResolverScriptData>& pac_script, 200 const scoped_refptr<ProxyResolverScriptData>& pac_script,
218 scoped_ptr<ProxyResolver>* resolver, 201 scoped_ptr<ProxyResolver>* resolver,
219 const CompletionCallback& callback, 202 const CompletionCallback& callback,
220 scoped_ptr<Request>* request) { 203 scoped_ptr<Request>* request) {
221 resolver->reset(new ProxyResolverWinHttp(pac_script)); 204 resolver->reset(new ProxyResolverWinHttp(pac_script));
222 return OK; 205 return OK;
223 } 206 }
224 207
225 } // namespace net 208 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_resolver_v8_tracing.cc ('k') | net/proxy/proxy_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698