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 "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 should_block_during_drag_drop_ = should_block_during_drag_drop; | 42 should_block_during_drag_drop_ = should_block_during_drag_drop; |
43 } | 43 } |
44 | 44 |
45 // Overridden from aura::client::DragDropClient: | 45 // Overridden from aura::client::DragDropClient: |
46 virtual int StartDragAndDrop( | 46 virtual int StartDragAndDrop( |
47 const ui::OSExchangeData& data, | 47 const ui::OSExchangeData& data, |
48 aura::Window* root_window, | 48 aura::Window* root_window, |
49 aura::Window* source_window, | 49 aura::Window* source_window, |
50 const gfx::Point& root_location, | 50 const gfx::Point& root_location, |
51 int operation, | 51 int operation, |
52 ui::DragDropTypes::DragEventSource source) OVERRIDE; | 52 ui::DragDropTypes::DragEventSource source) override; |
53 virtual void DragUpdate(aura::Window* target, | 53 virtual void DragUpdate(aura::Window* target, |
54 const ui::LocatedEvent& event) OVERRIDE; | 54 const ui::LocatedEvent& event) override; |
55 virtual void Drop(aura::Window* target, | 55 virtual void Drop(aura::Window* target, |
56 const ui::LocatedEvent& event) OVERRIDE; | 56 const ui::LocatedEvent& event) override; |
57 virtual void DragCancel() OVERRIDE; | 57 virtual void DragCancel() override; |
58 virtual bool IsDragDropInProgress() OVERRIDE; | 58 virtual bool IsDragDropInProgress() override; |
59 | 59 |
60 // Overridden from ui::EventHandler: | 60 // Overridden from ui::EventHandler: |
61 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 61 virtual void OnKeyEvent(ui::KeyEvent* event) override; |
62 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 62 virtual void OnMouseEvent(ui::MouseEvent* event) override; |
63 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; | 63 virtual void OnTouchEvent(ui::TouchEvent* event) override; |
64 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 64 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
65 | 65 |
66 // Overridden from aura::WindowObserver. | 66 // Overridden from aura::WindowObserver. |
67 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 67 virtual void OnWindowDestroyed(aura::Window* window) override; |
68 | 68 |
69 protected: | 69 protected: |
70 // Helper method to create a LinearAnimation object that will run the drag | 70 // Helper method to create a LinearAnimation object that will run the drag |
71 // cancel animation. Caller take ownership of the returned object. Protected | 71 // cancel animation. Caller take ownership of the returned object. Protected |
72 // for testing. | 72 // for testing. |
73 virtual gfx::LinearAnimation* CreateCancelAnimation( | 73 virtual gfx::LinearAnimation* CreateCancelAnimation( |
74 int duration, | 74 int duration, |
75 int frame_rate, | 75 int frame_rate, |
76 gfx::AnimationDelegate* delegate); | 76 gfx::AnimationDelegate* delegate); |
77 | 77 |
78 // Actual implementation of |DragCancel()|. protected for testing. | 78 // Actual implementation of |DragCancel()|. protected for testing. |
79 virtual void DoDragCancel(int drag_cancel_animation_duration_ms); | 79 virtual void DoDragCancel(int drag_cancel_animation_duration_ms); |
80 | 80 |
81 private: | 81 private: |
82 friend class ash::test::DragDropControllerTest; | 82 friend class ash::test::DragDropControllerTest; |
83 | 83 |
84 // Overridden from gfx::AnimationDelegate: | 84 // Overridden from gfx::AnimationDelegate: |
85 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; | 85 virtual void AnimationEnded(const gfx::Animation* animation) override; |
86 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | 86 virtual void AnimationProgressed(const gfx::Animation* animation) override; |
87 virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE; | 87 virtual void AnimationCanceled(const gfx::Animation* animation) override; |
88 | 88 |
89 // Helper method to start drag widget flying back animation. | 89 // Helper method to start drag widget flying back animation. |
90 void StartCanceledAnimation(int animation_duration_ms); | 90 void StartCanceledAnimation(int animation_duration_ms); |
91 | 91 |
92 // Helper method to forward |pending_log_tap_| event to |drag_source_window_|. | 92 // Helper method to forward |pending_log_tap_| event to |drag_source_window_|. |
93 void ForwardPendingLongTap(); | 93 void ForwardPendingLongTap(); |
94 | 94 |
95 // Helper method to reset everything. | 95 // Helper method to reset everything. |
96 void Cleanup(); | 96 void Cleanup(); |
97 | 97 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 scoped_ptr<ui::GestureEvent> pending_long_tap_; | 129 scoped_ptr<ui::GestureEvent> pending_long_tap_; |
130 | 130 |
131 base::WeakPtrFactory<DragDropController> weak_factory_; | 131 base::WeakPtrFactory<DragDropController> weak_factory_; |
132 | 132 |
133 DISALLOW_COPY_AND_ASSIGN(DragDropController); | 133 DISALLOW_COPY_AND_ASSIGN(DragDropController); |
134 }; | 134 }; |
135 | 135 |
136 } // namespace ash | 136 } // namespace ash |
137 | 137 |
138 #endif // ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ | 138 #endif // ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ |
OLD | NEW |