Chromium Code Reviews| 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 #ifndef ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ | 5 #ifndef ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ |
| 6 #define ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ | 6 #define ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/display/window_tree_host_manager.h" | |
| 11 #include "base/callback.h" | 12 #include "base/callback.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 14 #include "ui/aura/window_observer.h" | 15 #include "ui/aura/window_observer.h" |
| 15 #include "ui/base/dragdrop/os_exchange_data.h" | 16 #include "ui/base/dragdrop/os_exchange_data.h" |
| 16 #include "ui/events/event_constants.h" | 17 #include "ui/events/event_constants.h" |
| 17 #include "ui/events/event_handler.h" | 18 #include "ui/events/event_handler.h" |
| 18 #include "ui/gfx/animation/animation_delegate.h" | 19 #include "ui/gfx/animation/animation_delegate.h" |
| 19 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
| 20 #include "ui/wm/public/drag_drop_client.h" | 21 #include "ui/wm/public/drag_drop_client.h" |
| 21 | 22 |
| 22 namespace gfx { | 23 namespace gfx { |
| 23 class LinearAnimation; | 24 class LinearAnimation; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace ash { | 27 namespace ash { |
| 27 class DragDropTracker; | 28 class DragDropTracker; |
| 28 class DragDropTrackerDelegate; | 29 class DragDropTrackerDelegate; |
| 29 class DragImageView; | 30 class DragImageView; |
| 30 | 31 |
| 31 namespace test { | 32 namespace test { |
| 32 class DragDropControllerTest; | 33 class DragDropControllerTest; |
| 33 } | 34 } |
| 34 | 35 |
| 35 class ASH_EXPORT DragDropController : public aura::client::DragDropClient, | 36 class ASH_EXPORT DragDropController : public aura::client::DragDropClient, |
| 36 public ui::EventHandler, | 37 public ui::EventHandler, |
| 37 public gfx::AnimationDelegate, | 38 public gfx::AnimationDelegate, |
| 38 public aura::WindowObserver { | 39 public aura::WindowObserver, |
| 40 public WindowTreeHostManager::Observer { | |
|
msw
2016/08/05 19:32:58
nit: use ash/common/wm_display_observer.h instead?
James Cook
2016/08/05 20:10:11
Done.
| |
| 39 public: | 41 public: |
| 40 DragDropController(); | 42 DragDropController(); |
| 41 ~DragDropController() override; | 43 ~DragDropController() override; |
| 42 | 44 |
| 43 void set_should_block_during_drag_drop(bool should_block_during_drag_drop) { | 45 void set_should_block_during_drag_drop(bool should_block_during_drag_drop) { |
| 44 should_block_during_drag_drop_ = should_block_during_drag_drop; | 46 should_block_during_drag_drop_ = should_block_during_drag_drop; |
| 45 } | 47 } |
| 46 | 48 |
| 47 // Overridden from aura::client::DragDropClient: | 49 // Overridden from aura::client::DragDropClient: |
| 48 int StartDragAndDrop(const ui::OSExchangeData& data, | 50 int StartDragAndDrop(const ui::OSExchangeData& data, |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 78 virtual void DoDragCancel(int drag_cancel_animation_duration_ms); | 80 virtual void DoDragCancel(int drag_cancel_animation_duration_ms); |
| 79 | 81 |
| 80 private: | 82 private: |
| 81 friend class ash::test::DragDropControllerTest; | 83 friend class ash::test::DragDropControllerTest; |
| 82 | 84 |
| 83 // Overridden from gfx::AnimationDelegate: | 85 // Overridden from gfx::AnimationDelegate: |
| 84 void AnimationEnded(const gfx::Animation* animation) override; | 86 void AnimationEnded(const gfx::Animation* animation) override; |
| 85 void AnimationProgressed(const gfx::Animation* animation) override; | 87 void AnimationProgressed(const gfx::Animation* animation) override; |
| 86 void AnimationCanceled(const gfx::Animation* animation) override; | 88 void AnimationCanceled(const gfx::Animation* animation) override; |
| 87 | 89 |
| 90 // WindowTreeHostManager::Observer: | |
| 91 void OnDisplayConfigurationChanging() override; | |
| 92 | |
| 88 // Helper method to start drag widget flying back animation. | 93 // Helper method to start drag widget flying back animation. |
| 89 void StartCanceledAnimation(int animation_duration_ms); | 94 void StartCanceledAnimation(int animation_duration_ms); |
| 90 | 95 |
| 91 // Helper method to forward |pending_log_tap_| event to |drag_source_window_|. | 96 // Helper method to forward |pending_log_tap_| event to |drag_source_window_|. |
| 92 void ForwardPendingLongTap(); | 97 void ForwardPendingLongTap(); |
| 93 | 98 |
| 94 // Helper method to reset everything. | 99 // Helper method to reset everything. |
| 95 void Cleanup(); | 100 void Cleanup(); |
| 96 | 101 |
| 97 std::unique_ptr<DragImageView> drag_image_; | 102 std::unique_ptr<DragImageView> drag_image_; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 128 std::unique_ptr<ui::GestureEvent> pending_long_tap_; | 133 std::unique_ptr<ui::GestureEvent> pending_long_tap_; |
| 129 | 134 |
| 130 base::WeakPtrFactory<DragDropController> weak_factory_; | 135 base::WeakPtrFactory<DragDropController> weak_factory_; |
| 131 | 136 |
| 132 DISALLOW_COPY_AND_ASSIGN(DragDropController); | 137 DISALLOW_COPY_AND_ASSIGN(DragDropController); |
| 133 }; | 138 }; |
| 134 | 139 |
| 135 } // namespace ash | 140 } // namespace ash |
| 136 | 141 |
| 137 #endif // ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ | 142 #endif // ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ |
| OLD | NEW |