Index: chrome/browser/extensions/api/declarative/declarative_rule.h |
diff --git a/chrome/browser/extensions/api/declarative/declarative_rule.h b/chrome/browser/extensions/api/declarative/declarative_rule.h |
index 8e15acf877f12eef61e5a1f1aed0c29d1c0c2fcf..d3290b39d731b3c17d3144434dbe4c634a52d9a6 100644 |
--- a/chrome/browser/extensions/api/declarative/declarative_rule.h |
+++ b/chrome/browser/extensions/api/declarative/declarative_rule.h |
@@ -29,6 +29,8 @@ class Time; |
class Value; |
} |
+class Profile; |
+ |
namespace extensions { |
// This class stores a set of conditions that may be part of a DeclarativeRule. |
@@ -146,7 +148,8 @@ class DeclarativeActionSet { |
// Factory method that instantiates a DeclarativeActionSet for |extension| |
// according to |actions| which represents the array of actions received from |
// the extension API. |
- static scoped_ptr<DeclarativeActionSet> Create(const Extension* extension, |
+ static scoped_ptr<DeclarativeActionSet> Create(Profile* profile, |
Jeffrey Yasskin
2014/08/22 01:12:24
Can this take a BrowserContext instead of a Profil
Mark Dittmer
2014/08/22 19:59:18
Yes. Done.
|
+ const Extension* extension, |
const AnyVector& actions, |
std::string* error, |
bool* bad_message); |
@@ -169,6 +172,12 @@ class DeclarativeActionSet { |
const base::Time& extension_install_time, |
typename ActionT::ApplyInfo* apply_info) const; |
+ // Rules call this method when their conditions are checked and were already |
+ // fulfilled previously. |
+ void Reapply(const std::string& extension_id, |
Jeffrey Yasskin
2014/08/22 01:12:24
This looks like it duplicates the other Reapply().
Mark Dittmer
2014/08/22 19:59:18
Yes. Merge fail. Fixed.
|
+ const base::Time& extension_install_time, |
+ typename ActionT::ApplyInfo* apply_info) const; |
+ |
// Returns the minimum priority of rules that may be evaluated after |
// this rule. Defaults to MIN_INT. |
int GetMinimumPriority() const; |
@@ -223,6 +232,7 @@ class DeclarativeRule { |
// the returned rule is internally consistent. |
static scoped_ptr<DeclarativeRule> Create( |
url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory, |
+ Profile* profile, |
const Extension* extension, |
base::Time extension_installation_time, |
linked_ptr<JsonRule> rule, |
@@ -358,6 +368,7 @@ DeclarativeActionSet<ActionT>::DeclarativeActionSet(const Actions& actions) |
template<typename ActionT> |
scoped_ptr<DeclarativeActionSet<ActionT> > |
DeclarativeActionSet<ActionT>::Create( |
+ Profile* profile, |
const Extension* extension, |
const AnyVector& actions, |
std::string* error, |
@@ -370,7 +381,7 @@ DeclarativeActionSet<ActionT>::Create( |
i != actions.end(); ++i) { |
CHECK(i->get()); |
scoped_refptr<const ActionT> action = |
- ActionT::Create(extension, **i, error, bad_message); |
+ ActionT::Create(profile, extension, **i, error, bad_message); |
if (!error->empty() || *bad_message) |
return scoped_ptr<DeclarativeActionSet>(); |
result.push_back(action); |
@@ -410,6 +421,16 @@ void DeclarativeActionSet<ActionT>::Revert( |
} |
template<typename ActionT> |
+void DeclarativeActionSet<ActionT>::Reapply( |
+ const std::string& extension_id, |
+ const base::Time& extension_install_time, |
+ typename ActionT::ApplyInfo* apply_info) const { |
+ for (typename Actions::const_iterator i = actions_.begin(); |
+ i != actions_.end(); ++i) |
+ (*i)->Reapply(extension_id, extension_install_time, apply_info); |
+} |
+ |
+template<typename ActionT> |
int DeclarativeActionSet<ActionT>::GetMinimumPriority() const { |
int minimum_priority = std::numeric_limits<int>::min(); |
for (typename Actions::const_iterator i = actions_.begin(); |
@@ -446,6 +467,7 @@ template<typename ConditionT, typename ActionT> |
scoped_ptr<DeclarativeRule<ConditionT, ActionT> > |
DeclarativeRule<ConditionT, ActionT>::Create( |
url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory, |
+ Profile* profile, |
const Extension* extension, |
base::Time extension_installation_time, |
linked_ptr<JsonRule> rule, |
@@ -461,7 +483,7 @@ DeclarativeRule<ConditionT, ActionT>::Create( |
bool bad_message = false; |
scoped_ptr<ActionSet> actions = |
- ActionSet::Create(extension, rule->actions, error, &bad_message); |
+ ActionSet::Create(profile, extension, rule->actions, error, &bad_message); |
if (bad_message) { |
// TODO(battre) Export concept of bad_message to caller, the extension |
// should be killed in case it is true. |