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_WM_WINDOW_RESIZER_H_ | 5 #ifndef ASH_WM_WINDOW_RESIZER_H_ |
| 6 #define ASH_WM_WINDOW_RESIZER_H_ | 6 #define ASH_WM_WINDOW_RESIZER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
| 12 | 12 |
| 13 namespace aura { | 13 namespace aura { |
| 14 class Window; | 14 class Window; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace ash { | 17 namespace ash { |
| 18 | 18 |
| 19 namespace internal { | |
| 20 | |
| 21 class DragWindowResizerTest; | |
| 22 class PanelWindowResizerTest; | |
| 23 | |
| 24 } // namespace internal | |
| 25 | |
| 19 // WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving | 26 // WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving |
| 20 // or resizing a window. All coordinates passed to this are in the parent | 27 // or resizing a window. All coordinates passed to this are in the parent |
| 21 // windows coordinates. | 28 // windows coordinates. |
| 22 class ASH_EXPORT WindowResizer { | 29 class ASH_EXPORT WindowResizer { |
| 23 public: | 30 public: |
| 24 // Constants to identify the type of resize. | 31 // Constants to identify the type of resize. |
| 25 static const int kBoundsChange_None; | 32 static const int kBoundsChange_None; |
| 26 static const int kBoundsChange_Repositions; | 33 static const int kBoundsChange_Repositions; |
| 27 static const int kBoundsChange_Resizes; | 34 static const int kBoundsChange_Resizes; |
| 28 | 35 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 45 // Invoked to complete the drag. | 52 // Invoked to complete the drag. |
| 46 virtual void CompleteDrag(int event_flags) = 0; | 53 virtual void CompleteDrag(int event_flags) = 0; |
| 47 | 54 |
| 48 // Reverts the drag. | 55 // Reverts the drag. |
| 49 virtual void RevertDrag() = 0; | 56 virtual void RevertDrag() = 0; |
| 50 | 57 |
| 51 // Returns the target window the resizer was created for. | 58 // Returns the target window the resizer was created for. |
| 52 virtual aura::Window* GetTarget() = 0; | 59 virtual aura::Window* GetTarget() = 0; |
| 53 | 60 |
| 54 protected: | 61 protected: |
| 62 friend class internal::DragWindowResizerTest; | |
| 63 friend class internal::PanelWindowResizerTest; | |
| 64 | |
| 65 // See comment for |Details::initial_location_in_parent|. | |
| 66 virtual const gfx::Point& GetInitialLocationForTest() const = 0; | |
|
sky
2013/06/17 19:49:47
There is no point in hiding this. Make it public a
varkha
2013/06/17 20:34:57
Done.
| |
| 67 | |
| 55 struct Details { | 68 struct Details { |
| 56 Details(); | 69 Details(); |
| 57 Details(aura::Window* window, | 70 Details(aura::Window* window, |
| 58 const gfx::Point& location, | 71 const gfx::Point& location, |
| 59 int window_component); | 72 int window_component); |
| 60 ~Details(); | 73 ~Details(); |
| 61 | 74 |
| 62 // The window we're resizing. | 75 // The window we're resizing. |
| 63 aura::Window* window; | 76 aura::Window* window; |
| 64 | 77 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 int* delta_y); | 135 int* delta_y); |
| 123 }; | 136 }; |
| 124 | 137 |
| 125 // Creates a WindowResizer for |window|. This can return a scoped_ptr | 138 // Creates a WindowResizer for |window|. This can return a scoped_ptr |
| 126 // initialized with NULL if |window| should not be resized nor dragged. | 139 // initialized with NULL if |window| should not be resized nor dragged. |
| 127 ASH_EXPORT scoped_ptr<WindowResizer> CreateWindowResizer( | 140 ASH_EXPORT scoped_ptr<WindowResizer> CreateWindowResizer( |
| 128 aura::Window* window, | 141 aura::Window* window, |
| 129 const gfx::Point& point_in_parent, | 142 const gfx::Point& point_in_parent, |
| 130 int window_component); | 143 int window_component); |
| 131 | 144 |
| 132 } // namespace aura | 145 } // namespace ash |
| 133 | 146 |
| 134 #endif // ASH_WM_WINDOW_RESIZER_H_ | 147 #endif // ASH_WM_WINDOW_RESIZER_H_ |
| OLD | NEW |