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_drop_tracker.h" | 7 #include "ash/drag_drop/drag_drop_tracker.h" |
8 #include "ash/drag_drop/drag_image_view.h" | 8 #include "ash/drag_drop/drag_image_view.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "ui/aura/client/capture_client.h" | 14 #include "ui/aura/client/capture_client.h" |
15 #include "ui/aura/window_event_dispatcher.h" | 15 #include "ui/aura/window_event_dispatcher.h" |
16 #include "ui/aura/window_tree_host.h" | 16 #include "ui/aura/window_tree_host.h" |
17 #include "ui/base/clipboard/clipboard.h" | 17 #include "ui/base/clipboard/clipboard.h" |
18 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 18 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
19 #include "ui/base/dragdrop/drag_drop_types.h" | 19 #include "ui/base/dragdrop/drag_drop_types.h" |
20 #include "ui/base/dragdrop/drag_utils.h" | |
21 #include "ui/base/dragdrop/os_exchange_data.h" | 20 #include "ui/base/dragdrop/os_exchange_data.h" |
22 #include "ui/base/ui_base_switches.h" | 21 #include "ui/base/ui_base_switches.h" |
23 #include "ui/events/event.h" | 22 #include "ui/events/event.h" |
24 #include "ui/events/event_utils.h" | 23 #include "ui/events/event_utils.h" |
25 #include "ui/events/gesture_detection/gesture_configuration.h" | 24 #include "ui/events/gesture_detection/gesture_configuration.h" |
26 #include "ui/events/gestures/gesture_types.h" | 25 #include "ui/events/gestures/gesture_types.h" |
27 #include "ui/events/test/event_generator.h" | 26 #include "ui/events/test/event_generator.h" |
28 #include "ui/events/test/events_test_utils.h" | 27 #include "ui/events/test/events_test_utils.h" |
29 #include "ui/gfx/animation/linear_animation.h" | 28 #include "ui/gfx/animation/linear_animation.h" |
30 #include "ui/gfx/image/image_skia_rep.h" | 29 #include "ui/gfx/image/image_skia_rep.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 private: | 69 private: |
71 // View overrides: | 70 // View overrides: |
72 int GetDragOperations(const gfx::Point& press_pt) override { | 71 int GetDragOperations(const gfx::Point& press_pt) override { |
73 return ui::DragDropTypes::DRAG_COPY; | 72 return ui::DragDropTypes::DRAG_COPY; |
74 } | 73 } |
75 | 74 |
76 void WriteDragData(const gfx::Point& p, OSExchangeData* data) override { | 75 void WriteDragData(const gfx::Point& p, OSExchangeData* data) override { |
77 data->SetString(base::UTF8ToUTF16("I am being dragged")); | 76 data->SetString(base::UTF8ToUTF16("I am being dragged")); |
78 gfx::ImageSkiaRep image_rep(gfx::Size(10, 20), 1.0f); | 77 gfx::ImageSkiaRep image_rep(gfx::Size(10, 20), 1.0f); |
79 gfx::ImageSkia image_skia(image_rep); | 78 gfx::ImageSkia image_skia(image_rep); |
80 | 79 data->provider().SetDragImage(image_skia, gfx::Vector2d()); |
81 drag_utils::SetDragImageOnDataObject(image_skia, gfx::Vector2d(), data); | |
82 } | 80 } |
83 | 81 |
84 bool OnMousePressed(const ui::MouseEvent& event) override { return true; } | 82 bool OnMousePressed(const ui::MouseEvent& event) override { return true; } |
85 | 83 |
86 void OnGestureEvent(ui::GestureEvent* event) override { | 84 void OnGestureEvent(ui::GestureEvent* event) override { |
87 if (event->type() == ui::ET_GESTURE_LONG_TAP) | 85 if (event->type() == ui::ET_GESTURE_LONG_TAP) |
88 long_tap_received_ = true; | 86 long_tap_received_ = true; |
89 return; | 87 return; |
90 } | 88 } |
91 | 89 |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 drag_drop_controller_->drag_string_); | 1096 drag_drop_controller_->drag_string_); |
1099 EXPECT_EQ(1, drag_view->num_drag_enters_); | 1097 EXPECT_EQ(1, drag_view->num_drag_enters_); |
1100 EXPECT_EQ(2, drag_view->num_drag_updates_); | 1098 EXPECT_EQ(2, drag_view->num_drag_updates_); |
1101 EXPECT_EQ(1, drag_view->num_drops_); | 1099 EXPECT_EQ(1, drag_view->num_drops_); |
1102 EXPECT_EQ(0, drag_view->num_drag_exits_); | 1100 EXPECT_EQ(0, drag_view->num_drag_exits_); |
1103 EXPECT_TRUE(drag_view->drag_done_received_); | 1101 EXPECT_TRUE(drag_view->drag_done_received_); |
1104 } | 1102 } |
1105 | 1103 |
1106 } // namespace test | 1104 } // namespace test |
1107 } // namespace ash | 1105 } // namespace ash |
OLD | NEW |