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

Unified Diff: net/proxy/mojo_proxy_resolver_impl.h

Issue 896203003: Implement utility-side proxy resolver Mojo service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@proxy-diffbase
Patch Set: fix windows compile Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/net.gypi ('k') | net/proxy/mojo_proxy_resolver_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/mojo_proxy_resolver_impl.h
diff --git a/net/proxy/mojo_proxy_resolver_impl.h b/net/proxy/mojo_proxy_resolver_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..2cbf8bbe70fba3a3bc6f372feffb446dc5136528
--- /dev/null
+++ b/net/proxy/mojo_proxy_resolver_impl.h
@@ -0,0 +1,64 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_
+#define NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_
+
+#include <queue>
+#include <set>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "net/interfaces/proxy_resolver_service.mojom.h"
+
+namespace net {
+
+class ProxyResolver;
+class ProxyResolverScriptData;
+
+class MojoProxyResolverImpl : public interfaces::ProxyResolver {
+ public:
+ explicit MojoProxyResolverImpl(scoped_ptr<net::ProxyResolver> resolver);
+
+ ~MojoProxyResolverImpl() override;
+
+ private:
+ class Job;
+
+ struct SetPacScriptRequest {
+ SetPacScriptRequest(
+ const scoped_refptr<ProxyResolverScriptData>& script_data,
+ const mojo::Callback<void(int32_t)>& callback);
+ ~SetPacScriptRequest();
+
+ // The script data for this request.
+ scoped_refptr<ProxyResolverScriptData> script_data;
+
+ // The callback to run to report the result of this request.
+ const mojo::Callback<void(int32_t)> callback;
+ };
+
+ // interfaces::ProxyResolver overrides.
+ void SetPacScript(const mojo::String& data,
+ const mojo::Callback<void(int32_t)>& callback) override;
+ void GetProxyForUrl(
+ const mojo::String& url,
+ interfaces::ProxyResolverRequestClientPtr client) override;
+
+ void DeleteJob(Job* job);
+
+ void StartSetPacScript();
+ void SetPacScriptDone(int result);
+
+ scoped_ptr<net::ProxyResolver> resolver_;
+ std::set<Job*> resolve_jobs_;
+
+ std::queue<SetPacScriptRequest> set_pac_script_requests_;
+
+ DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverImpl);
+};
+
+} // namespace net
+
+#endif // NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_
« no previous file with comments | « net/net.gypi ('k') | net/proxy/mojo_proxy_resolver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698