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 PrivetHTTPAsynchronousFactoryImpl : public PrivetHTTPAsynchronousFactory { | 14 class PrivetHTTPAsynchronousFactoryImpl : public PrivetHTTPAsynchronousFactory { |
15 public: | 15 public: |
16 PrivetHTTPAsynchronousFactoryImpl( | 16 PrivetHTTPAsynchronousFactoryImpl( |
17 ServiceDiscoveryClient* service_discovery_client, | 17 ServiceDiscoveryClient* service_discovery_client, |
18 net::URLRequestContextGetter* request_context); | 18 net::URLRequestContextGetter* request_context); |
19 virtual ~PrivetHTTPAsynchronousFactoryImpl(); | 19 virtual ~PrivetHTTPAsynchronousFactoryImpl(); |
20 | 20 |
21 virtual scoped_ptr<PrivetHTTPResolution> CreatePrivetHTTP( | 21 virtual scoped_ptr<PrivetHTTPResolution> CreatePrivetHTTP( |
22 const std::string& name, | 22 const std::string& name, |
23 const net::HostPortPair& address, | 23 const net::HostPortPair& address, |
24 const ResultCallback& callback) OVERRIDE; | 24 const ResultCallback& callback) override; |
25 | 25 |
26 private: | 26 private: |
27 class ResolutionImpl : public PrivetHTTPResolution { | 27 class ResolutionImpl : public PrivetHTTPResolution { |
28 public: | 28 public: |
29 ResolutionImpl(const std::string& name, | 29 ResolutionImpl(const std::string& name, |
30 const net::HostPortPair& address, | 30 const net::HostPortPair& address, |
31 const ResultCallback& callback, | 31 const ResultCallback& callback, |
32 ServiceDiscoveryClient* service_discovery_client, | 32 ServiceDiscoveryClient* service_discovery_client, |
33 net::URLRequestContextGetter* request_context); | 33 net::URLRequestContextGetter* request_context); |
34 virtual ~ResolutionImpl(); | 34 virtual ~ResolutionImpl(); |
35 | 35 |
36 virtual void Start() OVERRIDE; | 36 virtual void Start() override; |
37 virtual const std::string& GetName() OVERRIDE; | 37 virtual const std::string& GetName() override; |
38 | 38 |
39 private: | 39 private: |
40 void ResolveComplete(bool success, | 40 void ResolveComplete(bool success, |
41 const net::IPAddressNumber& address_ipv4, | 41 const net::IPAddressNumber& address_ipv4, |
42 const net::IPAddressNumber& address_ipv6); | 42 const net::IPAddressNumber& address_ipv6); |
43 | 43 |
44 std::string name_; | 44 std::string name_; |
45 scoped_ptr<LocalDomainResolver> resolver_; | 45 scoped_ptr<LocalDomainResolver> resolver_; |
46 net::HostPortPair hostport_; | 46 net::HostPortPair hostport_; |
47 ResultCallback callback_; | 47 ResultCallback callback_; |
48 scoped_refptr<net::URLRequestContextGetter> request_context_; | 48 scoped_refptr<net::URLRequestContextGetter> request_context_; |
49 }; | 49 }; |
50 | 50 |
51 ServiceDiscoveryClient* service_discovery_client_; | 51 ServiceDiscoveryClient* service_discovery_client_; |
52 scoped_refptr<net::URLRequestContextGetter> request_context_; | 52 scoped_refptr<net::URLRequestContextGetter> request_context_; |
53 }; | 53 }; |
54 | 54 |
55 } // namespace local_discovery | 55 } // namespace local_discovery |
56 | 56 |
57 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_
H_ | 57 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_
H_ |
OLD | NEW |