OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 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_MOJO_PROXY_RESOLVER_IMPL_H_ |
| 6 #define NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ |
| 7 |
| 8 #include <queue> |
| 9 #include <set> |
| 10 |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "net/interfaces/proxy_resolver_service.mojom.h" |
| 14 |
| 15 namespace net { |
| 16 |
| 17 class ProxyResolver; |
| 18 class ProxyResolverScriptData; |
| 19 |
| 20 class MojoProxyResolverImpl : public interfaces::ProxyResolver { |
| 21 public: |
| 22 explicit MojoProxyResolverImpl(scoped_ptr<net::ProxyResolver> resolver); |
| 23 |
| 24 ~MojoProxyResolverImpl() override; |
| 25 |
| 26 private: |
| 27 class Job; |
| 28 |
| 29 struct SetPacScriptRequest { |
| 30 SetPacScriptRequest( |
| 31 const scoped_refptr<ProxyResolverScriptData>& script_data, |
| 32 const mojo::Callback<void(int32_t)>& callback); |
| 33 ~SetPacScriptRequest(); |
| 34 |
| 35 // The script data for this request. |
| 36 scoped_refptr<ProxyResolverScriptData> script_data; |
| 37 |
| 38 // The callback to run to report the result of this request. |
| 39 const mojo::Callback<void(int32_t)> callback; |
| 40 }; |
| 41 |
| 42 // interfaces::ProxyResolver overrides. |
| 43 void SetPacScript(const mojo::String& data, |
| 44 const mojo::Callback<void(int32_t)>& callback) override; |
| 45 void GetProxyForUrl( |
| 46 const mojo::String& url, |
| 47 interfaces::ProxyResolverRequestClientPtr client) override; |
| 48 |
| 49 void DeleteJob(Job* job); |
| 50 |
| 51 void StartSetPacScript(); |
| 52 void SetPacScriptDone(int result); |
| 53 |
| 54 scoped_ptr<net::ProxyResolver> resolver_; |
| 55 std::set<Job*> resolve_jobs_; |
| 56 |
| 57 std::queue<SetPacScriptRequest> set_pac_script_requests_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverImpl); |
| 60 }; |
| 61 |
| 62 } // namespace net |
| 63 |
| 64 #endif // NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ |
OLD | NEW |