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

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..20495450f47664fb88aca89acab482fdb9e3193a 100644
--- a/extensions/browser/api/declarative/rules_registry.h
+++ b/extensions/browser/api/declarative/rules_registry.h
@@ -76,7 +76,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 = false);
not at google - send to devlin 2015/06/04 22:00:51 default parameters are against style guide
danduong 2015/06/04 23:06:37 Done.
// Unregisters all rules listed in |rule_identifiers| and owned by
// |extension_id| from this RulesRegistry.
@@ -148,7 +149,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
@@ -171,6 +173,7 @@ class RulesRegistry : public base::RefCountedThreadSafe<RulesRegistry> {
typedef std::pair<ExtensionId, RuleId> RulesDictionaryKey;
typedef std::map<RulesDictionaryKey, linked_ptr<RulesRegistry::Rule> >
RulesDictionary;
+ typedef std::set<RulesDictionaryKey> RuleIdSet;
enum ProcessChangedRulesState {
// ProcessChangedRules can never be called, |cache_delegate_| is NULL.
NEVER_PROCESS,
@@ -222,6 +225,8 @@ class RulesRegistry : public base::RefCountedThreadSafe<RulesRegistry> {
RulesDictionary rules_;
+ RuleIdSet manifest_rule_ids_;
+
// 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