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

Unified Diff: chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc

Issue 2502493002: Add UMA metrics to see the proportions of dialogs spawned by foremost pages. (Closed)
Patch Set: boolean Created 4 years, 1 month 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc
diff --git a/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc
index dd52e788c6c634380fed2c5ca9a9966a4076e6e1..a01ee561e36b1fcd816d77c366486a2a7e7c06db 100644
--- a/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc
+++ b/chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc
@@ -76,10 +76,22 @@ void JavaScriptDialogTabHelper::RunJavaScriptDialog(
message_length);
}
- if (IsEnabled()) {
- content::WebContents* parent_web_contents =
- WebContentsObserver::web_contents();
+ content::WebContents* parent_web_contents =
+ WebContentsObserver::web_contents();
+ bool foremost = IsWebContentsForemost(parent_web_contents);
+ switch (message_type) {
+ case content::JAVASCRIPT_MESSAGE_TYPE_ALERT:
+ UMA_HISTOGRAM_BOOLEAN("JSDialogs.IsForemost.Alert", foremost);
+ break;
+ case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM:
+ UMA_HISTOGRAM_BOOLEAN("JSDialogs.IsForemost.Confirm", foremost);
+ break;
+ case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT:
+ UMA_HISTOGRAM_BOOLEAN("JSDialogs.IsForemost.Prompt", foremost);
+ break;
+ }
+ if (IsEnabled()) {
if (!IsWebContentsForemost(parent_web_contents) &&
message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) {
// Don't allow "prompt" dialogs to steal the user's focus. TODO(avi):
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698