OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_AURA_SHELL_DRAG_DROP_CONTROLLER_H_ |
| 6 #define UI_AURA_SHELL_DRAG_DROP_CONTROLLER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "ui/aura_shell/aura_shell_export.h" |
| 10 #include "ui/aura/client/drag_drop_client.h" |
| 11 #include "ui/aura/event.h" |
| 12 #include "ui/aura/event_filter.h" |
| 13 #include "ui/base/dragdrop/os_exchange_data.h" |
| 14 #include "ui/base/events.h" |
| 15 #include "ui/gfx/point.h" |
| 16 |
| 17 namespace aura { |
| 18 class Window; |
| 19 } |
| 20 |
| 21 namespace aura_shell { |
| 22 |
| 23 namespace test { |
| 24 class DragDropControllerTest; |
| 25 } |
| 26 |
| 27 namespace internal { |
| 28 |
| 29 class DragImageView; |
| 30 |
| 31 class AURA_SHELL_EXPORT DragDropController : public aura::DragDropClient, |
| 32 public aura::EventFilter { |
| 33 public: |
| 34 DragDropController(); |
| 35 virtual ~DragDropController(); |
| 36 |
| 37 void set_should_block_during_drag_drop(bool should_block_during_drag_drop) { |
| 38 should_block_during_drag_drop_ = should_block_during_drag_drop; |
| 39 } |
| 40 |
| 41 // Overridden from aura::DragDropClient: |
| 42 virtual void StartDragAndDrop(const ui::OSExchangeData& data, |
| 43 int operation) OVERRIDE; |
| 44 virtual void DragUpdate(aura::Window* target, |
| 45 const aura::MouseEvent& event) OVERRIDE; |
| 46 virtual void Drop(aura::Window* target, |
| 47 const aura::MouseEvent& event) OVERRIDE; |
| 48 virtual void DragCancel() OVERRIDE; |
| 49 |
| 50 // Overridden from aura::EventFilter: |
| 51 virtual bool PreHandleKeyEvent(aura::Window* target, |
| 52 aura::KeyEvent* event) OVERRIDE; |
| 53 virtual bool PreHandleMouseEvent(aura::Window* target, |
| 54 aura::MouseEvent* event) OVERRIDE; |
| 55 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, |
| 56 aura::TouchEvent* event) OVERRIDE; |
| 57 |
| 58 private: |
| 59 friend class aura_shell::test::DragDropControllerTest; |
| 60 |
| 61 // Helper method to reset everything. |
| 62 void Cleanup(); |
| 63 |
| 64 scoped_ptr<DragImageView> drag_image_; |
| 65 const ui::OSExchangeData* drag_data_; |
| 66 int drag_operation_; |
| 67 aura::Window* dragged_window_; |
| 68 |
| 69 bool drag_drop_in_progress_; |
| 70 |
| 71 // Indicates whether the caller should be blocked on a drag/drop session. |
| 72 // Only be used for tests. |
| 73 bool should_block_during_drag_drop_; |
| 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(DragDropController); |
| 76 }; |
| 77 |
| 78 } // namespace internal |
| 79 } // namespace aura_shell |
| 80 |
| 81 #endif // UI_AURA_SHELL_DRAG_DROP_CONTROLLER_H_ |
OLD | NEW |