diff options
author | hanxi <hanxi@chromium.org> | 2015-03-02 14:33:53 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-02 22:35:12 +0000 |
commit | f853287c95cf818d0b5b02d7f4a6588761096d1c (patch) | |
tree | a6363407d85dff3e85f11f8170746db2acf84d1b /extensions/common/user_script.cc | |
parent | b5a74792a9fc7650bcec42d90ca2620eb946b5c0 (diff) | |
download | chromium_src-f853287c95cf818d0b5b02d7f4a6588761096d1c.zip chromium_src-f853287c95cf818d0b5b02d7f4a6588761096d1c.tar.gz chromium_src-f853287c95cf818d0b5b02d7f4a6588761096d1c.tar.bz2 |
This CL adds routing info for content scripts from <webview>.
To support dynamically added/removed content scripts in <webview>, we store
these content scripts in the same shared memory where user scripts from
declarative content API are stored, but the decision for injection will
be made in the render once the url pattern is matched. Since render doesn't
need to send IPCs to ask a decision from browser, it makes a precise time
injection possible.
Special to <webview>, once the content scripts are updated (added/removed),
browser will only notify the render process of the given <webview>, rather than
all of the renders (which is the case for user scripts).
BUG=437566
Review URL: https://codereview.chromium.org/906493004
Cr-Commit-Position: refs/heads/master@{#318774}
Diffstat (limited to 'extensions/common/user_script.cc')
-rw-r--r-- | extensions/common/user_script.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/extensions/common/user_script.cc b/extensions/common/user_script.cc index b8ba22e..7859e75 100644 --- a/extensions/common/user_script.cc +++ b/extensions/common/user_script.cc @@ -145,6 +145,8 @@ void UserScript::Pickle(::Pickle* pickle) const { pickle->WriteBool(is_incognito_enabled()); PickleHostID(pickle, host_id_); + pickle->WriteInt(consumer_instance_type()); + PickleRoutingInfo(pickle, routing_info_); PickleGlobs(pickle, globs_); PickleGlobs(pickle, exclude_globs_); PickleURLPatternSet(pickle, url_set_); @@ -167,6 +169,12 @@ void UserScript::PickleHostID(::Pickle* pickle, const HostID& host_id) const { pickle->WriteString(host_id.id()); } +void UserScript::PickleRoutingInfo(::Pickle* pickle, + const RoutingInfo& routing_info) const { + pickle->WriteInt(routing_info.render_process_id); + pickle->WriteInt(routing_info.render_view_id); +} + void UserScript::PickleURLPatternSet(::Pickle* pickle, const URLPatternSet& pattern_list) const { pickle->WriteSizeT(pattern_list.patterns().size()); @@ -200,6 +208,13 @@ void UserScript::Unpickle(const ::Pickle& pickle, PickleIterator* iter) { CHECK(iter->ReadBool(&incognito_enabled_)); UnpickleHostID(pickle, iter, &host_id_); + + int consumer_instance_type = 0; + CHECK(iter->ReadInt(&consumer_instance_type)); + consumer_instance_type_ = + static_cast<ConsumerInstanceType>(consumer_instance_type); + + UnpickleRoutingInfo(pickle, iter, &routing_info_); UnpickleGlobs(pickle, iter, &globs_); UnpickleGlobs(pickle, iter, &exclude_globs_); UnpickleURLPatternSet(pickle, iter, &url_set_); @@ -230,6 +245,13 @@ void UserScript::UnpickleHostID(const ::Pickle& pickle, *host_id = HostID(static_cast<HostID::HostType>(type), id); } +void UserScript::UnpickleRoutingInfo(const ::Pickle& pickle, + PickleIterator* iter, + RoutingInfo* routing_info) { + CHECK(iter->ReadInt(&routing_info->render_process_id)); + CHECK(iter->ReadInt(&routing_info->render_view_id)); +} + void UserScript::UnpickleURLPatternSet(const ::Pickle& pickle, PickleIterator* iter, URLPatternSet* pattern_list) { |