| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ | 5 #ifndef NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ |
| 6 #define NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ | 6 #define NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> |
| 8 #include <queue> | 9 #include <queue> |
| 9 #include <set> | 10 #include <set> |
| 10 | 11 |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "net/interfaces/proxy_resolver_service.mojom.h" | 13 #include "net/interfaces/proxy_resolver_service.mojom.h" |
| 14 #include "net/proxy/proxy_resolver.h" |
| 13 | 15 |
| 14 namespace net { | 16 namespace net { |
| 15 | 17 |
| 16 class ProxyResolver; | |
| 17 | |
| 18 class MojoProxyResolverImpl : public interfaces::ProxyResolver { | 18 class MojoProxyResolverImpl : public interfaces::ProxyResolver { |
| 19 public: | 19 public: |
| 20 explicit MojoProxyResolverImpl(scoped_ptr<net::ProxyResolver> resolver); | 20 explicit MojoProxyResolverImpl(scoped_ptr<net::ProxyResolver> resolver); |
| 21 | 21 |
| 22 ~MojoProxyResolverImpl() override; | 22 ~MojoProxyResolverImpl() override; |
| 23 | 23 |
| 24 // Invoked when the LoadState of a request changes. |
| 25 void LoadStateChanged(net::ProxyResolver::RequestHandle handle, |
| 26 LoadState load_state); |
| 27 |
| 24 private: | 28 private: |
| 25 class Job; | 29 class Job; |
| 26 struct SetPacScriptRequest; | 30 struct SetPacScriptRequest; |
| 27 | 31 |
| 28 // interfaces::ProxyResolver overrides. | 32 // interfaces::ProxyResolver overrides. |
| 29 void SetPacScript(const mojo::String& data, | 33 void SetPacScript(const mojo::String& data, |
| 30 const mojo::Callback<void(int32_t)>& callback) override; | 34 const mojo::Callback<void(int32_t)>& callback) override; |
| 31 void GetProxyForUrl( | 35 void GetProxyForUrl( |
| 32 const mojo::String& url, | 36 const mojo::String& url, |
| 33 interfaces::ProxyResolverRequestClientPtr client) override; | 37 interfaces::ProxyResolverRequestClientPtr client) override; |
| 34 | 38 |
| 35 void DeleteJob(Job* job); | 39 void DeleteJob(Job* job, net::ProxyResolver::RequestHandle handle); |
| 36 | 40 |
| 37 void StartSetPacScript(); | 41 void StartSetPacScript(); |
| 38 void SetPacScriptDone(int result); | 42 void SetPacScriptDone(int result); |
| 39 | 43 |
| 40 scoped_ptr<net::ProxyResolver> resolver_; | 44 scoped_ptr<net::ProxyResolver> resolver_; |
| 41 std::set<Job*> resolve_jobs_; | 45 std::set<Job*> resolve_jobs_; |
| 46 std::map<net::ProxyResolver::RequestHandle, Job*> request_handle_to_job_; |
| 42 | 47 |
| 43 std::queue<SetPacScriptRequest> set_pac_script_requests_; | 48 std::queue<SetPacScriptRequest> set_pac_script_requests_; |
| 44 | 49 |
| 45 DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverImpl); | 50 DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverImpl); |
| 46 }; | 51 }; |
| 47 | 52 |
| 48 } // namespace net | 53 } // namespace net |
| 49 | 54 |
| 50 #endif // NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ | 55 #endif // NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ |
| OLD | NEW |