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

Side by Side Diff: extensions/renderer/script_injection.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. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_
6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ 6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "extensions/common/host_id.h" 10 #include "extensions/common/host_id.h"
(...skipping 14 matching lines...) Expand all
25 public: 25 public:
26 // Return the id of the injection host associated with the given world. 26 // Return the id of the injection host associated with the given world.
27 static HostID GetHostIdForIsolatedWorld(int world_id); 27 static HostID GetHostIdForIsolatedWorld(int world_id);
28 28
29 // Remove the isolated world associated with the given injection host. 29 // Remove the isolated world associated with the given injection host.
30 static void RemoveIsolatedWorld(const HostID& host_id); 30 static void RemoveIsolatedWorld(const HostID& host_id);
31 31
32 ScriptInjection(scoped_ptr<ScriptInjector> injector, 32 ScriptInjection(scoped_ptr<ScriptInjector> injector,
33 blink::WebLocalFrame* web_frame, 33 blink::WebLocalFrame* web_frame,
34 const HostID& host_id, 34 const HostID& host_id,
35 int instance_id, 35 const ConsumerInstanceInfo& consumer_instance_info,
36 UserScript::RunLocation run_location, 36 UserScript::RunLocation run_location,
37 int tab_id); 37 int tab_id);
38 ~ScriptInjection(); 38 ~ScriptInjection();
39 39
40 // Try to inject the script at the |current_location|. This returns true if 40 // Try to inject the script at the |current_location|. This returns true if
41 // the script has either injected or will never inject (i.e., if the object 41 // the script has either injected or will never inject (i.e., if the object
42 // is done), and false if injection is delayed (either for permission purposes 42 // is done), and false if injection is delayed (either for permission purposes
43 // or because |current_location| is not the designated |run_location_|). 43 // or because |current_location| is not the designated |run_location_|).
44 // NOTE: |injection_host| may be NULL, if the injection_host is removed! 44 // NOTE: |injection_host| may be NULL, if the injection_host is removed!
45 bool TryToInject(UserScript::RunLocation current_location, 45 bool TryToInject(UserScript::RunLocation current_location,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 // The injector for this injection. 79 // The injector for this injection.
80 scoped_ptr<ScriptInjector> injector_; 80 scoped_ptr<ScriptInjector> injector_;
81 81
82 // The (main) WebFrame into which this should inject the script. 82 // The (main) WebFrame into which this should inject the script.
83 blink::WebLocalFrame* web_frame_; 83 blink::WebLocalFrame* web_frame_;
84 84
85 // The id of the associated injection_host. 85 // The id of the associated injection_host.
86 HostID host_id_; 86 HostID host_id_;
87 87
88 // The id of the instance on which the host will inject the script. 88 // The type and id of the instance on which the host will inject the script.
89 // If the instance is a regular tab, the |instance_id| is 0; if the instance 89 // If the instance is a regular tab, the |instance_id| is 0; if the instance
90 // is a <webview>, the |instance_id| is a unique positive number. 90 // is a <webview>, the |instance_id| is a unique positive number.
91 int instance_id_; 91 ConsumerInstanceInfo consumer_instance_info_;
92 92
93 // The location in the document load at which we inject the script. 93 // The location in the document load at which we inject the script.
94 UserScript::RunLocation run_location_; 94 UserScript::RunLocation run_location_;
95 95
96 // The tab id associated with the frame. 96 // The tab id associated with the frame.
97 int tab_id_; 97 int tab_id_;
98 98
99 // This injection's request id. This will be -1 unless the injection is 99 // This injection's request id. This will be -1 unless the injection is
100 // currently waiting on permission. 100 // currently waiting on permission.
101 int64 request_id_; 101 int64 request_id_;
102 102
103 // Whether or not the injection is complete, either via injecting the script 103 // Whether or not the injection is complete, either via injecting the script
104 // or because it will never complete. 104 // or because it will never complete.
105 bool complete_; 105 bool complete_;
106 106
107 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); 107 DISALLOW_COPY_AND_ASSIGN(ScriptInjection);
108 }; 108 };
109 109
110 } // namespace extensions 110 } // namespace extensions
111 111
112 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ 112 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698