| Index: extensions/common/user_script.cc
|
| diff --git a/extensions/common/user_script.cc b/extensions/common/user_script.cc
|
| index 4410290a55dfa5514f69f2afa71bd025a406ef54..0bf476a9ad08a4cd824e3e47dfcc544051928a1b 100644
|
| --- a/extensions/common/user_script.cc
|
| +++ b/extensions/common/user_script.cc
|
| @@ -85,7 +85,8 @@ UserScript::UserScript()
|
| emulate_greasemonkey_(false),
|
| match_all_frames_(false),
|
| match_about_blank_(false),
|
| - incognito_enabled_(false) {}
|
| + incognito_enabled_(false) {
|
| +}
|
|
|
| UserScript::~UserScript() {
|
| }
|
| @@ -138,13 +139,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());
|
|
|
| + PickleConsumerID(pickle, consumer_id_);
|
| PickleGlobs(pickle, globs_);
|
| PickleGlobs(pickle, exclude_globs_);
|
| PickleURLPatternSet(pickle, url_set_);
|
| @@ -162,6 +163,14 @@ void UserScript::PickleGlobs(::Pickle* pickle,
|
| }
|
| }
|
|
|
| +void UserScript::PickleConsumerID(::Pickle* pickle,
|
| + const ConsumerID& consumer_id) const {
|
| + pickle->WriteInt(consumer_id.host_type());
|
| + pickle->WriteString(consumer_id.host_id());
|
| + pickle->WriteInt(consumer_id.instance_type());
|
| + pickle->WriteInt(consumer_id.instance_id());
|
| +}
|
| +
|
| void UserScript::PickleURLPatternSet(::Pickle* pickle,
|
| const URLPatternSet& pattern_list) const {
|
| pickle->WriteSizeT(pattern_list.patterns().size());
|
| @@ -188,13 +197,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_));
|
|
|
| + UnpickleConsumerID(pickle, iter, &consumer_id_);
|
| UnpickleGlobs(pickle, iter, &globs_);
|
| UnpickleGlobs(pickle, iter, &exclude_globs_);
|
| UnpickleURLPatternSet(pickle, iter, &url_set_);
|
| @@ -215,6 +224,22 @@ void UserScript::UnpickleGlobs(const ::Pickle& pickle, PickleIterator* iter,
|
| }
|
| }
|
|
|
| +void UserScript::UnpickleConsumerID(const ::Pickle& pickle,
|
| + PickleIterator* iter,
|
| + ConsumerID* consumer_id) {
|
| + int host_type = 0;
|
| + std::string host_id;
|
| + int instance_type = 0;
|
| + int instance_id = 0;
|
| + CHECK(iter->ReadInt(&host_type));
|
| + CHECK(iter->ReadString(&host_id));
|
| + CHECK(iter->ReadInt(&instance_type));
|
| + CHECK(iter->ReadInt(&instance_id));
|
| + *consumer_id = ConsumerID(
|
| + static_cast<ConsumerID::HostType>(host_type), host_id,
|
| + static_cast<ConsumerID::InstanceType>(instance_type), instance_id);
|
| +}
|
| +
|
| void UserScript::UnpickleURLPatternSet(const ::Pickle& pickle,
|
| PickleIterator* iter,
|
| URLPatternSet* pattern_list) {
|
|
|