Chromium Code Reviews| Index: extensions/common/user_script.h |
| diff --git a/extensions/common/user_script.h b/extensions/common/user_script.h |
| index 6069161e8fb4dc0bd8e58c67163a473340bad339..e1fec99dfed4b709042b11fa67b58e11bd141a35 100644 |
| --- a/extensions/common/user_script.h |
| +++ b/extensions/common/user_script.h |
| @@ -11,6 +11,7 @@ |
| #include "base/basictypes.h" |
| #include "base/files/file_path.h" |
| #include "base/strings/string_piece.h" |
| +#include "extensions/common/consumer_instance_info.h" |
| #include "extensions/common/host_id.h" |
| #include "extensions/common/url_pattern.h" |
| #include "extensions/common/url_pattern_set.h" |
| @@ -126,6 +127,16 @@ class UserScript { |
| typedef std::vector<File> FileList; |
| + // Render's routing info of a <webview> that the user script will be injected |
| + // on. Only user scripts from <webview>s have a custom routing info. |
| + struct RoutingInfo { |
| + RoutingInfo() : render_process_id(-1), render_view_id(-1) {}; |
| + ~RoutingInfo() {}; |
| + |
| + int render_process_id; |
| + int render_view_id; |
| + }; |
| + |
| // Constructor. Default the run location to document end, which is like |
| // Greasemonkey and probably more useful for typical scripts. |
| UserScript(); |
| @@ -200,6 +211,18 @@ class UserScript { |
| const HostID& host_id() const { return host_id_; } |
| void set_host_id(const HostID& host_id) { host_id_ = host_id; } |
| + const ConsumerInstanceInfo& consumer_instance_info() const { |
| + return consumer_instance_info_; |
| + } |
| + void set_consumer_instance_info(const ConsumerInstanceInfo& instance_info) { |
|
Devlin
2015/02/11 20:29:01
I don't see these being set anywhere yet - are the
Xi Han
2015/02/11 21:57:24
Yes, once we have add/remove content scripts APIs
|
| + consumer_instance_info_ = instance_info; |
| + } |
| + |
| + const RoutingInfo& routing_info() const { return routing_info_; } |
| + void set_routing_info(const RoutingInfo& routing_info) { |
| + routing_info_ = routing_info; |
| + } |
| + |
| int id() const { return user_script_id_; } |
| void set_id(int id) { user_script_id_ = id; } |
| @@ -226,6 +249,11 @@ class UserScript { |
| void PickleGlobs(::Pickle* pickle, |
| const std::vector<std::string>& globs) const; |
| void PickleHostID(::Pickle* pickle, const HostID& host_id) const; |
| + void PickleConsumerInstanceInfo( |
| + ::Pickle* pickle, |
| + const ConsumerInstanceInfo& consumer_instance_info) const; |
| + void PickleRoutingInfo(::Pickle* pickle, |
| + const RoutingInfo& routing_info) const; |
| void PickleURLPatternSet(::Pickle* pickle, |
| const URLPatternSet& pattern_list) const; |
| void PickleScripts(::Pickle* pickle, const FileList& scripts) const; |
| @@ -236,6 +264,13 @@ class UserScript { |
| void UnpickleHostID(const ::Pickle& pickle, |
| PickleIterator* iter, |
| HostID* host_id); |
| + void UnpickleConsumerInstanceInfo( |
| + const ::Pickle& pickle, |
| + PickleIterator* iter, |
| + ConsumerInstanceInfo* consumer_instance_info); |
| + void UnpickleRoutingInfo(const ::Pickle& pickle, |
| + PickleIterator* iter, |
| + RoutingInfo* routing_info); |
| void UnpickleURLPatternSet(const ::Pickle& pickle, PickleIterator* iter, |
| URLPatternSet* pattern_list); |
| void UnpickleScripts(const ::Pickle& pickle, PickleIterator* iter, |
| @@ -278,6 +313,12 @@ class UserScript { |
| // |host_id| can be empty if the script is a "standlone" user script. |
| HostID host_id_; |
| + // The type and id of the consumer instance that the script will be injected. |
| + ConsumerInstanceInfo consumer_instance_info_; |
| + |
| + // The render side's rounting info for content_scripts of <webview>. |
| + RoutingInfo routing_info_; |
| + |
| // The globally-unique id associated with this user script. Defaults to |
| // -1 for invalid. |
| int user_script_id_; |