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

Unified Diff: extensions/common/user_script.cc

Issue 822453002: Introduce HostID and de-couple Extensions from "script injection System" [browser side] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 11 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
« no previous file with comments | « extensions/common/user_script.h ('k') | extensions/common/user_script_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/user_script.cc
diff --git a/extensions/common/user_script.cc b/extensions/common/user_script.cc
index 4410290a55dfa5514f69f2afa71bd025a406ef54..b8ba22e1d7639523157f3cf99abbafe666117255 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,6 +162,11 @@ 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());
@@ -188,13 +193,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_);
@@ -215,6 +220,16 @@ 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) {
« no previous file with comments | « extensions/common/user_script.h ('k') | extensions/common/user_script_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698