| 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):
|
|
|