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.
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_
8 #include "chrome/browser/local_discovery/privet_http.h"
9 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h"
10 #include "chrome/common/local_discovery/service_discovery_client.h"
12 namespace local_discovery
{
14 class ServiceDiscoverySharedClient
;
16 class PrivetHTTPAsynchronousFactoryImpl
: public PrivetHTTPAsynchronousFactory
{
18 explicit PrivetHTTPAsynchronousFactoryImpl(
19 net::URLRequestContextGetter
* request_context
);
20 ~PrivetHTTPAsynchronousFactoryImpl() override
;
22 scoped_ptr
<PrivetHTTPResolution
> CreatePrivetHTTP(
23 const std::string
& service_name
) override
;
26 class ResolutionImpl
: public PrivetHTTPResolution
{
28 ResolutionImpl(const std::string
& service_name
,
29 net::URLRequestContextGetter
* request_context
);
30 ~ResolutionImpl() override
;
32 void Start(const ResultCallback
& callback
) override
;
34 void Start(const net::HostPortPair
& address
,
35 const ResultCallback
& callback
) override
;
37 const std::string
& GetName() override
;
40 void ServiceResolveComplete(const ResultCallback
& callback
,
41 ServiceResolver::RequestStatus result
,
42 const ServiceDescription
& description
);
44 void DomainResolveComplete(uint16 port
,
45 const ResultCallback
& callback
,
47 const net::IPAddressNumber
& address_ipv4
,
48 const net::IPAddressNumber
& address_ipv6
);
51 scoped_refptr
<net::URLRequestContextGetter
> request_context_
;
52 scoped_refptr
<ServiceDiscoverySharedClient
> service_discovery_client_
;
53 scoped_ptr
<ServiceResolver
> service_resolver_
;
54 scoped_ptr
<LocalDomainResolver
> domain_resolver_
;
57 scoped_refptr
<net::URLRequestContextGetter
> request_context_
;
60 } // namespace local_discovery
62 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_ASYNCHRONOUS_FACTORY_IMPL_H_