Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: ash/wm/window_resizer.h

Issue 2897993003: chromeos: converts WindowResizer to aura::Window (Closed)
Patch Set: remove include from exo Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/window_positioning_utils.cc ('k') | ash/wm/window_resizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 8 #include <memory>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
11 #include "ash/wm/drag_details.h" 11 #include "ash/wm/drag_details.h"
12 #include "ash/wm/window_state.h" 12 #include "ash/wm/window_state.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "ui/wm/public/window_move_client.h" 14 #include "ui/wm/public/window_move_client.h"
15 15
16 namespace aura {
17 class Window;
18 }
19
16 namespace gfx { 20 namespace gfx {
17 class Rect; 21 class Rect;
18 } 22 }
19 23
20 namespace ash { 24 namespace ash {
21 25
22 class WmWindow;
23
24 // WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving 26 // WindowResizer is used by ToplevelWindowEventFilter to handle dragging, moving
25 // 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
26 // windows coordinates. 28 // windows coordinates.
27 class ASH_EXPORT WindowResizer { 29 class ASH_EXPORT WindowResizer {
28 public: 30 public:
29 // Constants to identify the type of resize. 31 // Constants to identify the type of resize.
30 static const int kBoundsChange_None; 32 static const int kBoundsChange_None;
31 static const int kBoundsChange_Repositions; 33 static const int kBoundsChange_Repositions;
32 static const int kBoundsChange_Resizes; 34 static const int kBoundsChange_Resizes;
33 35
(...skipping 16 matching lines...) Expand all
50 // flags from the event. 52 // flags from the event.
51 virtual void Drag(const gfx::Point& location, int event_flags) = 0; 53 virtual void Drag(const gfx::Point& location, int event_flags) = 0;
52 54
53 // Invoked to complete the drag. 55 // Invoked to complete the drag.
54 virtual void CompleteDrag() = 0; 56 virtual void CompleteDrag() = 0;
55 57
56 // Reverts the drag. 58 // Reverts the drag.
57 virtual void RevertDrag() = 0; 59 virtual void RevertDrag() = 0;
58 60
59 // Returns the target window the resizer was created for. 61 // Returns the target window the resizer was created for.
60 WmWindow* GetTarget() const { 62 aura::Window* GetTarget() const;
61 return window_state_ ? window_state_->window() : nullptr; 63
62 }
63 // See comment for |DragDetails::initial_location_in_parent|. 64 // See comment for |DragDetails::initial_location_in_parent|.
64 const gfx::Point& GetInitialLocation() const { 65 const gfx::Point& GetInitialLocation() const {
65 return window_state_->drag_details()->initial_location_in_parent; 66 return window_state_->drag_details()->initial_location_in_parent;
66 } 67 }
67 68
68 // Drag parameters established when drag starts. 69 // Drag parameters established when drag starts.
69 const DragDetails& details() const { return *window_state_->drag_details(); } 70 const DragDetails& details() const { return *window_state_->drag_details(); }
70 71
71 protected: 72 protected:
72 gfx::Rect CalculateBoundsForDrag(const gfx::Point& location); 73 gfx::Rect CalculateBoundsForDrag(const gfx::Point& location);
(...skipping 20 matching lines...) Expand all
93 94
94 // Returns the height of the drag. 95 // Returns the height of the drag.
95 int GetHeightForDrag(int min_height, int* delta_y); 96 int GetHeightForDrag(int min_height, int* delta_y);
96 97
97 DISALLOW_COPY_AND_ASSIGN(WindowResizer); 98 DISALLOW_COPY_AND_ASSIGN(WindowResizer);
98 }; 99 };
99 100
100 // Creates a WindowResizer for |window|. Returns a unique_ptr with null if 101 // Creates a WindowResizer for |window|. Returns a unique_ptr with null if
101 // |window| should not be resized nor dragged. 102 // |window| should not be resized nor dragged.
102 ASH_EXPORT std::unique_ptr<WindowResizer> CreateWindowResizer( 103 ASH_EXPORT std::unique_ptr<WindowResizer> CreateWindowResizer(
103 WmWindow* window, 104 aura::Window* window,
104 const gfx::Point& point_in_parent, 105 const gfx::Point& point_in_parent,
105 int window_component, 106 int window_component,
106 aura::client::WindowMoveSource source); 107 aura::client::WindowMoveSource source);
107 108
108 } // namespace ash 109 } // namespace ash
109 110
110 #endif // ASH_WM_WINDOW_RESIZER_H_ 111 #endif // ASH_WM_WINDOW_RESIZER_H_
OLDNEW
« no previous file with comments | « ash/wm/window_positioning_utils.cc ('k') | ash/wm/window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698