| Index: components/app_modal/javascript_dialog_manager.cc
|
| diff --git a/components/app_modal/javascript_dialog_manager.cc b/components/app_modal/javascript_dialog_manager.cc
|
| index 2b6ec646cebf8d6edc574a13e5f4bb43a38df1c7..c9fd1a0d166eb12a6fd4cf49c7503d7f958eedf3 100644
|
| --- a/components/app_modal/javascript_dialog_manager.cc
|
| +++ b/components/app_modal/javascript_dialog_manager.cc
|
| @@ -9,6 +9,7 @@
|
| #include "base/bind.h"
|
| #include "base/i18n/rtl.h"
|
| #include "base/macros.h"
|
| +#include "base/metrics/histogram_macros.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "components/app_modal/app_modal_dialog.h"
|
| #include "components/app_modal/app_modal_dialog_queue.h"
|
| @@ -100,6 +101,25 @@ void JavaScriptDialogManager::RunJavaScriptDialog(
|
| return;
|
| }
|
|
|
| + base::TimeTicks now = base::TimeTicks::Now();
|
| + if (!last_creation_time_.is_null()) {
|
| + // A new dialog has been created: log the time since the last one was
|
| + // created.
|
| + UMA_HISTOGRAM_MEDIUM_TIMES(
|
| + "JSDialogs.FineTiming.TimeBetweenDialogCreatedAndNextDialogCreated",
|
| + now - last_creation_time_);
|
| + }
|
| + last_creation_time_ = now;
|
| +
|
| + // Also log the time since a dialog was closed, but only if this is the first
|
| + // dialog that was opened since the closing.
|
| + if (!last_close_time_.is_null()) {
|
| + UMA_HISTOGRAM_MEDIUM_TIMES(
|
| + "JSDialogs.FineTiming.TimeBetweenDialogClosedAndNextDialogCreated",
|
| + now - last_close_time_);
|
| + last_close_time_ = base::TimeTicks();
|
| + }
|
| +
|
| bool is_alert = message_type == content::JAVASCRIPT_MESSAGE_TYPE_ALERT;
|
| base::string16 dialog_title =
|
| GetTitle(web_contents, origin_url, accept_lang, is_alert);
|
| @@ -249,6 +269,8 @@ void JavaScriptDialogManager::OnDialogClosed(
|
| // their WebContents is destroyed so |web_contents| is still valid here.)
|
| extensions_client_->OnDialogClosed(web_contents);
|
|
|
| + last_close_time_ = base::TimeTicks::Now();
|
| +
|
| callback.Run(success, user_input);
|
| }
|
|
|
|
|