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

Unified Diff: extensions/renderer/extension_frame_helper.cc

Issue 2925193002: NOT YET READY: UMA recording the kind of target frame when extensions pierce browsing instance.
Patch Set: Rebasing... Created 3 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/extension_frame_helper.h ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/extension_frame_helper.cc
diff --git a/extensions/renderer/extension_frame_helper.cc b/extensions/renderer/extension_frame_helper.cc
index 6a91e015b28e65a673f9ba84220d35c67f76394c..2856ef30c6e95092a83a5da34093e5dbfd90acc3 100644
--- a/extensions/renderer/extension_frame_helper.cc
+++ b/extensions/renderer/extension_frame_helper.cc
@@ -4,6 +4,8 @@
#include "extensions/renderer/extension_frame_helper.h"
+#include <set>
+
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/timer/elapsed_timer.h"
@@ -157,12 +159,27 @@ content::RenderFrame* ExtensionFrameHelper::FindFrame(
// Try to match all same-origin frames in this process.
for (const ExtensionFrameHelper* helper : g_frame_helpers.Get()) {
+ if (helper->render_frame()->GetWebFrame()->AssignedName().Utf8() != name)
+ continue;
+
if (!relative_to_frame->GetWebFrame()->GetSecurityOrigin().CanAccess(
helper->render_frame()->GetWebFrame()->GetSecurityOrigin()))
continue;
- if (helper->render_frame()->GetWebFrame()->AssignedName().Utf8() == name)
- return helper->render_frame();
+ UMA_HISTOGRAM_ENUMERATION(
+ "Extensions.BrowsingInstanceViolation.ExtensionViewType",
+ helper->view_type(), VIEW_TYPE_LAST);
+ GURL effective_target_url = ScriptContext::GetEffectiveDocumentURL(
+ helper->render_frame()->GetWebFrame(),
+ helper->render_frame()->GetWebFrame()->GetDocument().Url(), true);
+ const Extension* target_extension =
+ extensions::RendererExtensionRegistry::Get()->GetExtensionOrAppByURL(
+ effective_target_url);
+ UMA_HISTOGRAM_ENUMERATION(
+ "Extensions.BrowsingInstanceViolation.ExtensionType",
+ target_extension->GetType(), Manifest::TYPE_MAX);
+
+ return helper->render_frame();
}
return nullptr;
« no previous file with comments | « extensions/renderer/extension_frame_helper.h ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698