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

Side by Side Diff: extensions/renderer/script_injection.h

Issue 1335083004: [Extensions] Don't allow extensions to inject scripts into extension pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // Return the id of the injection host associated with the given world. 47 // Return the id of the injection host associated with the given world.
48 static std::string GetHostIdForIsolatedWorld(int world_id); 48 static std::string GetHostIdForIsolatedWorld(int world_id);
49 49
50 // Remove the isolated world associated with the given injection host. 50 // Remove the isolated world associated with the given injection host.
51 static void RemoveIsolatedWorld(const std::string& host_id); 51 static void RemoveIsolatedWorld(const std::string& host_id);
52 52
53 ScriptInjection(scoped_ptr<ScriptInjector> injector, 53 ScriptInjection(scoped_ptr<ScriptInjector> injector,
54 content::RenderFrame* render_frame, 54 content::RenderFrame* render_frame,
55 scoped_ptr<const InjectionHost> injection_host, 55 scoped_ptr<const InjectionHost> injection_host,
56 UserScript::RunLocation run_location, 56 UserScript::RunLocation run_location);
57 int tab_id);
58 ~ScriptInjection(); 57 ~ScriptInjection();
59 58
60 // Try to inject the script at the |current_location|. This returns 59 // Try to inject the script at the |current_location|. This returns
61 // INJECTION_FINISHED if injection has injected or will never inject, returns 60 // INJECTION_FINISHED if injection has injected or will never inject, returns
62 // INJECTION_BLOCKED if injection is running asynchronously and has not 61 // INJECTION_BLOCKED if injection is running asynchronously and has not
63 // finished yet, returns INJECTION_WAITING if injections is delayed (either 62 // finished yet, returns INJECTION_WAITING if injections is delayed (either
64 // for permission purposes or because |current_location| is not the designated 63 // for permission purposes or because |current_location| is not the designated
65 // |run_location_|). 64 // |run_location_|).
66 // If INJECTION_BLOCKED is returned, |async_completion_callback| will be 65 // If INJECTION_BLOCKED is returned, |async_completion_callback| will be
67 // called upon completion. 66 // called upon completion.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 109
111 // The RenderFrame into which this should inject the script. 110 // The RenderFrame into which this should inject the script.
112 content::RenderFrame* render_frame_; 111 content::RenderFrame* render_frame_;
113 112
114 // The associated injection host. 113 // The associated injection host.
115 scoped_ptr<const InjectionHost> injection_host_; 114 scoped_ptr<const InjectionHost> injection_host_;
116 115
117 // The location in the document load at which we inject the script. 116 // The location in the document load at which we inject the script.
118 UserScript::RunLocation run_location_; 117 UserScript::RunLocation run_location_;
119 118
120 // The tab id associated with the frame.
121 int tab_id_;
122
123 // This injection's request id. This will be -1 unless the injection is 119 // This injection's request id. This will be -1 unless the injection is
124 // currently waiting on permission. 120 // currently waiting on permission.
125 int64 request_id_; 121 int64 request_id_;
126 122
127 // Whether or not the injection is complete, either via injecting the script 123 // Whether or not the injection is complete, either via injecting the script
128 // or because it will never complete. 124 // or because it will never complete.
129 bool complete_; 125 bool complete_;
130 126
131 // Whether or not the injection successfully injected JS. 127 // Whether or not the injection successfully injected JS.
132 bool did_inject_js_; 128 bool did_inject_js_;
133 129
134 // Results storage. 130 // Results storage.
135 scoped_ptr<base::Value> execution_result_; 131 scoped_ptr<base::Value> execution_result_;
136 132
137 // The callback to run upon completing asynchronously. 133 // The callback to run upon completing asynchronously.
138 CompletionCallback async_completion_callback_; 134 CompletionCallback async_completion_callback_;
139 135
140 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_; 136 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_;
141 137
142 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); 138 DISALLOW_COPY_AND_ASSIGN(ScriptInjection);
143 }; 139 };
144 140
145 } // namespace extensions 141 } // namespace extensions
146 142
147 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ 143 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_
OLDNEW
« no previous file with comments | « extensions/renderer/extension_injection_host.cc ('k') | extensions/renderer/script_injection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698