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

Side by Side Diff: extensions/browser/api/declarative/rules_registry_service.h

Issue 664933004: Standardize usage of virtual/override/final in extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__
6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 : event_name(event_name), 47 : event_name(event_name),
48 webview_key(webview_key) {} 48 webview_key(webview_key) {}
49 bool operator<(const RulesRegistryKey& other) const { 49 bool operator<(const RulesRegistryKey& other) const {
50 return (event_name < other.event_name) || 50 return (event_name < other.event_name) ||
51 ((event_name == other.event_name) && 51 ((event_name == other.event_name) &&
52 (webview_key < other.webview_key)); 52 (webview_key < other.webview_key));
53 } 53 }
54 }; 54 };
55 55
56 explicit RulesRegistryService(content::BrowserContext* context); 56 explicit RulesRegistryService(content::BrowserContext* context);
57 virtual ~RulesRegistryService(); 57 ~RulesRegistryService() override;
58 58
59 // Unregisters refptrs to concrete RulesRegistries at other objects that were 59 // Unregisters refptrs to concrete RulesRegistries at other objects that were
60 // created by us so that the RulesRegistries can be released. 60 // created by us so that the RulesRegistries can be released.
61 virtual void Shutdown() override; 61 void Shutdown() override;
62 62
63 // BrowserContextKeyedAPI implementation. 63 // BrowserContextKeyedAPI implementation.
64 static BrowserContextKeyedAPIFactory<RulesRegistryService>* 64 static BrowserContextKeyedAPIFactory<RulesRegistryService>*
65 GetFactoryInstance(); 65 GetFactoryInstance();
66 66
67 // Convenience method to get the RulesRegistryService for a context. 67 // Convenience method to get the RulesRegistryService for a context.
68 static RulesRegistryService* Get(content::BrowserContext* context); 68 static RulesRegistryService* Get(content::BrowserContext* context);
69 69
70 // Registers the default RulesRegistries used in Chromium. 70 // Registers the default RulesRegistries used in Chromium.
71 void EnsureDefaultRulesRegistriesRegistered(const WebViewKey& webview_key); 71 void EnsureDefaultRulesRegistriesRegistered(const WebViewKey& webview_key);
(...skipping 21 matching lines...) Expand all
93 93
94 private: 94 private:
95 friend class BrowserContextKeyedAPIFactory<RulesRegistryService>; 95 friend class BrowserContextKeyedAPIFactory<RulesRegistryService>;
96 96
97 // Maps <event name, webview key> to RuleRegistries that handle these 97 // Maps <event name, webview key> to RuleRegistries that handle these
98 // events. 98 // events.
99 typedef std::map<RulesRegistryKey, scoped_refptr<RulesRegistry> > 99 typedef std::map<RulesRegistryKey, scoped_refptr<RulesRegistry> >
100 RulesRegistryMap; 100 RulesRegistryMap;
101 101
102 // Implementation of content::NotificationObserver. 102 // Implementation of content::NotificationObserver.
103 virtual void Observe(int type, 103 void Observe(int type,
104 const content::NotificationSource& source, 104 const content::NotificationSource& source,
105 const content::NotificationDetails& details) override; 105 const content::NotificationDetails& details) override;
106 106
107 // ExtensionRegistryObserver implementation. 107 // ExtensionRegistryObserver implementation.
108 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, 108 void OnExtensionLoaded(content::BrowserContext* browser_context,
109 const Extension* extension) override; 109 const Extension* extension) override;
110 virtual void OnExtensionUnloaded( 110 void OnExtensionUnloaded(content::BrowserContext* browser_context,
111 content::BrowserContext* browser_context, 111 const Extension* extension,
112 const Extension* extension, 112 UnloadedExtensionInfo::Reason reason) override;
113 UnloadedExtensionInfo::Reason reason) override; 113 void OnExtensionUninstalled(content::BrowserContext* browser_context,
114 virtual void OnExtensionUninstalled( 114 const Extension* extension,
115 content::BrowserContext* browser_context, 115 extensions::UninstallReason reason) override;
116 const Extension* extension,
117 extensions::UninstallReason reason) override;
118 116
119 // Iterates over all registries, and calls |notification_callback| on them 117 // Iterates over all registries, and calls |notification_callback| on them
120 // with |extension_id| as the argument. If a registry lives on a different 118 // with |extension_id| as the argument. If a registry lives on a different
121 // thread, the call is posted to that thread, so no guarantee of synchronous 119 // thread, the call is posted to that thread, so no guarantee of synchronous
122 // processing. 120 // processing.
123 void NotifyRegistriesHelper( 121 void NotifyRegistriesHelper(
124 void (RulesRegistry::*notification_callback)(const std::string&), 122 void (RulesRegistry::*notification_callback)(const std::string&),
125 const std::string& extension_id); 123 const std::string& extension_id);
126 124
127 // BrowserContextKeyedAPI implementation. 125 // BrowserContextKeyedAPI implementation.
(...skipping 19 matching lines...) Expand all
147 extension_registry_observer_; 145 extension_registry_observer_;
148 146
149 content::BrowserContext* browser_context_; 147 content::BrowserContext* browser_context_;
150 148
151 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService); 149 DISALLOW_COPY_AND_ASSIGN(RulesRegistryService);
152 }; 150 };
153 151
154 } // namespace extensions 152 } // namespace extensions
155 153
156 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__ 154 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_REGISTRY_SERVICE_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698