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/script_injection_manager.h" | 5 #include "extensions/renderer/script_injection_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 211 } |
212 | 212 |
213 void ScriptInjectionManager::RFOHelper::OnExecuteDeclarativeScript( | 213 void ScriptInjectionManager::RFOHelper::OnExecuteDeclarativeScript( |
214 int tab_id, | 214 int tab_id, |
215 const ExtensionId& extension_id, | 215 const ExtensionId& extension_id, |
216 int script_id, | 216 int script_id, |
217 const GURL& url) { | 217 const GURL& url) { |
218 // TODO(markdittmer): URL-checking isn't the best security measure. | 218 // TODO(markdittmer): URL-checking isn't the best security measure. |
219 // Begin script injection workflow only if the current URL is identical to | 219 // Begin script injection workflow only if the current URL is identical to |
220 // the one that matched declarative conditions in the browser. | 220 // the one that matched declarative conditions in the browser. |
221 if (render_frame()->GetWebFrame()->document().url() == url) { | 221 if (GURL(render_frame()->GetWebFrame()->document().url()) == url) { |
222 manager_->HandleExecuteDeclarativeScript(render_frame(), | 222 manager_->HandleExecuteDeclarativeScript(render_frame(), |
223 tab_id, | 223 tab_id, |
224 extension_id, | 224 extension_id, |
225 script_id, | 225 script_id, |
226 url); | 226 url); |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
230 void ScriptInjectionManager::RFOHelper::OnPermitScriptInjection( | 230 void ScriptInjectionManager::RFOHelper::OnPermitScriptInjection( |
231 int64_t request_id) { | 231 int64_t request_id) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 ScriptsRunInfo scripts_run_info(injection->render_frame(), | 502 ScriptsRunInfo scripts_run_info(injection->render_frame(), |
503 UserScript::RUN_DEFERRED); | 503 UserScript::RUN_DEFERRED); |
504 ScriptInjection::InjectionResult res = injection->OnPermissionGranted( | 504 ScriptInjection::InjectionResult res = injection->OnPermissionGranted( |
505 &scripts_run_info); | 505 &scripts_run_info); |
506 if (res == ScriptInjection::INJECTION_BLOCKED) | 506 if (res == ScriptInjection::INJECTION_BLOCKED) |
507 running_injections_.push_back(std::move(injection)); | 507 running_injections_.push_back(std::move(injection)); |
508 scripts_run_info.LogRun(activity_logging_enabled_); | 508 scripts_run_info.LogRun(activity_logging_enabled_); |
509 } | 509 } |
510 | 510 |
511 } // namespace extensions | 511 } // namespace extensions |
OLD | NEW |