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

Side by Side Diff: extensions/renderer/user_script_set.cc

Issue 594043002: Change ScriptInjection to work with WebLocalFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « extensions/renderer/script_injection_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "extensions/renderer/user_script_set.h" 5 #include "extensions/renderer/user_script_set.h"
6 6
7 #include "content/public/common/url_constants.h" 7 #include "content/public/common/url_constants.h"
8 #include "content/public/renderer/render_thread.h" 8 #include "content/public/renderer/render_thread.h"
9 #include "extensions/common/extension.h" 9 #include "extensions/common/extension.h"
10 #include "extensions/common/extension_set.h" 10 #include "extensions/common/extension_set.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 tab_id, 164 tab_id,
165 run_location, 165 run_location,
166 document_url, 166 document_url,
167 extension, 167 extension,
168 true /* is_declarative */); 168 true /* is_declarative */);
169 } 169 }
170 } 170 }
171 return scoped_ptr<ScriptInjection>(); 171 return scoped_ptr<ScriptInjection>();
172 } 172 }
173 173
174 // TODO(dcheng): Scripts can't be injected on a remote frame, so this function
175 // signature needs to be updated.
174 scoped_ptr<ScriptInjection> UserScriptSet::GetInjectionForScript( 176 scoped_ptr<ScriptInjection> UserScriptSet::GetInjectionForScript(
175 UserScript* script, 177 UserScript* script,
176 blink::WebFrame* web_frame, 178 blink::WebFrame* web_frame,
177 int tab_id, 179 int tab_id,
178 UserScript::RunLocation run_location, 180 UserScript::RunLocation run_location,
179 const GURL& document_url, 181 const GURL& document_url,
180 const Extension* extension, 182 const Extension* extension,
181 bool is_declarative) { 183 bool is_declarative) {
182 scoped_ptr<ScriptInjection> injection; 184 scoped_ptr<ScriptInjection> injection;
183 if (web_frame->parent() && !script->match_all_frames()) 185 if (web_frame->parent() && !script->match_all_frames())
(...skipping 17 matching lines...) Expand all
201 return injection.Pass(); 203 return injection.Pass();
202 } 204 }
203 205
204 bool inject_css = !script->css_scripts().empty() && 206 bool inject_css = !script->css_scripts().empty() &&
205 run_location == UserScript::DOCUMENT_START; 207 run_location == UserScript::DOCUMENT_START;
206 bool inject_js = 208 bool inject_js =
207 !script->js_scripts().empty() && script->run_location() == run_location; 209 !script->js_scripts().empty() && script->run_location() == run_location;
208 if (inject_css || inject_js) { 210 if (inject_css || inject_js) {
209 injection.reset(new ScriptInjection( 211 injection.reset(new ScriptInjection(
210 injector.Pass(), 212 injector.Pass(),
211 web_frame, 213 web_frame->toWebLocalFrame(),
212 extension->id(), 214 extension->id(),
213 run_location, 215 run_location,
214 tab_id)); 216 tab_id));
215 } 217 }
216 return injection.Pass(); 218 return injection.Pass();
217 } 219 }
218 220
219 } // namespace extensions 221 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/script_injection_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698