Chromium Code Reviews| Index: ui/views/touchui/touch_selection_controller_impl.cc |
| diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc |
| index 3ed8c0b388a13f595a20c1c04366ca391c2f899e..abfd6d9c93d1320ecc863dd5fc0e9e871cc636cf 100644 |
| --- a/ui/views/touchui/touch_selection_controller_impl.cc |
| +++ b/ui/views/touchui/touch_selection_controller_impl.cc |
| @@ -4,6 +4,7 @@ |
| #include "ui/views/touchui/touch_selection_controller_impl.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "base/time/time.h" |
| #include "ui/aura/client/cursor_client.h" |
| #include "ui/aura/env.h" |
| @@ -415,7 +416,9 @@ TouchSelectionControllerImpl::TouchSelectionControllerImpl( |
| client_view->GetNativeView(), |
| true)), |
| context_menu_(nullptr), |
| + command_executed_(false), |
| dragging_handle_(nullptr) { |
| + selection_start_time_ = base::TimeTicks::Now(); |
| aura::Window* client_window = client_view_->GetNativeView(); |
| client_window->AddObserver(this); |
| client_widget_ = Widget::GetTopLevelWidgetForNativeView(client_window); |
| @@ -425,6 +428,8 @@ TouchSelectionControllerImpl::TouchSelectionControllerImpl( |
| } |
| TouchSelectionControllerImpl::~TouchSelectionControllerImpl() { |
| + UMA_HISTOGRAM_BOOLEAN("Event.TouchSelectionEndedWithAction", |
| + command_executed_); |
| HideContextMenu(); |
| aura::Env::GetInstance()->RemovePreTargetHandler(this); |
| if (client_widget_) |
| @@ -594,6 +599,15 @@ bool TouchSelectionControllerImpl::IsCommandIdEnabled(int command_id) const { |
| void TouchSelectionControllerImpl::ExecuteCommand(int command_id, |
| int event_flags) { |
| + command_executed_ = true; |
| + base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; |
| + // Note that we only log the duration stats for the 'successful' selections, |
| + // i.e. selections ending with the execution of a command. |
| + UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelectionDuration", |
| + duration, |
| + base::TimeDelta::FromMilliseconds(1000), |
|
Alexei Svitkine (slow)
2015/02/10 22:23:04
Could you explain what kind of info you're hoping
jdduke (slow)
2015/02/10 22:29:00
Yeah, I'm thinking we should at least go down to 5
mfomitchev
2015/02/10 23:22:54
Perhaps 1s is a bit low. I actually tried before
|
| + base::TimeDelta::FromSeconds(60), |
| + 50); |
| HideContextMenu(); |
| client_view_->ExecuteCommand(command_id, event_flags); |
| } |