| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "chrome/browser/extensions/api/mdns/dns_sd_registry.h" | 13 #include "chrome/browser/extensions/api/mdns/dns_sd_registry.h" |
| 14 #include "extensions/browser/browser_context_keyed_api_factory.h" | 14 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 15 #include "extensions/browser/event_router.h" | 15 #include "extensions/browser/event_router.h" |
| 16 #include "extensions/browser/extension_function.h" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 class BrowserContext; | 19 class BrowserContext; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace extensions { | 22 namespace extensions { |
| 22 | 23 |
| 23 class DnsSdRegistry; | 24 class DnsSdRegistry; |
| 24 | 25 |
| 25 // MDnsAPI is instantiated with the profile and will listen for extensions that | 26 // MDnsAPI is instantiated with the profile and will listen for extensions that |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 base::ThreadChecker thread_checker_; | 72 base::ThreadChecker thread_checker_; |
| 72 content::BrowserContext* const browser_context_; | 73 content::BrowserContext* const browser_context_; |
| 73 // Lazily created on first access and destroyed with this API class. | 74 // Lazily created on first access and destroyed with this API class. |
| 74 scoped_ptr<DnsSdRegistry> dns_sd_registry_; | 75 scoped_ptr<DnsSdRegistry> dns_sd_registry_; |
| 75 // Current set of service types registered with the registry. | 76 // Current set of service types registered with the registry. |
| 76 std::set<std::string> service_types_; | 77 std::set<std::string> service_types_; |
| 77 | 78 |
| 78 DISALLOW_COPY_AND_ASSIGN(MDnsAPI); | 79 DISALLOW_COPY_AND_ASSIGN(MDnsAPI); |
| 79 }; | 80 }; |
| 80 | 81 |
| 82 // Implementation of mdns.getMaxServiceInstancesPerEventFunction, which is a |
| 83 // function for determining the maximum number of services that will be |
| 84 // available in an mdns.onServiceList event. |
| 85 class MdnsGetMaxServiceInstancesPerEventFunction : |
| 86 public UIThreadExtensionFunction { |
| 87 public: |
| 88 DECLARE_EXTENSION_FUNCTION("mdns.getMaxServiceInstancesPerEvent", |
| 89 MDNS_GET_MAX_SERVICE_INSTANCES_PER_EVENT); |
| 90 |
| 91 MdnsGetMaxServiceInstancesPerEventFunction() {} |
| 92 ExtensionFunction::ResponseAction Run() override; |
| 93 |
| 94 protected: |
| 95 ~MdnsGetMaxServiceInstancesPerEventFunction() override {} |
| 96 }; |
| 97 |
| 81 } // namespace extensions | 98 } // namespace extensions |
| 82 | 99 |
| 83 #endif // CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_ | 100 #endif // CHROME_BROWSER_EXTENSIONS_API_MDNS_MDNS_API_H_ |
| OLD | NEW |