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

Unified Diff: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.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: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
index 8a56b8de9689f8132adc9f2190b3154f4dced4b0..61ecdecced1c385bce4df4b8e0ebeaaa331cfe5a 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
@@ -9,6 +9,7 @@
#include "base/event_types.h"
#include "base/lazy_instance.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/histogram_macros.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/aura/client/capture_client.h"
#include "ui/aura/window.h"
@@ -417,6 +418,7 @@ DesktopDragDropClientAuraX11::DesktopDragDropClientAuraX11(
source_current_window_(None),
source_state_(SOURCE_STATE_OTHER),
drag_operation_(0),
+ current_drag_event_source_(ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE),
negotiated_operation_(ui::DragDropTypes::DRAG_NONE),
weak_ptr_factory_(this) {
// Some tests change the DesktopDragDropClientAuraX11 associated with an
@@ -646,6 +648,9 @@ int DesktopDragDropClientAuraX11::StartDragAndDrop(
const gfx::Point& root_location,
int operation,
ui::DragDropTypes::DragEventSource source) {
+ UMA_HISTOGRAM_ENUMERATION("DragDrop.Start", source,
+ ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT);
+
source_current_window_ = None;
DCHECK(!g_current_drag_drop_client);
g_current_drag_drop_client = this;
@@ -655,6 +660,7 @@ int DesktopDragDropClientAuraX11::StartDragAndDrop(
source_state_ = SOURCE_STATE_OTHER;
drag_operation_ = operation;
negotiated_operation_ = ui::DragDropTypes::DRAG_NONE;
+ current_drag_event_source_ = source;
pkotwicz 2015/01/14 18:31:30 Chrome for Desktop Linux does not support initiati
caelyn 2015/01/14 20:00:26 I know that chrome on linux does not support touch
pkotwicz 2015/01/14 20:39:55 Once you move all of the histograms to this method
caelyn 2015/01/21 16:29:53 Done.
const ui::OSExchangeData::Provider* provider = &data.provider();
source_provider_ = static_cast<const ui::OSExchangeDataProviderAuraX11*>(
@@ -723,6 +729,8 @@ void DesktopDragDropClientAuraX11::Drop(aura::Window* target,
}
void DesktopDragDropClientAuraX11::DragCancel() {
+ // EndMoveLoop will call DesktopDragDropClientAuraX11::OnMoveLoopEnded and
mfomitchev 2015/01/14 17:03:41 IMHO this is not really worth explaining in a comm
caelyn 2015/01/21 16:29:53 Done.
+ // record a DragDrop.Cancel event in UMA
move_loop_->EndMoveLoop();
}
@@ -800,6 +808,13 @@ void DesktopDragDropClientAuraX11::OnMouseReleased() {
}
void DesktopDragDropClientAuraX11::OnMoveLoopEnded() {
+ if (negotiated_operation_ == ui::DragDropTypes::DRAG_NONE) {
+ UMA_HISTOGRAM_ENUMERATION("DragDrop.Cancel", current_drag_event_source_,
+ ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT);
+ } else {
+ UMA_HISTOGRAM_ENUMERATION("DragDrop.Drop", current_drag_event_source_,
+ ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT);
+ }
if (source_current_window_ != None) {
SendXdndLeave(source_current_window_);
source_current_window_ = None;

Powered by Google App Engine
This is Rietveld 408576698