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 "ash/drag_drop/drag_drop_controller.h" | 5 #include "ash/drag_drop/drag_drop_controller.h" |
6 | 6 |
7 #include "ash/drag_drop/drag_image_view.h" | 7 #include "ash/drag_drop/drag_image_view.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
14 #include "ui/aura/test/event_generator.h" | 14 #include "ui/aura/test/event_generator.h" |
15 #include "ui/base/animation/linear_animation.h" | 15 #include "ui/base/animation/linear_animation.h" |
16 #include "ui/base/clipboard/clipboard.h" | 16 #include "ui/base/clipboard/clipboard.h" |
17 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 17 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
18 #include "ui/base/dragdrop/drag_drop_types.h" | 18 #include "ui/base/dragdrop/drag_drop_types.h" |
| 19 #include "ui/base/dragdrop/drag_utils.h" |
19 #include "ui/base/dragdrop/os_exchange_data.h" | 20 #include "ui/base/dragdrop/os_exchange_data.h" |
20 #include "ui/base/dragdrop/os_exchange_data_provider_aura.h" | |
21 #include "ui/base/events/event.h" | 21 #include "ui/base/events/event.h" |
22 #include "ui/base/gestures/gesture_types.h" | 22 #include "ui/base/gestures/gesture_types.h" |
23 #include "ui/base/ui_base_switches.h" | 23 #include "ui/base/ui_base_switches.h" |
24 #include "ui/gfx/image/image_skia_rep.h" | 24 #include "ui/gfx/image/image_skia_rep.h" |
25 #include "ui/views/test/test_views_delegate.h" | 25 #include "ui/views/test/test_views_delegate.h" |
26 #include "ui/views/view.h" | 26 #include "ui/views/view.h" |
27 #include "ui/views/views_delegate.h" | 27 #include "ui/views/views_delegate.h" |
28 #include "ui/views/widget/native_widget_aura.h" | 28 #include "ui/views/widget/native_widget_aura.h" |
29 #include "ui/views/widget/native_widget_delegate.h" | 29 #include "ui/views/widget/native_widget_delegate.h" |
30 #include "ui/views/widget/widget.h" | 30 #include "ui/views/widget/widget.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 bool long_tap_received_; | 66 bool long_tap_received_; |
67 | 67 |
68 private: | 68 private: |
69 // View overrides: | 69 // View overrides: |
70 int GetDragOperations(const gfx::Point& press_pt) OVERRIDE { | 70 int GetDragOperations(const gfx::Point& press_pt) OVERRIDE { |
71 return ui::DragDropTypes::DRAG_COPY; | 71 return ui::DragDropTypes::DRAG_COPY; |
72 } | 72 } |
73 | 73 |
74 void WriteDragData(const gfx::Point& p, OSExchangeData* data) OVERRIDE { | 74 void WriteDragData(const gfx::Point& p, OSExchangeData* data) OVERRIDE { |
75 data->SetString(UTF8ToUTF16("I am being dragged")); | 75 data->SetString(UTF8ToUTF16("I am being dragged")); |
76 ui::OSExchangeDataProviderAura& provider = | |
77 static_cast<ui::OSExchangeDataProviderAura&>(data->provider()); | |
78 gfx::ImageSkiaRep* image = new gfx::ImageSkiaRep( | 76 gfx::ImageSkiaRep* image = new gfx::ImageSkiaRep( |
79 gfx::Size(10, 20), ui::SCALE_FACTOR_100P); | 77 gfx::Size(10, 20), ui::SCALE_FACTOR_100P); |
80 gfx::ImageSkia* image_skia = new gfx::ImageSkia(*image); | 78 gfx::ImageSkia* image_skia = new gfx::ImageSkia(*image); |
81 provider.set_drag_image(*image_skia); | 79 |
| 80 drag_utils::SetDragImageOnDataObject( |
| 81 *image_skia, gfx::Size(image_skia->width(), image_skia->height()), |
| 82 gfx::Vector2d(), data); |
82 } | 83 } |
83 | 84 |
84 bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { | 85 bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { |
85 return true; | 86 return true; |
86 } | 87 } |
87 | 88 |
88 void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { | 89 void OnGestureEvent(ui::GestureEvent* event) OVERRIDE { |
89 if (event->type() == ui::ET_GESTURE_LONG_TAP) | 90 if (event->type() == ui::ET_GESTURE_LONG_TAP) |
90 long_tap_received_ = true; | 91 long_tap_received_ = true; |
91 return; | 92 return; |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); | 969 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); |
969 } | 970 } |
970 for (Shell::RootWindowList::iterator iter = root_windows.begin(); | 971 for (Shell::RootWindowList::iterator iter = root_windows.begin(); |
971 iter != root_windows.end(); ++iter) { | 972 iter != root_windows.end(); ++iter) { |
972 aura::client::SetDragDropClient(*iter, NULL); | 973 aura::client::SetDragDropClient(*iter, NULL); |
973 } | 974 } |
974 } | 975 } |
975 | 976 |
976 } // namespace test | 977 } // namespace test |
977 } // namespace aura | 978 } // namespace aura |
OLD | NEW |