OLD | NEW |
| (Empty) |
1 // Copyright 2013 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_EXTENSIONS_API_MDNS_DNS_SD_DEVICE_LISTER_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_DEVICE_LISTER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #include "chrome/browser/extensions/api/mdns/dns_sd_delegate.h" | |
12 #include "chrome/browser/local_discovery/service_discovery_device_lister.h" | |
13 | |
14 namespace local_discovery { | |
15 class ServiceDiscoveryClient; | |
16 } // local_discovery | |
17 | |
18 namespace extensions { | |
19 | |
20 // Manages a watcher for a specific MDNS/DNS-SD service type and notifies | |
21 // a delegate of changes to watched services. | |
22 class DnsSdDeviceLister | |
23 : public local_discovery::ServiceDiscoveryDeviceLister::Delegate { | |
24 public: | |
25 DnsSdDeviceLister( | |
26 local_discovery::ServiceDiscoveryClient* service_discovery_client, | |
27 DnsSdDelegate* delegate, | |
28 const std::string& service_type); | |
29 virtual ~DnsSdDeviceLister(); | |
30 | |
31 virtual void Discover(bool force_update); | |
32 | |
33 protected: | |
34 void OnDeviceChanged( | |
35 bool added, | |
36 const local_discovery::ServiceDescription& service_description) override; | |
37 void OnDeviceRemoved(const std::string& service_name) override; | |
38 void OnDeviceCacheFlushed() override; | |
39 | |
40 private: | |
41 // The delegate to notify of changes to services. | |
42 DnsSdDelegate* const delegate_; | |
43 local_discovery::ServiceDiscoveryDeviceLister device_lister_; | |
44 bool started_; | |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(DnsSdDeviceLister); | |
47 }; | |
48 | |
49 } // namespace extensions | |
50 | |
51 #endif // CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_DEVICE_LISTER_H_ | |
OLD | NEW |