| 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_IMAGE_VIEW_H_ | 5 #ifndef ASH_COMMON_DRAG_DROP_DRAG_IMAGE_VIEW_H_ |
| 6 #define ASH_DRAG_DROP_DRAG_IMAGE_VIEW_H_ | 6 #define ASH_COMMON_DRAG_DROP_DRAG_IMAGE_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/base/dragdrop/drag_drop_types.h" | 11 #include "ui/base/dragdrop/drag_drop_types.h" |
| 12 #include "ui/gfx/geometry/point.h" |
| 13 #include "ui/gfx/geometry/size.h" |
| 12 #include "ui/views/controls/image_view.h" | 14 #include "ui/views/controls/image_view.h" |
| 13 | 15 |
| 14 namespace gfx { | 16 namespace gfx { |
| 15 class Image; | 17 class Image; |
| 16 } | 18 } |
| 17 | 19 |
| 18 namespace views { | 20 namespace views { |
| 19 class Widget; | 21 class Widget; |
| 20 } | 22 } |
| 21 | 23 |
| 22 namespace ash { | 24 namespace ash { |
| 23 | 25 |
| 26 class WmWindow; |
| 27 |
| 24 // This class allows to show a (native) view always on top of everything. It | 28 // This class allows to show a (native) view always on top of everything. It |
| 25 // does this by creating a widget and setting the content as the given view. The | 29 // does this by creating a widget and setting the content as the given view. The |
| 26 // caller can then use this object to freely move / drag it around on the | 30 // caller can then use this object to freely move / drag it around on the |
| 27 // desktop in screen coordinates. | 31 // desktop in screen coordinates. |
| 28 class DragImageView : public views::ImageView { | 32 class DragImageView : public views::ImageView { |
| 29 public: | 33 public: |
| 30 // |context is the native view context used to create the widget holding the | 34 // |root_window| is the root window on which to create the drag image widget. |
| 31 // drag image. | |
| 32 // |source| is the event source that started this drag drop operation (touch | 35 // |source| is the event source that started this drag drop operation (touch |
| 33 // or mouse). It is used to determine attributes of the drag image such as | 36 // or mouse). It is used to determine attributes of the drag image such as |
| 34 // whether to show drag operation hint on top of the image. | 37 // whether to show drag operation hint on top of the image. |
| 35 DragImageView(gfx::NativeView context, | 38 DragImageView(WmWindow* root_window, |
| 36 ui::DragDropTypes::DragEventSource source); | 39 ui::DragDropTypes::DragEventSource source); |
| 37 ~DragImageView() override; | 40 ~DragImageView() override; |
| 38 | 41 |
| 39 // Sets the bounds of the native widget in screen | 42 // Sets the bounds of the native widget in screen |
| 40 // coordinates. | 43 // coordinates. |
| 41 // TODO(oshima): Looks like this is root window's | 44 // TODO(oshima): Looks like this is root window's |
| 42 // coordinate. Change this to screen's coordinate. | 45 // coordinate. Change this to screen's coordinate. |
| 43 void SetBoundsInScreen(const gfx::Rect& bounds); | 46 void SetBoundsInScreen(const gfx::Rect& bounds); |
| 44 | 47 |
| 45 // Sets the position of the native widget. | 48 // Sets the position of the native widget. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 70 // Overridden from views::ImageView. | 73 // Overridden from views::ImageView. |
| 71 void OnPaint(gfx::Canvas* canvas) override; | 74 void OnPaint(gfx::Canvas* canvas) override; |
| 72 | 75 |
| 73 // Overridden from views::view | 76 // Overridden from views::view |
| 74 void Layout() override; | 77 void Layout() override; |
| 75 | 78 |
| 76 std::unique_ptr<views::Widget> widget_; | 79 std::unique_ptr<views::Widget> widget_; |
| 77 gfx::Size widget_size_; | 80 gfx::Size widget_size_; |
| 78 | 81 |
| 79 ui::DragDropTypes::DragEventSource drag_event_source_; | 82 ui::DragDropTypes::DragEventSource drag_event_source_; |
| 83 |
| 84 // Bitmask of ui::DragDropTypes::DragOperation values. |
| 80 int touch_drag_operation_; | 85 int touch_drag_operation_; |
| 81 gfx::Point touch_drag_operation_indicator_position_; | 86 gfx::Point touch_drag_operation_indicator_position_; |
| 82 | 87 |
| 83 DISALLOW_COPY_AND_ASSIGN(DragImageView); | 88 DISALLOW_COPY_AND_ASSIGN(DragImageView); |
| 84 }; | 89 }; |
| 85 | 90 |
| 86 } // namespace ash | 91 } // namespace ash |
| 87 | 92 |
| 88 #endif // ASH_DRAG_DROP_DRAG_IMAGE_VIEW_H_ | 93 #endif // ASH_COMMON_DRAG_DROP_DRAG_IMAGE_VIEW_H_ |
| OLD | NEW |