Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3325)

Unified Diff: chrome/browser/extensions/api/mdns/nsd_registry.h

Issue 23437015: Initial chrome.mdns API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use new event filter Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/mdns/nsd_registry.h
diff --git a/chrome/browser/extensions/api/mdns/nsd_registry.h b/chrome/browser/extensions/api/mdns/nsd_registry.h
new file mode 100644
index 0000000000000000000000000000000000000000..ee7663f1671b132b17e95b8daa2446c21beb8544
--- /dev/null
+++ b/chrome/browser/extensions/api/mdns/nsd_registry.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_MDNS_NSD_REGISTRY_H_
+#define CHROME_BROWSER_EXTENSIONS_API_MDNS_NSD_REGISTRY_H_
+
+#include <string>
+#include <vector>
+
+#include "base/observer_list.h"
+
+namespace extensions {
+
+// Network Service Discovery registry class for keeping track of discovered
+// network services.
+class NsdRegistry {
+ public:
+ typedef std::vector<std::string> NsdServiceList;
+
+ class NsdObserver {
+ public:
+ virtual void OnMDnsEvent(const std::string& service_type,
+ const NsdServiceList& services) = 0;
+
+ protected:
+ virtual ~NsdObserver() {}
+ };
+
+ explicit NsdRegistry();
+ virtual ~NsdRegistry();
+
+ // Observer registration for parties interested in discovery events.
+ virtual void AddObserver(NsdObserver* observer);
+ virtual void RemoveObserver(NsdObserver* observer);
+
+ // MDNS-related discovery functionality.
+ virtual void RegisterMDnsListener(std::string serviceName);
+ virtual void UnregisterMDnsListener(std::string serviceName);
+
+ protected:
+ ObserverList<NsdObserver> observers_;
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_MDNS_NSD_REGISTRY_H_

Powered by Google App Engine
This is Rietveld 408576698