1 // Copyright 2021 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_PROXY_RESOLUTION_WIN_WINDOWS_SYSTEM_PROXY_RESOLVER_H_ 6 #define NET_PROXY_RESOLUTION_WIN_WINDOWS_SYSTEM_PROXY_RESOLVER_H_ 7 8 #include <memory> 9 #include <string> 10 11 #include "net/base/net_export.h" 12 13 class GURL; 14 15 namespace net { 16 17 class WindowsSystemProxyResolutionRequest; 18 19 // This is used to communicate with a utility process that resolves a proxy 20 // using WinHttp APIs. These APIs must be called in a separate process because 21 // they will not be allowed in the network service when the sandbox gets locked 22 // down. This interface is intended to be used via the 23 // WindowsSystemProxyResolutionRequest, which manages individual proxy 24 // resolutions. 25 class NET_EXPORT WindowsSystemProxyResolver { 26 public: 27 // A handle to a cross-process proxy resolution request. Deleting it will 28 // cancel the request. 29 class Request { 30 public: 31 virtual ~Request() = default; 32 }; 33 34 WindowsSystemProxyResolver() = default; 35 WindowsSystemProxyResolver(const WindowsSystemProxyResolver&) = delete; 36 WindowsSystemProxyResolver& operator=(const WindowsSystemProxyResolver&) = 37 delete; 38 virtual ~WindowsSystemProxyResolver() = default; 39 40 // Asynchronously finds a proxy for `url`. The `callback_target` must outlive 41 // `this`. 42 virtual std::unique_ptr<Request> GetProxyForUrl( 43 const GURL& url, 44 WindowsSystemProxyResolutionRequest* callback_target) = 0; 45 }; 46 47 } // namespace net 48 49 #endif // NET_PROXY_RESOLUTION_WIN_WINDOWS_SYSTEM_PROXY_RESOLVER_H_ 50