OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_ |
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_ |
7 | 7 |
8 #include "chrome/browser/local_discovery/privet_http.h" | 8 #include "chrome/browser/local_discovery/privet_http.h" |
9 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" | 9 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" |
10 #include "chrome/common/local_discovery/service_discovery_client.h" | 10 #include "chrome/common/local_discovery/service_discovery_client.h" |
11 | 11 |
12 namespace local_discovery { | 12 namespace local_discovery { |
13 | 13 |
14 class ServiceDiscoverySharedClient; | 14 class ServiceDiscoverySharedClient; |
15 | 15 |
16 class PrivetHTTPAsynchronousFactoryImpl : public PrivetHTTPAsynchronousFactory { | 16 class PrivetHTTPAsynchronousFactoryImpl : public PrivetHTTPAsynchronousFactory { |
17 public: | 17 public: |
18 explicit PrivetHTTPAsynchronousFactoryImpl( | 18 explicit PrivetHTTPAsynchronousFactoryImpl( |
19 net::URLRequestContextGetter* request_context); | 19 net::URLRequestContextGetter* request_context); |
20 ~PrivetHTTPAsynchronousFactoryImpl() override; | 20 ~PrivetHTTPAsynchronousFactoryImpl() override; |
21 | 21 |
22 scoped_ptr<PrivetHTTPResolution> CreatePrivetHTTP( | 22 scoped_ptr<PrivetHTTPResolution> CreatePrivetHTTP( |
23 const std::string& name, | 23 const std::string& service_name) override; |
24 const net::HostPortPair& address, | |
25 const ResultCallback& callback) override; | |
26 | 24 |
27 private: | 25 private: |
28 class ResolutionImpl : public PrivetHTTPResolution { | 26 class ResolutionImpl : public PrivetHTTPResolution { |
29 public: | 27 public: |
30 ResolutionImpl(const std::string& name, | 28 ResolutionImpl(const std::string& service_name, |
31 const net::HostPortPair& address, | |
32 const ResultCallback& callback, | |
33 net::URLRequestContextGetter* request_context); | 29 net::URLRequestContextGetter* request_context); |
34 ~ResolutionImpl() override; | 30 ~ResolutionImpl() override; |
35 | 31 |
36 void Start() override; | 32 void Start(const net::HostPortPair& address, |
| 33 const ResultCallback& callback) override; |
| 34 |
37 const std::string& GetName() override; | 35 const std::string& GetName() override; |
38 | 36 |
39 private: | 37 private: |
40 void ResolveComplete(bool success, | 38 void DomainResolveComplete(uint16 port, |
41 const net::IPAddressNumber& address_ipv4, | 39 const ResultCallback& callback, |
42 const net::IPAddressNumber& address_ipv6); | 40 bool success, |
| 41 const net::IPAddressNumber& address_ipv4, |
| 42 const net::IPAddressNumber& address_ipv6); |
43 | 43 |
44 std::string name_; | 44 std::string name_; |
45 scoped_ptr<LocalDomainResolver> resolver_; | |
46 net::HostPortPair hostport_; | |
47 ResultCallback callback_; | |
48 scoped_refptr<net::URLRequestContextGetter> request_context_; | 45 scoped_refptr<net::URLRequestContextGetter> request_context_; |
49 scoped_refptr<ServiceDiscoverySharedClient> service_discovery_client_; | 46 scoped_refptr<ServiceDiscoverySharedClient> service_discovery_client_; |
| 47 scoped_ptr<LocalDomainResolver> domain_resolver_; |
50 }; | 48 }; |
51 | 49 |
52 scoped_refptr<net::URLRequestContextGetter> request_context_; | 50 scoped_refptr<net::URLRequestContextGetter> request_context_; |
53 }; | 51 }; |
54 | 52 |
55 } // namespace local_discovery | 53 } // namespace local_discovery |
56 | 54 |
57 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_
H_ | 55 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_
H_ |
OLD | NEW |