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/tracked_objects.h" |
7 #include "ui/base/dragdrop/drag_drop_types.h" | 8 #include "ui/base/dragdrop/drag_drop_types.h" |
8 #include "ui/base/dragdrop/drag_source_win.h" | 9 #include "ui/base/dragdrop/drag_source_win.h" |
9 #include "ui/base/dragdrop/drop_target_event.h" | 10 #include "ui/base/dragdrop/drop_target_event.h" |
10 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 11 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
11 #include "ui/views/widget/desktop_aura/desktop_drop_target_win.h" | 12 #include "ui/views/widget/desktop_aura/desktop_drop_target_win.h" |
12 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" | 13 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
13 | 14 |
14 namespace views { | 15 namespace views { |
15 | 16 |
16 DesktopDragDropClientWin::DesktopDragDropClientWin( | 17 DesktopDragDropClientWin::DesktopDragDropClientWin( |
(...skipping 12 matching lines...) Expand all Loading... |
29 aura::Window* root_window, | 30 aura::Window* root_window, |
30 aura::Window* source_window, | 31 aura::Window* source_window, |
31 const gfx::Point& root_location, | 32 const gfx::Point& root_location, |
32 int operation, | 33 int operation, |
33 ui::DragDropTypes::DragEventSource source) { | 34 ui::DragDropTypes::DragEventSource source) { |
34 drag_drop_in_progress_ = true; | 35 drag_drop_in_progress_ = true; |
35 drag_operation_ = operation; | 36 drag_operation_ = operation; |
36 | 37 |
37 drag_source_ = new ui::DragSourceWin; | 38 drag_source_ = new ui::DragSourceWin; |
38 DWORD effect; | 39 DWORD effect; |
| 40 |
| 41 // Use task stopwatch to exclude the drag-drop time current task, if any. |
| 42 tracked_objects::TaskStopwatch stopwatch; |
| 43 stopwatch.Start(); |
39 HRESULT result = DoDragDrop( | 44 HRESULT result = DoDragDrop( |
40 ui::OSExchangeDataProviderWin::GetIDataObject(data), drag_source_.get(), | 45 ui::OSExchangeDataProviderWin::GetIDataObject(data), drag_source_.get(), |
41 ui::DragDropTypes::DragOperationToDropEffect(operation), &effect); | 46 ui::DragDropTypes::DragOperationToDropEffect(operation), &effect); |
| 47 stopwatch.Stop(); |
42 | 48 |
43 drag_drop_in_progress_ = false; | 49 drag_drop_in_progress_ = false; |
44 | 50 |
45 if (result != DRAGDROP_S_DROP) | 51 if (result != DRAGDROP_S_DROP) |
46 effect = DROPEFFECT_NONE; | 52 effect = DROPEFFECT_NONE; |
47 | 53 |
48 return ui::DragDropTypes::DropEffectToDragOperation(effect); | 54 return ui::DragDropTypes::DropEffectToDragOperation(effect); |
49 } | 55 } |
50 | 56 |
51 void DesktopDragDropClientWin::DragUpdate(aura::Window* target, | 57 void DesktopDragDropClientWin::DragUpdate(aura::Window* target, |
(...skipping 14 matching lines...) Expand all Loading... |
66 } | 72 } |
67 | 73 |
68 void DesktopDragDropClientWin::OnNativeWidgetDestroying(HWND window) { | 74 void DesktopDragDropClientWin::OnNativeWidgetDestroying(HWND window) { |
69 if (drop_target_.get()) { | 75 if (drop_target_.get()) { |
70 RevokeDragDrop(window); | 76 RevokeDragDrop(window); |
71 drop_target_ = NULL; | 77 drop_target_ = NULL; |
72 } | 78 } |
73 } | 79 } |
74 | 80 |
75 } // namespace views | 81 } // namespace views |
OLD | NEW |