OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_ | |
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "chrome/browser/local_discovery/privet_http.h" | |
10 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" | |
11 | |
12 namespace local_discovery { | |
13 | |
14 class EndpointResolver; | |
15 | |
16 class PrivetHTTPAsynchronousFactoryImpl : public PrivetHTTPAsynchronousFactory { | |
17 public: | |
18 explicit PrivetHTTPAsynchronousFactoryImpl( | |
19 net::URLRequestContextGetter* request_context); | |
20 ~PrivetHTTPAsynchronousFactoryImpl() override; | |
21 | |
22 scoped_ptr<PrivetHTTPResolution> CreatePrivetHTTP( | |
23 const std::string& service_name) override; | |
24 | |
25 private: | |
26 class ResolutionImpl : public PrivetHTTPResolution { | |
27 public: | |
28 ResolutionImpl(const std::string& service_name, | |
29 net::URLRequestContextGetter* request_context); | |
30 ~ResolutionImpl() override; | |
31 | |
32 void Start(const ResultCallback& callback) override; | |
33 | |
34 void Start(const net::HostPortPair& address, | |
35 const ResultCallback& callback) override; | |
36 | |
37 const std::string& GetName() override; | |
38 | |
39 private: | |
40 void ResolveComplete(const ResultCallback& callback, | |
41 const net::IPEndPoint& endpoint); | |
42 std::string name_; | |
43 scoped_refptr<net::URLRequestContextGetter> request_context_; | |
44 scoped_ptr<EndpointResolver> endpoint_resolver_; | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(ResolutionImpl); | |
47 }; | |
48 | |
49 scoped_refptr<net::URLRequestContextGetter> request_context_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(PrivetHTTPAsynchronousFactoryImpl); | |
52 }; | |
53 | |
54 } // namespace local_discovery | |
55 | |
56 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_
H_ | |
OLD | NEW |