summaryrefslogtreecommitdiffstats
path: root/extensions/common/user_script.cc
diff options
context:
space:
mode:
authorhanxi <hanxi@chromium.org>2015-02-04 13:05:38 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-04 21:06:39 +0000
commit5eb894ea21637241e9a78fb9c2737d40d6dbf575 (patch)
tree4e97595cc96bb624061877f965b85cf0346fba28 /extensions/common/user_script.cc
parent50ed7018d4042c5aadf783869206ca996472c816 (diff)
downloadchromium_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/common/user_script.cc')
-rw-r--r--extensions/common/user_script.cc19
1 files changed, 2 insertions, 17 deletions
diff --git a/extensions/common/user_script.cc b/extensions/common/user_script.cc
index b8ba22e..4410290 100644
--- a/extensions/common/user_script.cc
+++ b/extensions/common/user_script.cc
@@ -138,13 +138,13 @@ void UserScript::File::Unpickle(const ::Pickle& pickle, PickleIterator* iter) {
void UserScript::Pickle(::Pickle* pickle) const {
// Write the simple types to the pickle.
pickle->WriteInt(run_location());
+ pickle->WriteString(extension_id());
pickle->WriteInt(user_script_id_);
pickle->WriteBool(emulate_greasemonkey());
pickle->WriteBool(match_all_frames());
pickle->WriteBool(match_about_blank());
pickle->WriteBool(is_incognito_enabled());
- PickleHostID(pickle, host_id_);
PickleGlobs(pickle, globs_);
PickleGlobs(pickle, exclude_globs_);
PickleURLPatternSet(pickle, url_set_);
@@ -162,11 +162,6 @@ void UserScript::PickleGlobs(::Pickle* pickle,
}
}
-void UserScript::PickleHostID(::Pickle* pickle, const HostID& host_id) const {
- pickle->WriteInt(host_id.type());
- pickle->WriteString(host_id.id());
-}
-
void UserScript::PickleURLPatternSet(::Pickle* pickle,
const URLPatternSet& pattern_list) const {
pickle->WriteSizeT(pattern_list.patterns().size());
@@ -193,13 +188,13 @@ void UserScript::Unpickle(const ::Pickle& pickle, PickleIterator* iter) {
CHECK(run_location >= 0 && run_location < RUN_LOCATION_LAST);
run_location_ = static_cast<RunLocation>(run_location);
+ CHECK(iter->ReadString(&extension_id_));
CHECK(iter->ReadInt(&user_script_id_));
CHECK(iter->ReadBool(&emulate_greasemonkey_));
CHECK(iter->ReadBool(&match_all_frames_));
CHECK(iter->ReadBool(&match_about_blank_));
CHECK(iter->ReadBool(&incognito_enabled_));
- UnpickleHostID(pickle, iter, &host_id_);
UnpickleGlobs(pickle, iter, &globs_);
UnpickleGlobs(pickle, iter, &exclude_globs_);
UnpickleURLPatternSet(pickle, iter, &url_set_);
@@ -220,16 +215,6 @@ void UserScript::UnpickleGlobs(const ::Pickle& pickle, PickleIterator* iter,
}
}
-void UserScript::UnpickleHostID(const ::Pickle& pickle,
- PickleIterator* iter,
- HostID* host_id) {
- int type = 0;
- std::string id;
- CHECK(iter->ReadInt(&type));
- CHECK(iter->ReadString(&id));
- *host_id = HostID(static_cast<HostID::HostType>(type), id);
-}
-
void UserScript::UnpickleURLPatternSet(const ::Pickle& pickle,
PickleIterator* iter,
URLPatternSet* pattern_list) {