OLD | NEW |
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 "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "content/public/common/url_constants.h" | 8 #include "content/public/common/url_constants.h" |
9 #include "content/public/renderer/render_frame.h" | 9 #include "content/public/renderer/render_frame.h" |
10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 if (!script->MatchesURL(effective_document_url)) | 204 if (!script->MatchesURL(effective_document_url)) |
205 return injection.Pass(); | 205 return injection.Pass(); |
206 | 206 |
207 scoped_ptr<ScriptInjector> injector(new UserScriptInjector(script, | 207 scoped_ptr<ScriptInjector> injector(new UserScriptInjector(script, |
208 this, | 208 this, |
209 is_declarative)); | 209 is_declarative)); |
210 | 210 |
211 if (injector->CanExecuteOnFrame( | 211 if (injector->CanExecuteOnFrame( |
212 injection_host.get(), | 212 injection_host.get(), |
213 web_frame, | 213 web_frame, |
214 -1 /* Content scripts are not tab-specific. */) == | 214 tab_id) == |
215 PermissionsData::ACCESS_DENIED) { | 215 PermissionsData::ACCESS_DENIED) { |
216 return injection.Pass(); | 216 return injection.Pass(); |
217 } | 217 } |
218 | 218 |
219 bool inject_css = !script->css_scripts().empty() && | 219 bool inject_css = !script->css_scripts().empty() && |
220 run_location == UserScript::DOCUMENT_START; | 220 run_location == UserScript::DOCUMENT_START; |
221 bool inject_js = | 221 bool inject_js = |
222 !script->js_scripts().empty() && script->run_location() == run_location; | 222 !script->js_scripts().empty() && script->run_location() == run_location; |
223 if (inject_css || inject_js) { | 223 if (inject_css || inject_js) { |
224 injection.reset(new ScriptInjection( | 224 injection.reset(new ScriptInjection( |
225 injector.Pass(), | 225 injector.Pass(), |
226 render_frame, | 226 render_frame, |
227 injection_host.Pass(), | 227 injection_host.Pass(), |
228 run_location, | 228 run_location)); |
229 tab_id)); | |
230 } | 229 } |
231 return injection.Pass(); | 230 return injection.Pass(); |
232 } | 231 } |
233 | 232 |
234 } // namespace extensions | 233 } // namespace extensions |
OLD | NEW |