| 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 CHROME_BROWSER_LOCAL_DISCOVERY_ENDPOINT_RESOLVER_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_ENDPOINT_RESOLVER_H_ |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_ENDPOINT_RESOLVER_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_ENDPOINT_RESOLVER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/common/local_discovery/service_discovery_client.h" | 13 #include "chrome/common/local_discovery/service_discovery_client.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 class HostPortPair; | 16 class HostPortPair; |
| 17 class IPAddress; |
| 17 class IPEndPoint; | 18 class IPEndPoint; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace local_discovery { | 21 namespace local_discovery { |
| 21 | 22 |
| 22 class ServiceDiscoverySharedClient; | 23 class ServiceDiscoverySharedClient; |
| 23 | 24 |
| 24 class EndpointResolver { | 25 class EndpointResolver { |
| 25 public: | 26 public: |
| 26 using ResultCallback = base::Callback<void(const net::IPEndPoint& endpoint)>; | 27 using ResultCallback = base::Callback<void(const net::IPEndPoint& endpoint)>; |
| 27 | 28 |
| 28 EndpointResolver(); | 29 EndpointResolver(); |
| 29 ~EndpointResolver(); | 30 ~EndpointResolver(); |
| 30 | 31 |
| 31 void Start(const std::string& service_name, const ResultCallback& callback); | 32 void Start(const std::string& service_name, const ResultCallback& callback); |
| 32 | 33 |
| 33 void Start(const net::HostPortPair& address, const ResultCallback& callback); | 34 void Start(const net::HostPortPair& address, const ResultCallback& callback); |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 void ServiceResolveComplete(const ResultCallback& callback, | 37 void ServiceResolveComplete(const ResultCallback& callback, |
| 37 ServiceResolver::RequestStatus result, | 38 ServiceResolver::RequestStatus result, |
| 38 const ServiceDescription& description); | 39 const ServiceDescription& description); |
| 39 | 40 |
| 40 void DomainResolveComplete(uint16 port, | 41 void DomainResolveComplete(uint16 port, |
| 41 const ResultCallback& callback, | 42 const ResultCallback& callback, |
| 42 bool success, | 43 bool success, |
| 43 const net::IPAddressNumber& address_ipv4, | 44 const net::IPAddress& address_ipv4, |
| 44 const net::IPAddressNumber& address_ipv6); | 45 const net::IPAddress& address_ipv6); |
| 45 | 46 |
| 46 private: | 47 private: |
| 47 scoped_refptr<ServiceDiscoverySharedClient> service_discovery_client_; | 48 scoped_refptr<ServiceDiscoverySharedClient> service_discovery_client_; |
| 48 scoped_ptr<ServiceResolver> service_resolver_; | 49 scoped_ptr<ServiceResolver> service_resolver_; |
| 49 scoped_ptr<LocalDomainResolver> domain_resolver_; | 50 scoped_ptr<LocalDomainResolver> domain_resolver_; |
| 50 | 51 |
| 51 DISALLOW_COPY_AND_ASSIGN(EndpointResolver); | 52 DISALLOW_COPY_AND_ASSIGN(EndpointResolver); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace local_discovery | 55 } // namespace local_discovery |
| 55 | 56 |
| 56 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_ENDPOINT_RESOLVER_H_ | 57 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_ENDPOINT_RESOLVER_H_ |
| OLD | NEW |