OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | |
7 #include "base/tracked_objects.h" | 8 #include "base/tracked_objects.h" |
8 #include "ui/base/dragdrop/drag_drop_types.h" | 9 #include "ui/base/dragdrop/drag_drop_types.h" |
9 #include "ui/base/dragdrop/drag_source_win.h" | 10 #include "ui/base/dragdrop/drag_source_win.h" |
10 #include "ui/base/dragdrop/drop_target_event.h" | 11 #include "ui/base/dragdrop/drop_target_event.h" |
11 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 12 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
12 #include "ui/views/widget/desktop_aura/desktop_drop_target_win.h" | 13 #include "ui/views/widget/desktop_aura/desktop_drop_target_win.h" |
13 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" | 14 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
14 | 15 |
15 namespace views { | 16 namespace views { |
16 | 17 |
(...skipping 14 matching lines...) Expand all Loading... | |
31 aura::Window* source_window, | 32 aura::Window* source_window, |
32 const gfx::Point& root_location, | 33 const gfx::Point& root_location, |
33 int operation, | 34 int operation, |
34 ui::DragDropTypes::DragEventSource source) { | 35 ui::DragDropTypes::DragEventSource source) { |
35 drag_drop_in_progress_ = true; | 36 drag_drop_in_progress_ = true; |
36 drag_operation_ = operation; | 37 drag_operation_ = operation; |
37 | 38 |
38 drag_source_ = new ui::DragSourceWin; | 39 drag_source_ = new ui::DragSourceWin; |
39 DWORD effect; | 40 DWORD effect; |
40 | 41 |
42 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { | |
43 UMA_HISTOGRAM_COUNTS("DragDrop.Touch.Start", 1); | |
44 } else if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE) { | |
45 UMA_HISTOGRAM_COUNTS("DragDrop.Mouse.Start", 1); | |
46 } | |
47 | |
41 // Use task stopwatch to exclude the drag-drop time current task, if any. | 48 // Use task stopwatch to exclude the drag-drop time current task, if any. |
42 tracked_objects::TaskStopwatch stopwatch; | 49 tracked_objects::TaskStopwatch stopwatch; |
43 stopwatch.Start(); | 50 stopwatch.Start(); |
44 HRESULT result = DoDragDrop( | 51 HRESULT result = DoDragDrop( |
45 ui::OSExchangeDataProviderWin::GetIDataObject(data), drag_source_.get(), | 52 ui::OSExchangeDataProviderWin::GetIDataObject(data), drag_source_.get(), |
46 ui::DragDropTypes::DragOperationToDropEffect(operation), &effect); | 53 ui::DragDropTypes::DragOperationToDropEffect(operation), &effect); |
47 stopwatch.Stop(); | 54 stopwatch.Stop(); |
48 | 55 |
49 drag_drop_in_progress_ = false; | 56 drag_drop_in_progress_ = false; |
50 | 57 |
51 if (result != DRAGDROP_S_DROP) | 58 if (result != DRAGDROP_S_DROP) |
52 effect = DROPEFFECT_NONE; | 59 effect = DROPEFFECT_NONE; |
53 | 60 |
54 return ui::DragDropTypes::DropEffectToDragOperation(effect); | 61 ui::DragDropTypes::DragOperation drag_operation = |
62 ui::DragDropTypes::DropEffectToDragOperation(effect); | |
63 | |
64 if (drag_operation != ui::DragDropTypes::DRAG_NONE) { | |
mfomitchev
2015/01/08 23:30:59
If the operation is not NONE, shouldn't we log a c
caelyn
2015/01/12 22:43:10
If the drag_operation is DRAG_NONE, then we know t
| |
65 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { | |
66 UMA_HISTOGRAM_COUNTS("DragDrop.Touch.Drop", 1); | |
67 } else if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE) { | |
68 UMA_HISTOGRAM_COUNTS("DragDrop.Mouse.Drop", 1); | |
69 } | |
70 } | |
71 | |
72 return drag_operation; | |
55 } | 73 } |
56 | 74 |
57 void DesktopDragDropClientWin::DragUpdate(aura::Window* target, | 75 void DesktopDragDropClientWin::DragUpdate(aura::Window* target, |
58 const ui::LocatedEvent& event) { | 76 const ui::LocatedEvent& event) { |
59 } | 77 } |
60 | 78 |
61 void DesktopDragDropClientWin::Drop(aura::Window* target, | 79 void DesktopDragDropClientWin::Drop(aura::Window* target, |
62 const ui::LocatedEvent& event) { | 80 const ui::LocatedEvent& event) { |
63 } | 81 } |
64 | 82 |
65 void DesktopDragDropClientWin::DragCancel() { | 83 void DesktopDragDropClientWin::DragCancel() { |
66 drag_source_->CancelDrag(); | 84 drag_source_->CancelDrag(); |
67 drag_operation_ = 0; | 85 drag_operation_ = 0; |
68 } | 86 } |
69 | 87 |
70 bool DesktopDragDropClientWin::IsDragDropInProgress() { | 88 bool DesktopDragDropClientWin::IsDragDropInProgress() { |
71 return drag_drop_in_progress_; | 89 return drag_drop_in_progress_; |
72 } | 90 } |
73 | 91 |
74 void DesktopDragDropClientWin::OnNativeWidgetDestroying(HWND window) { | 92 void DesktopDragDropClientWin::OnNativeWidgetDestroying(HWND window) { |
75 if (drop_target_.get()) { | 93 if (drop_target_.get()) { |
76 RevokeDragDrop(window); | 94 RevokeDragDrop(window); |
77 drop_target_ = NULL; | 95 drop_target_ = NULL; |
78 } | 96 } |
79 } | 97 } |
80 | 98 |
81 } // namespace views | 99 } // namespace views |
OLD | NEW |