| 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/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "net/interfaces/proxy_resolver_service.mojom.h" | 14 #include "net/interfaces/proxy_resolver_service.mojom.h" |
| 15 #include "net/proxy/proxy_resolver.h" |
| 14 | 16 |
| 15 namespace net { | 17 namespace net { |
| 16 | 18 |
| 17 class ProxyResolver; | |
| 18 class ProxyResolverScriptData; | |
| 19 | |
| 20 class MojoProxyResolverImpl : public interfaces::ProxyResolver { | 19 class MojoProxyResolverImpl : public interfaces::ProxyResolver { |
| 21 public: | 20 public: |
| 22 explicit MojoProxyResolverImpl(scoped_ptr<net::ProxyResolver> resolver); | 21 explicit MojoProxyResolverImpl(scoped_ptr<net::ProxyResolver> resolver); |
| 23 | 22 |
| 24 ~MojoProxyResolverImpl() override; | 23 ~MojoProxyResolverImpl() override; |
| 25 | 24 |
| 25 // Invoked when the LoadState of a request changes. |
| 26 void LoadStateChanged(net::ProxyResolver::RequestHandle handle, |
| 27 LoadState load_state); |
| 28 |
| 26 private: | 29 private: |
| 27 class Job; | 30 class Job; |
| 28 | 31 |
| 29 struct SetPacScriptRequest { | 32 struct SetPacScriptRequest { |
| 30 SetPacScriptRequest( | 33 SetPacScriptRequest( |
| 31 const scoped_refptr<ProxyResolverScriptData>& script_data, | 34 const scoped_refptr<ProxyResolverScriptData>& script_data, |
| 32 const mojo::Callback<void(int32_t)>& callback); | 35 const mojo::Callback<void(int32_t)>& callback); |
| 33 ~SetPacScriptRequest(); | 36 ~SetPacScriptRequest(); |
| 34 | 37 |
| 35 // The script data for this request. | 38 // The script data for this request. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 46 const mojo::String& url, | 49 const mojo::String& url, |
| 47 interfaces::ProxyResolverRequestClientPtr client) override; | 50 interfaces::ProxyResolverRequestClientPtr client) override; |
| 48 | 51 |
| 49 void DeleteJob(Job* job); | 52 void DeleteJob(Job* job); |
| 50 | 53 |
| 51 void StartSetPacScript(); | 54 void StartSetPacScript(); |
| 52 void SetPacScriptDone(int result); | 55 void SetPacScriptDone(int result); |
| 53 | 56 |
| 54 scoped_ptr<net::ProxyResolver> resolver_; | 57 scoped_ptr<net::ProxyResolver> resolver_; |
| 55 std::set<Job*> resolve_jobs_; | 58 std::set<Job*> resolve_jobs_; |
| 59 std::map<net::ProxyResolver::RequestHandle, Job*> request_handle_to_job_; |
| 56 | 60 |
| 57 std::queue<SetPacScriptRequest> set_pac_script_requests_; | 61 std::queue<SetPacScriptRequest> set_pac_script_requests_; |
| 58 | 62 |
| 59 DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverImpl); | 63 DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverImpl); |
| 60 }; | 64 }; |
| 61 | 65 |
| 62 } // namespace net | 66 } // namespace net |
| 63 | 67 |
| 64 #endif // NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ | 68 #endif // NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ |
| OLD | NEW |