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_DEVICE_RESOLVER_H_
6#define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_DEVICE_RESOLVER_H_
7
8#include <string>
9
10#include "base/callback.h"
11#include "chrome/browser/local_discovery/device_description.h"
12#include "chrome/common/local_discovery/service_discovery_client.h"
13
14namespace local_discovery {
15
16class PrivetDeviceResolver {
17 public:
18  typedef base::Callback<void(bool /*success*/,
19                              const DeviceDescription& /*description*/)>
20      ResultCallback;
21
22  PrivetDeviceResolver(
23      ServiceDiscoveryClient* service_discovery_client,
24      const std::string& service_name,
25      const ResultCallback& callback);
26  ~PrivetDeviceResolver();
27
28  void Start();
29
30 private:
31  void OnServiceResolved(
32      ServiceResolver::RequestStatus request_status,
33      const ServiceDescription& service_description);
34
35
36  ServiceDiscoveryClient* service_discovery_client_;
37  scoped_ptr<ServiceResolver> service_resolver_;
38  std::string service_name_;
39  ResultCallback callback_;
40};
41
42}  // namespace local_discovery
43
44#endif  // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_DEVICE_RESOLVER_H_
45