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; |
} |
} |