OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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_NSD_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_MDNS_NSD_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 NsdRegistry { |
| 18 public: |
| 19 typedef std::vector<std::string> NsdServiceList; |
| 20 |
| 21 class NsdObserver { |
| 22 public: |
| 23 virtual void OnMDnsEvent(const std::string& service_type, |
| 24 const NsdServiceList& services) = 0; |
| 25 |
| 26 protected: |
| 27 virtual ~NsdObserver() {} |
| 28 }; |
| 29 |
| 30 explicit NsdRegistry(); |
| 31 virtual ~NsdRegistry(); |
| 32 |
| 33 // Observer registration for parties interested in discovery events. |
| 34 virtual void AddObserver(NsdObserver* observer); |
| 35 virtual void RemoveObserver(NsdObserver* observer); |
| 36 |
| 37 // MDNS-related discovery functionality. |
| 38 virtual void RegisterDnsSdListener(std::string service_type); |
| 39 virtual void UnregisterDnsSdListener(std::string service_type); |
| 40 |
| 41 protected: |
| 42 ObserverList<NsdObserver> observers_; |
| 43 }; |
| 44 |
| 45 } // namespace extensions |
| 46 |
| 47 #endif // CHROME_BROWSER_EXTENSIONS_API_MDNS_NSD_REGISTRY_H_ |
OLD | NEW |