OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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_MDNS_API_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/threading/thread_checker.h" | |
11 #include "chrome/browser/extensions/api/api_function.h" | |
12 #include "chrome/browser/extensions/api/mdns/nsd_registry.h" | |
13 #include "chrome/browser/extensions/event_router.h" | |
14 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" | |
15 | |
16 namespace extensions { | |
17 | |
18 class MDnsAPI : public BrowserContextKeyedService, | |
19 public EventRouter::Observer, | |
20 public NsdRegistry::Observer { | |
21 public: | |
22 explicit MDnsAPI(Profile* profile); | |
23 | |
24 NsdRegistry* nsd_registry(); | |
25 | |
26 virtual void OnMDnsEvent(const std::string& service_type, | |
27 const NsdRegistry::NsdDeviceList& devices) OVERRIDE; | |
28 | |
29 private: | |
30 typedef std::map<std::string, std::set<std::string> > | |
31 ServiceTypeToExtensionsMap; | |
32 | |
33 virtual ~MDnsAPI(); | |
34 | |
35 // EventRouter::Observer: | |
36 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | |
37 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; | |
38 | |
39 Profile* const profile_; | |
40 base::ThreadChecker thread_checker_; | |
41 scoped_ptr<NsdRegistry> nsd_registry_; | |
42 ServiceTypeToExtensionsMap service_type_to_extension_map_; | |
mark a. foltz
2013/08/27 00:35:42
service_type_to_extensions_map_?
justinlin
2013/08/27 01:50:20
Done.
| |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(MDnsAPI); | |
45 }; | |
46 | |
47 } // namespace extensions | |
48 | |
49 #endif // CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_ | |
OLD | NEW |