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

Unified Diff: extensions/browser/api/declarative/rules_registry.h

Issue 1158693006: Create a mechanism define declarative rules via the extension manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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: extensions/browser/api/declarative/rules_registry.h
diff --git a/extensions/browser/api/declarative/rules_registry.h b/extensions/browser/api/declarative/rules_registry.h
index 34ad7acfc8191ed0b54d42d50238965c2bc0a7fd..28e3bdf2e30088f17623066b71db116213acc69f 100644
--- a/extensions/browser/api/declarative/rules_registry.h
+++ b/extensions/browser/api/declarative/rules_registry.h
@@ -31,6 +31,7 @@ class Value;
namespace extensions {
+class Extension;
class RulesCacheDelegate;
// A base class for RulesRegistries that takes care of storing the
@@ -76,7 +77,8 @@ class RulesRegistry : public base::RefCountedThreadSafe<RulesRegistry> {
// relevant are added or none.
std::string AddRules(
const std::string& extension_id,
- const std::vector<linked_ptr<RulesRegistry::Rule> >& rules);
+ const std::vector<linked_ptr<RulesRegistry::Rule>>& rules,
+ bool from_manifest);
not at google - send to devlin 2015/06/05 16:16:14 This from_manifest flag shouldn't be part of the p
danduong 2015/06/05 21:35:07 Done.
// Unregisters all rules listed in |rule_identifiers| and owned by
// |extension_id| from this RulesRegistry.
@@ -110,9 +112,9 @@ class RulesRegistry : public base::RefCountedThreadSafe<RulesRegistry> {
// Called to notify the RulesRegistry that the extension availability has
// changed, so that the registry can update which rules are active.
- void OnExtensionUnloaded(const std::string& extension_id);
- void OnExtensionUninstalled(const std::string& extension_id);
- void OnExtensionLoaded(const std::string& extension_id);
+ void OnExtensionUnloaded(const Extension* extension);
+ void OnExtensionUninstalled(const Extension* extension);
+ void OnExtensionLoaded(const Extension* extension);
not at google - send to devlin 2015/06/05 16:16:14 Thanks for doing this.
danduong 2015/06/05 21:35:07 Acknowledged.
// Returns the number of entries in used_rule_identifiers_ for leak detection.
// Every ExtensionId counts as one entry, even if it contains no rules.
@@ -148,7 +150,8 @@ class RulesRegistry : public base::RefCountedThreadSafe<RulesRegistry> {
// message otherwise.
std::string AddRulesNoFill(
const std::string& extension_id,
- const std::vector<linked_ptr<RulesRegistry::Rule> >& rules);
+ const std::vector<linked_ptr<RulesRegistry::Rule>>& rules,
+ bool from_manifest);
// These functions need to apply the rules to the browser, while the base
// class will handle defaulting empty fields before calling *Impl, and will
@@ -222,6 +225,8 @@ class RulesRegistry : public base::RefCountedThreadSafe<RulesRegistry> {
RulesDictionary rules_;
+ RulesDictionary manifest_rules_;
+
// Signaled when we have finished reading from storage for all extensions that
// are loaded on startup.
OneShotEvent ready_;

Powered by Google App Engine
This is Rietveld 408576698