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

Unified Diff: extensions/renderer/scripts_run_info.cc

Issue 1216453002: [Extensions] Handle some funny cases in script injection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/renderer/scripts_run_info.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/scripts_run_info.cc
diff --git a/extensions/renderer/scripts_run_info.cc b/extensions/renderer/scripts_run_info.cc
index a7d411592fb2c4fe004a8a6afbbb1542bc5d04e2..b31bbe07ba12ac24c56aa22a65fa791260a7d7c9 100644
--- a/extensions/renderer/scripts_run_info.cc
+++ b/extensions/renderer/scripts_run_info.cc
@@ -6,32 +6,36 @@
#include "base/metrics/histogram.h"
#include "content/public/renderer/render_frame.h"
+#include "content/public/renderer/render_thread.h"
#include "extensions/common/extension_messages.h"
#include "extensions/renderer/script_context.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
namespace extensions {
-ScriptsRunInfo::ScriptsRunInfo()
- : num_css(0u), num_js(0u), num_blocking_js(0u) {
+ScriptsRunInfo::ScriptsRunInfo(content::RenderFrame* render_frame,
+ UserScript::RunLocation location)
+ : num_css(0u),
+ num_js(0u),
+ num_blocking_js(0u),
+ routing_id_(render_frame->GetRoutingID()),
+ run_location_(location),
+ frame_url_(ScriptContext::GetDataSourceURLForFrame(
+ render_frame->GetWebFrame())) {
}
ScriptsRunInfo::~ScriptsRunInfo() {
}
-void ScriptsRunInfo::LogRun(blink::WebLocalFrame* frame,
- UserScript::RunLocation location) {
+void ScriptsRunInfo::LogRun() {
// Notify the browser if any extensions are now executing scripts.
if (!executing_scripts.empty()) {
- content::RenderFrame* render_frame =
- content::RenderFrame::FromWebFrame(frame);
- render_frame->Send(new ExtensionHostMsg_ContentScriptsExecuting(
- render_frame->GetRoutingID(),
- executing_scripts,
- ScriptContext::GetDataSourceURLForFrame(frame)));
+ content::RenderThread::Get()->Send(
+ new ExtensionHostMsg_ContentScriptsExecuting(
+ routing_id_, executing_scripts, frame_url_));
}
- switch (location) {
+ switch (run_location_) {
case UserScript::DOCUMENT_START:
UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_CssCount", num_css);
UMA_HISTOGRAM_COUNTS_100("Extensions.InjectStart_ScriptCount", num_js);
« no previous file with comments | « extensions/renderer/scripts_run_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698