diff options
author | hanxi <hanxi@chromium.org> | 2015-02-04 13:05:38 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-04 21:06:39 +0000 |
commit | 5eb894ea21637241e9a78fb9c2737d40d6dbf575 (patch) | |
tree | 4e97595cc96bb624061877f965b85cf0346fba28 /extensions/browser/api/declarative | |
parent | 50ed7018d4042c5aadf783869206ca996472c816 (diff) | |
download | chromium_src-5eb894ea21637241e9a78fb9c2737d40d6dbf575.zip chromium_src-5eb894ea21637241e9a78fb9c2737d40d6dbf575.tar.gz chromium_src-5eb894ea21637241e9a78fb9c2737d40d6dbf575.tar.bz2 |
Revert of Introduce HostID and de-couple Extensions from "script injection System" [browser side] (patchset #20 id:760001 of https://codereview.chromium.org/822453002/)
Reason for revert:
It might cause the crash https://code.google.com/p/chromium/issues/detail?id=454917.
Original issue's description:
> Introduce HostID and de-couple Extensions from "script injection System" [browser side]
>
> The major refactor includes:
> - Introduce HostID (a pair of |id, type|) to replace extension_id in browser
> side.
> - Abstract UserScriptLoader to be a base class, and introduces
> a derived class ExtensionUserScriptLoader which is
> responsible for loading user scripts for extensions.
> - In DeclarativeUserScriptManager, a master is created per
> extension/webUI.
> - DeclarativeUserScriptManager becomes an
> ExtensionRegistryObserver and is responsible for clearing scripts
> for master objects when receive OnExensionUnloaded event.
>
> BUG=437566
>
> Committed: https://crrev.com/b88fe3dc1072501bdd105fd95a8b3bc453fd2aa7
> Cr-Commit-Position: refs/heads/master@{#313402}
TBR=fsamuel@chromium.org,rdevlin.cronin@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=437566
Review URL: https://codereview.chromium.org/899983002
Cr-Commit-Position: refs/heads/master@{#314631}
Diffstat (limited to 'extensions/browser/api/declarative')
-rw-r--r-- | extensions/browser/api/declarative/declarative_rule.h | 12 | ||||
-rw-r--r-- | extensions/browser/api/declarative/declarative_rule_unittest.cc | 41 |
2 files changed, 20 insertions, 33 deletions
diff --git a/extensions/browser/api/declarative/declarative_rule.h b/extensions/browser/api/declarative/declarative_rule.h index 8dd3837..b612f27 100644 --- a/extensions/browser/api/declarative/declarative_rule.h +++ b/extensions/browser/api/declarative/declarative_rule.h @@ -23,7 +23,6 @@ #include "components/url_matcher/url_matcher.h" #include "extensions/common/api/events.h" #include "extensions/common/extension.h" -#include "extensions/common/host_id.h" namespace base { class Time; @@ -153,7 +152,6 @@ class DeclarativeActionSet { // the extension API. static scoped_ptr<DeclarativeActionSet> Create( content::BrowserContext* browser_context, - const HostID& host_id, const Extension* extension, const AnyVector& actions, std::string* error, @@ -232,7 +230,6 @@ class DeclarativeRule { static scoped_ptr<DeclarativeRule> Create( url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory, content::BrowserContext* browser_context, - const HostID& host_id, const Extension* extension, base::Time extension_installation_time, linked_ptr<JsonRule> rule, @@ -369,7 +366,6 @@ template<typename ActionT> scoped_ptr<DeclarativeActionSet<ActionT> > DeclarativeActionSet<ActionT>::Create( content::BrowserContext* browser_context, - const HostID& host_id, const Extension* extension, const AnyVector& actions, std::string* error, @@ -382,8 +378,7 @@ DeclarativeActionSet<ActionT>::Create( i != actions.end(); ++i) { CHECK(i->get()); scoped_refptr<const ActionT> action = - ActionT::Create( - browser_context, host_id, extension, **i, error, bad_message); + ActionT::Create(browser_context, extension, **i, error, bad_message); if (!error->empty() || *bad_message) return scoped_ptr<DeclarativeActionSet>(); result.push_back(action); @@ -460,7 +455,6 @@ scoped_ptr<DeclarativeRule<ConditionT, ActionT> > DeclarativeRule<ConditionT, ActionT>::Create( url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory, content::BrowserContext* browser_context, - const HostID& host_id, const Extension* extension, base::Time extension_installation_time, linked_ptr<JsonRule> rule, @@ -476,8 +470,8 @@ DeclarativeRule<ConditionT, ActionT>::Create( bool bad_message = false; scoped_ptr<ActionSet> actions = - ActionSet::Create(browser_context, host_id, extension, - rule->actions, error, &bad_message); + ActionSet::Create( + browser_context, 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. diff --git a/extensions/browser/api/declarative/declarative_rule_unittest.cc b/extensions/browser/api/declarative/declarative_rule_unittest.cc index 3c4163b..552145d 100644 --- a/extensions/browser/api/declarative/declarative_rule_unittest.cc +++ b/extensions/browser/api/declarative/declarative_rule_unittest.cc @@ -219,7 +219,6 @@ class SummingAction : public base::RefCounted<SummingAction> { static scoped_refptr<const SummingAction> Create( content::BrowserContext* browser_context, - const HostID& host_id, const Extension* extension, const base::Value& action, std::string* error, @@ -271,7 +270,7 @@ TEST(DeclarativeActionTest, ErrorActionSet) { std::string error; bool bad = false; scoped_ptr<SummingActionSet> result = - SummingActionSet::Create(NULL, HostID(), NULL, actions, &error, &bad); + SummingActionSet::Create(NULL, NULL, actions, &error, &bad); EXPECT_EQ("the error", error); EXPECT_FALSE(bad); EXPECT_FALSE(result); @@ -279,8 +278,7 @@ TEST(DeclarativeActionTest, ErrorActionSet) { actions.clear(); actions.push_back(ScopedToLinkedPtr(ParseJson("{\"value\": 1}"))); actions.push_back(ScopedToLinkedPtr(ParseJson("{\"bad\": 3}"))); - result = SummingActionSet::Create( - NULL, HostID(), NULL, actions, &error, &bad); + result = SummingActionSet::Create(NULL, NULL, actions, &error, &bad); EXPECT_EQ("", error); EXPECT_TRUE(bad); EXPECT_FALSE(result); @@ -297,7 +295,7 @@ TEST(DeclarativeActionTest, ApplyActionSet) { std::string error; bool bad = false; scoped_ptr<SummingActionSet> result = - SummingActionSet::Create(NULL, HostID(), NULL, actions, &error, &bad); + SummingActionSet::Create(NULL, NULL, actions, &error, &bad); EXPECT_EQ("", error); EXPECT_FALSE(bad); ASSERT_TRUE(result); @@ -338,15 +336,13 @@ TEST(DeclarativeRuleTest, Create) { URLMatcher matcher; std::string error; - scoped_ptr<Rule> rule( - Rule::Create(matcher.condition_factory(), - NULL, - HostID(HostID::EXTENSIONS, extension.get()->id()), - extension.get(), - install_time, - json_rule, - Rule::ConsistencyChecker(), - &error)); + scoped_ptr<Rule> rule(Rule::Create(matcher.condition_factory(), + NULL, + extension.get(), + install_time, + json_rule, + Rule::ConsistencyChecker(), + &error)); EXPECT_EQ("", error); ASSERT_TRUE(rule.get()); @@ -409,15 +405,13 @@ TEST(DeclarativeRuleTest, CheckConsistency) { " \"priority\": 200 \n" "}"), json_rule.get())); - scoped_ptr<Rule> rule( - Rule::Create(matcher.condition_factory(), - NULL, - HostID(HostID::EXTENSIONS, extension.get()->id()), - extension.get(), - base::Time(), - json_rule, - base::Bind(AtLeastOneCondition), - &error)); + scoped_ptr<Rule> rule(Rule::Create(matcher.condition_factory(), + NULL, + extension.get(), + base::Time(), + json_rule, + base::Bind(AtLeastOneCondition), + &error)); EXPECT_TRUE(rule); EXPECT_EQ("", error); @@ -436,7 +430,6 @@ TEST(DeclarativeRuleTest, CheckConsistency) { json_rule.get())); rule = Rule::Create(matcher.condition_factory(), NULL, - HostID(HostID::EXTENSIONS, extension.get()->id()), extension.get(), base::Time(), json_rule, |