forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprivet_http_asynchronous_factory_impl.h
57 lines (45 loc) · 2.08 KB
/
privet_http_asynchronous_factory_impl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_
#define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_
#include "chrome/browser/local_discovery/privet_http.h"
#include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h"
#include "chrome/common/local_discovery/service_discovery_client.h"
namespace local_discovery {
class PrivetHTTPAsynchronousFactoryImpl : public PrivetHTTPAsynchronousFactory {
public:
PrivetHTTPAsynchronousFactoryImpl(
ServiceDiscoveryClient* service_discovery_client,
net::URLRequestContextGetter* request_context);
virtual ~PrivetHTTPAsynchronousFactoryImpl();
virtual scoped_ptr<PrivetHTTPResolution> CreatePrivetHTTP(
const std::string& name,
const net::HostPortPair& address,
const ResultCallback& callback) override;
private:
class ResolutionImpl : public PrivetHTTPResolution {
public:
ResolutionImpl(const std::string& name,
const net::HostPortPair& address,
const ResultCallback& callback,
ServiceDiscoveryClient* service_discovery_client,
net::URLRequestContextGetter* request_context);
virtual ~ResolutionImpl();
virtual void Start() override;
virtual const std::string& GetName() override;
private:
void ResolveComplete(bool success,
const net::IPAddressNumber& address_ipv4,
const net::IPAddressNumber& address_ipv6);
std::string name_;
scoped_ptr<LocalDomainResolver> resolver_;
net::HostPortPair hostport_;
ResultCallback callback_;
scoped_refptr<net::URLRequestContextGetter> request_context_;
};
ServiceDiscoveryClient* service_discovery_client_;
scoped_refptr<net::URLRequestContextGetter> request_context_;
};
} // namespace local_discovery
#endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_