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

Unified Diff: extensions/common/user_script.h

Issue 906493004: Refactoring: de-couple Extensions from "script injection System" [render side]:2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_1
Patch Set: Rebase and remove ConsumerInstanceInfo(id). Created 5 years, 10 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
Index: extensions/common/user_script.h
diff --git a/extensions/common/user_script.h b/extensions/common/user_script.h
index 6069161e8fb4dc0bd8e58c67163a473340bad339..e0de3f7e2af93a0c2fe2958d17e1cd915a2179ae 100644
--- a/extensions/common/user_script.h
+++ b/extensions/common/user_script.h
@@ -126,6 +126,19 @@ 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;
+ };
+
+ // Type of a API consumer instance that user scripts will be injected on.
+ enum ConsumerInstanceType { TAB, WEBVIEW };
+
// Constructor. Default the run location to document end, which is like
// Greasemonkey and probably more useful for typical scripts.
UserScript();
@@ -200,6 +213,19 @@ class UserScript {
const HostID& host_id() const { return host_id_; }
void set_host_id(const HostID& host_id) { host_id_ = host_id; }
+ const ConsumerInstanceType& consumer_instance_type() const {
+ return consumer_instance_type_;
+ }
+ void set_consumer_instance_type(
+ const ConsumerInstanceType& consumer_instance_type) {
+ consumer_instance_type_ = consumer_instance_type;
+ }
+
+ 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 +252,8 @@ class UserScript {
void PickleGlobs(::Pickle* pickle,
const std::vector<std::string>& globs) const;
void PickleHostID(::Pickle* pickle, const HostID& host_id) 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,9 @@ class UserScript {
void UnpickleHostID(const ::Pickle& pickle,
PickleIterator* iter,
HostID* host_id);
+ 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 +309,12 @@ class UserScript {
// |host_id| can be empty if the script is a "standlone" user script.
HostID host_id_;
+ // The type of the consumer instance that the script will be injected.
Devlin 2015/02/17 18:58:32 It seems like we're adding a bunch of data to the
+ ConsumerInstanceType consumer_instance_type_;
+
+ // 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_;

Powered by Google App Engine
This is Rietveld 408576698