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

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: All errors removed, Adding UMA stats to track usage of DragAndDrop on ChromeOS, X11, and Windows. A… 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..52200a77880259acabfb6d7f5799af5dd9e23640 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
@@ -6,9 +6,13 @@
#include <X11/Xatom.h>
+#include <map>
+#include <utility>
mfomitchev 2015/01/13 17:01:25 why are these new imports needed?
caelyn 2015/01/13 23:48:58 See reasoning from the .h file.
+
#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 +421,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 +651,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 +663,7 @@ int DesktopDragDropClientAuraX11::StartDragAndDrop(
source_state_ = SOURCE_STATE_OTHER;
drag_operation_ = operation;
negotiated_operation_ = ui::DragDropTypes::DRAG_NONE;
+ current_drag_event_source_ = source;
const ui::OSExchangeData::Provider* provider = &data.provider();
source_provider_ = static_cast<const ui::OSExchangeDataProviderAuraX11*>(
@@ -723,6 +732,8 @@ void DesktopDragDropClientAuraX11::Drop(aura::Window* target,
}
void DesktopDragDropClientAuraX11::DragCancel() {
+ UMA_HISTOGRAM_ENUMERATION("DragDrop.Cancel", current_drag_event_source_,
+ ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT);
move_loop_->EndMoveLoop();
}
@@ -760,7 +771,7 @@ void DesktopDragDropClientAuraX11::OnMouseReleased() {
if (source_state_ != SOURCE_STATE_OTHER) {
// The user has previously released the mouse and is clicking in
// frustration.
- move_loop_->EndMoveLoop();
+ DragCancel();
return;
}
@@ -774,10 +785,11 @@ void DesktopDragDropClientAuraX11::OnMouseReleased() {
// Start timer to end the move loop if the target takes too long to send
// the XdndStatus and XdndFinished messages.
StartEndMoveLoopTimer();
+ DragCancel();
return;
}
- move_loop_->EndMoveLoop();
+ DragCancel();
return;
}
@@ -791,8 +803,13 @@ void DesktopDragDropClientAuraX11::OnMouseReleased() {
// We have negotiated an action with the other end.
source_state_ = SOURCE_STATE_DROPPED;
+ UMA_HISTOGRAM_ENUMERATION("DragDrop.Drop", current_drag_event_source_,
+ ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT);
SendXdndDrop(source_current_window_);
return;
+ } else {
+ DragCancel();
mfomitchev 2015/01/13 17:01:25 Unless there is a good reason not to, just let it
caelyn 2015/01/13 23:48:58 Done.
+ return;
}
}

Powered by Google App Engine
This is Rietveld 408576698