Index: extensions/renderer/user_script_slave.cc |
diff --git a/extensions/renderer/user_script_slave.cc b/extensions/renderer/user_script_slave.cc |
index 64cd3f65e1090cc47eb0fbda33e067c4c7c271cc..5feea446f52a780a5699237064b5092420f8845d 100644 |
--- a/extensions/renderer/user_script_slave.cc |
+++ b/extensions/renderer/user_script_slave.cc |
@@ -194,6 +194,10 @@ void UserScriptSlave::InjectScripts(WebFrame* frame, |
ExecutingScriptsMap extensions_executing_scripts; |
+ blink::WebFrame* top_frame = frame->top(); |
+ content::RenderView* render_view = |
not at google - send to devlin
2014/05/07 22:49:02
top_render_view?
Devlin
2014/05/08 18:15:46
Why not.
|
+ content::RenderView::FromWebView(top_frame->view()); |
+ |
for (size_t i = 0; i < scripts_.size(); ++i) { |
std::vector<WebScriptSource> sources; |
UserScript* script = scripts_[i]; |
@@ -214,7 +218,7 @@ void UserScriptSlave::InjectScripts(WebFrame* frame, |
const int kNoProcessId = -1; |
if (!PermissionsData::CanExecuteScriptOnPage(extension, |
data_source_url, |
- frame->top()->document().url(), |
+ top_frame->document().url(), |
kNoTabId, |
script, |
kNoProcessId, |
@@ -234,6 +238,14 @@ void UserScriptSlave::InjectScripts(WebFrame* frame, |
} |
if (script->run_location() == location) { |
+ // TODO(rdevlin.cronin): Right now, this is just a notification, but soon |
+ // we should block without user consent. |
+ if (PermissionsData::ShouldNotifyForScriptExecution(extension)) { |
+ render_view->Send( |
+ new ExtensionHostMsg_NotifyExtensionScriptExecution( |
+ render_view->GetRoutingID(), |
not at google - send to devlin
2014/05/07 22:49:02
(need page ID)
Devlin
2014/05/08 18:15:46
Done.
|
+ extension->id())); |
+ } |
num_scripts += script->js_scripts().size(); |
for (size_t j = 0; j < script->js_scripts().size(); ++j) { |
UserScript::File& file = script->js_scripts()[j]; |
@@ -282,9 +294,6 @@ void UserScriptSlave::InjectScripts(WebFrame* frame, |
// Notify the browser if any extensions are now executing scripts. |
if (!extensions_executing_scripts.empty()) { |
- blink::WebFrame* top_frame = frame->top(); |
- content::RenderView* render_view = |
- content::RenderView::FromWebView(top_frame->view()); |
render_view->Send(new ExtensionHostMsg_ContentScriptsExecuting( |
render_view->GetRoutingID(), |
extensions_executing_scripts, |