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_REGISTRY_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_REGISTRY_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/observer_list.h" | |
12 | |
13 namespace extensions { | |
14 | |
15 // Network Service Discovery registry class for keeping track of discovered | |
16 // network services. | |
17 class DnsSdRegistry { | |
18 public: | |
19 typedef std::vector<std::string> DnsSdServiceList; | |
20 | |
21 class DnsSdObserver { | |
22 public: | |
23 virtual void OnDnsSdEvent(const std::string& service_type, | |
24 const DnsSdServiceList& services) = 0; | |
25 | |
26 protected: | |
27 virtual ~DnsSdObserver() {} | |
28 }; | |
29 | |
30 explicit DnsSdRegistry(); | |
31 virtual ~DnsSdRegistry(); | |
32 | |
33 // Observer registration for parties interested in discovery events. | |
34 virtual void AddObserver(DnsSdObserver* observer); | |
35 virtual void RemoveObserver(DnsSdObserver* observer); | |
36 | |
37 // DNS-SD-related discovery functionality. | |
38 virtual void RegisterDnsSdListener(std::string service_type); | |
39 virtual void UnregisterDnsSdListener(std::string service_type); | |
40 | |
41 protected: | |
42 ObserverList<DnsSdObserver> observers_; | |
43 }; | |
44 | |
45 } // namespace extensions | |
46 | |
47 #endif // CHROME_BROWSER_EXTENSIONS_API_MDNS_DNS_SD_REGISTRY_H_ | |
OLD | NEW |