| 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/root_window.h" | 15 #include "ui/aura/root_window.h" |
| 16 #include "ui/aura/test/event_generator.h" | 16 #include "ui/aura/test/event_generator.h" |
| 17 #include "ui/base/animation/linear_animation.h" | |
| 18 #include "ui/base/clipboard/clipboard.h" | 17 #include "ui/base/clipboard/clipboard.h" |
| 19 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 18 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 20 #include "ui/base/dragdrop/drag_drop_types.h" | 19 #include "ui/base/dragdrop/drag_drop_types.h" |
| 21 #include "ui/base/dragdrop/drag_utils.h" | 20 #include "ui/base/dragdrop/drag_utils.h" |
| 22 #include "ui/base/dragdrop/os_exchange_data.h" | 21 #include "ui/base/dragdrop/os_exchange_data.h" |
| 23 #include "ui/base/events/event.h" | 22 #include "ui/base/events/event.h" |
| 24 #include "ui/base/events/event_utils.h" | 23 #include "ui/base/events/event_utils.h" |
| 25 #include "ui/base/gestures/gesture_types.h" | 24 #include "ui/base/gestures/gesture_types.h" |
| 26 #include "ui/base/ui_base_switches.h" | 25 #include "ui/base/ui_base_switches.h" |
| 26 #include "ui/gfx/animation/linear_animation.h" |
| 27 #include "ui/gfx/image/image_skia_rep.h" | 27 #include "ui/gfx/image/image_skia_rep.h" |
| 28 #include "ui/views/test/test_views_delegate.h" | 28 #include "ui/views/test/test_views_delegate.h" |
| 29 #include "ui/views/view.h" | 29 #include "ui/views/view.h" |
| 30 #include "ui/views/views_delegate.h" | 30 #include "ui/views/views_delegate.h" |
| 31 #include "ui/views/widget/native_widget_aura.h" | 31 #include "ui/views/widget/native_widget_aura.h" |
| 32 #include "ui/views/widget/native_widget_delegate.h" | 32 #include "ui/views/widget/native_widget_delegate.h" |
| 33 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
| 34 | 34 |
| 35 namespace ash { | 35 namespace ash { |
| 36 namespace test { | 36 namespace test { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return ui::DragDropTypes::DRAG_COPY; | 123 return ui::DragDropTypes::DRAG_COPY; |
| 124 } | 124 } |
| 125 | 125 |
| 126 virtual void OnDragDone() OVERRIDE { | 126 virtual void OnDragDone() OVERRIDE { |
| 127 drag_done_received_ = true; | 127 drag_done_received_ = true; |
| 128 } | 128 } |
| 129 | 129 |
| 130 DISALLOW_COPY_AND_ASSIGN(DragTestView); | 130 DISALLOW_COPY_AND_ASSIGN(DragTestView); |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 class CompletableLinearAnimation : public ui::LinearAnimation { | 133 class CompletableLinearAnimation : public gfx::LinearAnimation { |
| 134 public: | 134 public: |
| 135 CompletableLinearAnimation(int duration, | 135 CompletableLinearAnimation(int duration, |
| 136 int frame_rate, | 136 int frame_rate, |
| 137 ui::AnimationDelegate* delegate) | 137 gfx::AnimationDelegate* delegate) |
| 138 : ui::LinearAnimation(duration, frame_rate, delegate), | 138 : gfx::LinearAnimation(duration, frame_rate, delegate), |
| 139 duration_(duration) { | 139 duration_(duration) { |
| 140 } | 140 } |
| 141 | 141 |
| 142 void Complete() { | 142 void Complete() { |
| 143 Step(start_time() + base::TimeDelta::FromMilliseconds(duration_)); | 143 Step(start_time() + base::TimeDelta::FromMilliseconds(duration_)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 private: | 146 private: |
| 147 int duration_; | 147 int duration_; |
| 148 }; | 148 }; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 const ui::LocatedEvent& event) OVERRIDE { | 184 const ui::LocatedEvent& event) OVERRIDE { |
| 185 DragDropController::Drop(target, event); | 185 DragDropController::Drop(target, event); |
| 186 drop_received_ = true; | 186 drop_received_ = true; |
| 187 } | 187 } |
| 188 | 188 |
| 189 virtual void DragCancel() OVERRIDE { | 189 virtual void DragCancel() OVERRIDE { |
| 190 DragDropController::DragCancel(); | 190 DragDropController::DragCancel(); |
| 191 drag_canceled_ = true; | 191 drag_canceled_ = true; |
| 192 } | 192 } |
| 193 | 193 |
| 194 virtual ui::LinearAnimation* CreateCancelAnimation( | 194 virtual gfx::LinearAnimation* CreateCancelAnimation( |
| 195 int duration, | 195 int duration, |
| 196 int frame_rate, | 196 int frame_rate, |
| 197 ui::AnimationDelegate* delegate) OVERRIDE { | 197 gfx::AnimationDelegate* delegate) OVERRIDE { |
| 198 return new CompletableLinearAnimation(duration, frame_rate, delegate); | 198 return new CompletableLinearAnimation(duration, frame_rate, delegate); |
| 199 } | 199 } |
| 200 | 200 |
| 201 virtual void DoDragCancel(int animation_duration_ms) OVERRIDE { | 201 virtual void DoDragCancel(int animation_duration_ms) OVERRIDE { |
| 202 DragDropController::DoDragCancel(animation_duration_ms); | 202 DragDropController::DoDragCancel(animation_duration_ms); |
| 203 drag_canceled_ = true; | 203 drag_canceled_ = true; |
| 204 } | 204 } |
| 205 | 205 |
| 206 bool drag_start_received_; | 206 bool drag_start_received_; |
| 207 int num_drag_updates_; | 207 int num_drag_updates_; |
| (...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); | 1099 EXPECT_EQ("405,405", observer.window_location_on_destroying().ToString()); |
| 1100 } | 1100 } |
| 1101 for (Shell::RootWindowList::iterator iter = root_windows.begin(); | 1101 for (Shell::RootWindowList::iterator iter = root_windows.begin(); |
| 1102 iter != root_windows.end(); ++iter) { | 1102 iter != root_windows.end(); ++iter) { |
| 1103 aura::client::SetDragDropClient(*iter, NULL); | 1103 aura::client::SetDragDropClient(*iter, NULL); |
| 1104 } | 1104 } |
| 1105 } | 1105 } |
| 1106 | 1106 |
| 1107 } // namespace test | 1107 } // namespace test |
| 1108 } // namespace aura | 1108 } // namespace aura |
| OLD | NEW |