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

Unified Diff: ui/views/touchui/touch_selection_controller_impl.cc

Issue 895903003: Adding UMA logging to touch text selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Histograms.xml Created 5 years, 10 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
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..c53c4880bfddcbc492795ce09793361b4874d631 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::Time::Now();
aura::Window* client_window = client_view_->GetNativeView();
client_window->AddObserver(this);
client_widget_ = Widget::GetTopLevelWidgetForNativeView(client_window);
@@ -425,6 +428,10 @@ TouchSelectionControllerImpl::TouchSelectionControllerImpl(
}
TouchSelectionControllerImpl::~TouchSelectionControllerImpl() {
+ if (!command_executed_) {
+ UMA_HISTOGRAM_BOOLEAN("Event.TouchSelectionEndedWithAction", false);
+ LOG(ERROR) << "Event.TouchSelectionEndedWithAction = false";
+ }
HideContextMenu();
aura::Env::GetInstance()->RemovePreTargetHandler(this);
if (client_widget_)
@@ -594,6 +601,16 @@ bool TouchSelectionControllerImpl::IsCommandIdEnabled(int command_id) const {
void TouchSelectionControllerImpl::ExecuteCommand(int command_id,
int event_flags) {
+ command_executed_ = true;
+ UMA_HISTOGRAM_BOOLEAN("Event.TouchSelectionEndedWithAction", true);
+ base::TimeDelta duration = base::Time::Now() - selection_start_time_;
+ UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelectionDuration",
+ duration,
+ base::TimeDelta::FromMilliseconds(1),
+ base::TimeDelta::FromSeconds(60),
+ 50);
+ LOG(ERROR) << "Event.TouchSelectionEndedWithAction = true";
+ LOG(ERROR) << "duration=" << duration.InMilliseconds() << "ms";
HideContextMenu();
client_view_->ExecuteCommand(command_id, event_flags);
}

Powered by Google App Engine
This is Rietveld 408576698