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

Side by Side Diff: chrome/browser/extensions/api/mdns/mdns_api.h

Issue 1040773002: Limit number of service instances passed to onServiceList listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new mdns.getMaxServiceInstancesPerEvent() function and update unit tests Created 5 years, 8 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 unified diff | Download patch
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/mdns/mdns_api.cc » ('j') | chrome/common/extensions/api/mdns.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698