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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
10 #include "ui/aura/client/drag_drop_client.h" | 10 #include "ui/aura/client/drag_drop_client.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 class DragDropControllerTest; | 29 class DragDropControllerTest; |
30 } | 30 } |
31 | 31 |
32 namespace internal { | 32 namespace internal { |
33 | 33 |
34 class DragImageView; | 34 class DragImageView; |
35 | 35 |
36 class ASH_EXPORT DragDropController | 36 class ASH_EXPORT DragDropController |
37 : public aura::client::DragDropClient, | 37 : public aura::client::DragDropClient, |
38 public aura::EventFilter, | 38 public aura::EventFilter, |
39 public ui::ImplicitAnimationObserver { | 39 public ui::LayerAnimationObserver { |
40 public: | 40 public: |
41 DragDropController(); | 41 DragDropController(); |
42 virtual ~DragDropController(); | 42 virtual ~DragDropController(); |
43 | 43 |
44 void set_should_block_during_drag_drop(bool should_block_during_drag_drop) { | 44 void set_should_block_during_drag_drop(bool should_block_during_drag_drop) { |
45 should_block_during_drag_drop_ = should_block_during_drag_drop; | 45 should_block_during_drag_drop_ = should_block_during_drag_drop; |
46 } | 46 } |
47 | 47 |
48 // Overridden from aura::client::DragDropClient: | 48 // Overridden from aura::client::DragDropClient: |
49 virtual int StartDragAndDrop(const ui::OSExchangeData& data, | 49 virtual int StartDragAndDrop(const ui::OSExchangeData& data, |
50 int operation) OVERRIDE; | 50 int operation) OVERRIDE; |
(...skipping 11 matching lines...) Expand all Loading... |
62 aura::MouseEvent* event) OVERRIDE; | 62 aura::MouseEvent* event) OVERRIDE; |
63 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, | 63 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, |
64 aura::TouchEvent* event) OVERRIDE; | 64 aura::TouchEvent* event) OVERRIDE; |
65 virtual ui::GestureStatus PreHandleGestureEvent( | 65 virtual ui::GestureStatus PreHandleGestureEvent( |
66 aura::Window* target, | 66 aura::Window* target, |
67 aura::GestureEvent* event) OVERRIDE; | 67 aura::GestureEvent* event) OVERRIDE; |
68 | 68 |
69 private: | 69 private: |
70 friend class ash::test::DragDropControllerTest; | 70 friend class ash::test::DragDropControllerTest; |
71 | 71 |
72 // Implementation of ImplicitAnimationObserver | 72 // Overridden from ui::LayerAnimationObserver: |
73 virtual void OnImplicitAnimationsCompleted() OVERRIDE; | 73 virtual void OnLayerAnimationEnded( |
| 74 const ui::LayerAnimationSequence* sequence) OVERRIDE; |
| 75 virtual void OnLayerAnimationAborted( |
| 76 const ui::LayerAnimationSequence* sequence) OVERRIDE; |
| 77 virtual void OnLayerAnimationScheduled( |
| 78 const ui::LayerAnimationSequence* sequence) OVERRIDE {} |
74 | 79 |
75 // Helper method to start drag widget flying back animation. | 80 // Helper method to start drag widget flying back animation. |
76 void StartCanceledAnimation(); | 81 void StartCanceledAnimation(); |
77 | 82 |
78 // Helper method to reset everything. | 83 // Helper method to reset everything. |
79 void Cleanup(); | 84 void Cleanup(); |
80 | 85 |
81 scoped_ptr<DragImageView> drag_image_; | 86 scoped_ptr<DragImageView> drag_image_; |
82 const ui::OSExchangeData* drag_data_; | 87 const ui::OSExchangeData* drag_data_; |
83 int drag_operation_; | 88 int drag_operation_; |
84 aura::Window* dragged_window_; | 89 aura::Window* dragged_window_; |
85 gfx::Point drag_start_location_; | 90 gfx::Point drag_start_location_; |
86 | 91 |
87 bool drag_drop_in_progress_; | 92 bool drag_drop_in_progress_; |
88 | 93 |
89 // Indicates whether the caller should be blocked on a drag/drop session. | 94 // Indicates whether the caller should be blocked on a drag/drop session. |
90 // Only be used for tests. | 95 // Only be used for tests. |
91 bool should_block_during_drag_drop_; | 96 bool should_block_during_drag_drop_; |
92 | 97 |
93 DISALLOW_COPY_AND_ASSIGN(DragDropController); | 98 DISALLOW_COPY_AND_ASSIGN(DragDropController); |
94 }; | 99 }; |
95 | 100 |
96 } // namespace internal | 101 } // namespace internal |
97 } // namespace ash | 102 } // namespace ash |
98 | 103 |
99 #endif // ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ | 104 #endif // ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ |
OLD | NEW |