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 <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "net/interfaces/proxy_resolver_service.mojom.h" | 14 #include "net/interfaces/proxy_resolver_service.mojom.h" |
15 #include "net/proxy/proxy_resolver.h" | 15 #include "net/proxy/proxy_resolver.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class MojoProxyResolverImpl : public interfaces::ProxyResolver { | 19 class MojoProxyResolverImpl : public interfaces::ProxyResolver { |
20 public: | 20 public: |
21 MojoProxyResolverImpl( | 21 explicit MojoProxyResolverImpl(scoped_ptr<net::ProxyResolver> resolver); |
22 scoped_ptr<net::ProxyResolver> resolver, | |
23 const base::Callback< | |
24 void(const net::ProxyResolver::LoadStateChangedCallback&)>& | |
25 load_state_change_callback_setter); | |
26 | 22 |
27 ~MojoProxyResolverImpl() override; | 23 ~MojoProxyResolverImpl() override; |
28 | 24 |
29 private: | 25 private: |
30 class Job; | 26 class Job; |
31 | 27 |
32 // interfaces::ProxyResolver overrides. | 28 // interfaces::ProxyResolver overrides. |
33 void GetProxyForUrl( | 29 void GetProxyForUrl( |
34 const mojo::String& url, | 30 const mojo::String& url, |
35 interfaces::ProxyResolverRequestClientPtr client) override; | 31 interfaces::ProxyResolverRequestClientPtr client) override; |
36 | 32 |
37 void DeleteJob(Job* job); | 33 void DeleteJob(Job* job); |
38 | 34 |
39 // Invoked when the LoadState of a request changes. | |
40 void LoadStateChanged(net::ProxyResolver::RequestHandle handle, | |
41 LoadState load_state); | |
42 | |
43 scoped_ptr<net::ProxyResolver> resolver_; | 35 scoped_ptr<net::ProxyResolver> resolver_; |
44 std::set<Job*> resolve_jobs_; | 36 std::set<Job*> resolve_jobs_; |
45 std::map<net::ProxyResolver::RequestHandle, Job*> request_handle_to_job_; | 37 std::map<net::ProxyResolver::RequestHandle, Job*> request_handle_to_job_; |
46 | 38 |
47 DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverImpl); | 39 DISALLOW_COPY_AND_ASSIGN(MojoProxyResolverImpl); |
48 }; | 40 }; |
49 | 41 |
50 } // namespace net | 42 } // namespace net |
51 | 43 |
52 #endif // NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ | 44 #endif // NET_PROXY_MOJO_PROXY_RESOLVER_IMPL_H_ |
OLD | NEW |