Update to use libbrillo Chrome proxy resolver
This uses the new proxy resolution code in libbrillo for doing proxy
resolution rather than making the D-Bus calls directly through the
generated bindings. The unittest for this class was removed since the
main function of it was removed. It now is essentially just a wrapper
around the call into libbrillo along with some minimal code for
allowing cancelling of callbacks.
BUG=chromium:771386
TEST=Unit tests pass
Change-Id: Ib0d4e413482f4bdfe0e9689f68118efbec94ec9d
Reviewed-on: https://chromium-review.googlesource.com/698964
Commit-Ready: Jeffrey Kardatzke <jkardatzke@google.com>
Tested-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/chrome_browser_proxy_resolver.h b/chrome_browser_proxy_resolver.h
index 03dbdad..fcf85b6 100644
--- a/chrome_browser_proxy_resolver.h
+++ b/chrome_browser_proxy_resolver.h
@@ -20,46 +20,29 @@
#include <deque>
#include <map>
#include <string>
+#include <vector>
#include <base/memory/weak_ptr.h>
#include "update_engine/proxy_resolver.h"
-namespace brillo {
-class Error;
-} // namespace brillo
-
-namespace org {
-namespace chromium {
-class NetworkProxyServiceInterfaceProxyInterface;
-} // namespace chromium
-} // namespace org
-
namespace chromeos_update_engine {
class ChromeBrowserProxyResolver : public ProxyResolver {
public:
- explicit ChromeBrowserProxyResolver(
- org::chromium::NetworkProxyServiceInterfaceProxyInterface* dbus_proxy);
+ ChromeBrowserProxyResolver();
~ChromeBrowserProxyResolver() override;
- // Parses a string-encoded list of proxies and returns a deque
- // of individual proxies. The last one will always be kNoProxy.
- static std::deque<std::string> ParseProxyString(const std::string& input);
-
// ProxyResolver:
ProxyRequestId GetProxiesForUrl(const std::string& url,
const ProxiesResolvedFn& callback) override;
bool CancelProxyRequest(ProxyRequestId request) override;
-private:
- // Callback for successful D-Bus calls made by GetProxiesForUrl().
- void OnResolveProxyResponse(ProxyRequestId request_id,
- const std::string& proxy_info,
- const std::string& error_message);
-
- // Callback for failed D-Bus calls made by GetProxiesForUrl().
- void OnResolveProxyError(ProxyRequestId request_id, brillo::Error* error);
+ private:
+ // Callback for calls made by GetProxiesForUrl().
+ void OnGetChromeProxyServers(ProxyRequestId request_id,
+ bool success,
+ const std::vector<std::string>& proxies);
// Finds the callback identified by |request_id| in |pending_callbacks_|,
// passes |proxies| to it, and deletes it. Does nothing if the request has
@@ -67,9 +50,6 @@
void RunCallback(ProxyRequestId request_id,
const std::deque<std::string>& proxies);
- // D-Bus proxy for resolving network proxies.
- org::chromium::NetworkProxyServiceInterfaceProxyInterface* dbus_proxy_;
-
// Next ID to return from GetProxiesForUrl().
ProxyRequestId next_request_id_;