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

Unified Diff: ash/drag_drop/drag_drop_controller.cc

Issue 800183005: Adding UMA stats for dragdrop events for both touch and mouse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing issue that would have resulted in overcounting cancel events. Created 5 years, 11 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: ash/drag_drop/drag_drop_controller.cc
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index 695c7737865c0919e3f86337ba8d7f80e870aa1b..7b8f2cd36dea2201b033334b661828fece8ef0d4 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -9,6 +9,7 @@
#include "ash/shell.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/histogram_macros.h"
#include "base/run_loop.h"
#include "ui/aura/client/capture_client.h"
#include "ui/aura/env.h"
@@ -159,6 +160,9 @@ int DragDropController::StartDragAndDrop(
provider->GetDragImage().size().IsEmpty())
return 0;
+ UMA_HISTOGRAM_ENUMERATION("DragDrop.Start", source,
+ ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT);
+
current_drag_event_source_ = source;
DragDropTracker* tracker =
new DragDropTracker(root_window, drag_drop_window_delegate_.get());
@@ -310,10 +314,15 @@ void DragDropController::Drop(aura::Window* target,
*drag_data_, event.location(), event.root_location(), drag_operation_);
e.set_flags(event.flags());
drag_operation_ = delegate->OnPerformDrop(e);
- if (drag_operation_ == 0)
+ if (drag_operation_ == 0) {
+ UMA_HISTOGRAM_ENUMERATION("DragDrop.Cancel", current_drag_event_source_,
+ ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT);
StartCanceledAnimation(kCancelAnimationDuration);
- else
+ } else {
+ UMA_HISTOGRAM_ENUMERATION("DragDrop.Drop", current_drag_event_source_,
+ ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT);
drag_image_.reset();
+ }
} else {
drag_image_.reset();
}
@@ -324,6 +333,8 @@ void DragDropController::Drop(aura::Window* target,
}
void DragDropController::DragCancel() {
+ UMA_HISTOGRAM_ENUMERATION("DragDrop.Cancel", current_drag_event_source_,
mfomitchev 2015/01/14 17:03:41 There is at least one case where DoDragCancel is c
caelyn 2015/01/21 16:29:53 Done.
mfomitchev 2015/01/21 18:54:36 Doesn't look like you've moved it. However look at
caelyn 2015/01/21 21:06:41 Oops. I confused this with another thing and hit d
+ ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT);
DoDragCancel(kCancelAnimationDuration);
}
@@ -482,9 +493,9 @@ void DragDropController::AnimationEnded(const gfx::Animation* animation) {
drag_image_.reset();
if (pending_long_tap_) {
// If not in a nested message loop, we can forward the long tap right now.
- if (!should_block_during_drag_drop_)
+ if (!should_block_during_drag_drop_) {
ForwardPendingLongTap();
- else {
+ } else {
// See comment about this in OnGestureEvent().
base::MessageLoopForUI::current()->PostTask(
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698