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 "base/macros.h" |
8 #include "chrome/browser/local_discovery/privet_http.h" | 9 #include "chrome/browser/local_discovery/privet_http.h" |
9 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" | 10 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.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 EndpointResolver; |
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& service_name) override; | 23 const std::string& service_name) override; |
24 | 24 |
25 private: | 25 private: |
26 class ResolutionImpl : public PrivetHTTPResolution { | 26 class ResolutionImpl : public PrivetHTTPResolution { |
27 public: | 27 public: |
28 ResolutionImpl(const std::string& service_name, | 28 ResolutionImpl(const std::string& service_name, |
29 net::URLRequestContextGetter* request_context); | 29 net::URLRequestContextGetter* request_context); |
30 ~ResolutionImpl() override; | 30 ~ResolutionImpl() override; |
31 | 31 |
32 void Start(const ResultCallback& callback) override; | 32 void Start(const ResultCallback& callback) override; |
33 | 33 |
34 void Start(const net::HostPortPair& address, | 34 void Start(const net::HostPortPair& address, |
35 const ResultCallback& callback) override; | 35 const ResultCallback& callback) override; |
36 | 36 |
37 const std::string& GetName() override; | 37 const std::string& GetName() override; |
38 | 38 |
39 private: | 39 private: |
40 void ServiceResolveComplete(const ResultCallback& callback, | 40 void ResolveComplete(const ResultCallback& callback, |
41 ServiceResolver::RequestStatus result, | 41 const net::IPEndPoint& endpoint); |
42 const ServiceDescription& description); | |
43 | |
44 void DomainResolveComplete(uint16 port, | |
45 const ResultCallback& callback, | |
46 bool success, | |
47 const net::IPAddressNumber& address_ipv4, | |
48 const net::IPAddressNumber& address_ipv6); | |
49 | |
50 std::string name_; | 42 std::string name_; |
51 scoped_refptr<net::URLRequestContextGetter> request_context_; | 43 scoped_refptr<net::URLRequestContextGetter> request_context_; |
52 scoped_refptr<ServiceDiscoverySharedClient> service_discovery_client_; | 44 scoped_ptr<EndpointResolver> endpoint_resolver_; |
53 scoped_ptr<ServiceResolver> service_resolver_; | 45 |
54 scoped_ptr<LocalDomainResolver> domain_resolver_; | 46 DISALLOW_COPY_AND_ASSIGN(ResolutionImpl); |
55 }; | 47 }; |
56 | 48 |
57 scoped_refptr<net::URLRequestContextGetter> request_context_; | 49 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(PrivetHTTPAsynchronousFactoryImpl); |
58 }; | 52 }; |
59 | 53 |
60 } // namespace local_discovery | 54 } // namespace local_discovery |
61 | 55 |
62 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_
H_ | 56 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_
H_ |
OLD | NEW |