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_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ | 5 #ifndef ASH_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ |
6 #define ASH_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ | 6 #define ASH_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 Direction direction; | 80 Direction direction; |
81 | 81 |
82 // Windows after |window2| that are to be resized. Determined at the time | 82 // Windows after |window2| that are to be resized. Determined at the time |
83 // the resize starts. | 83 // the resize starts. |
84 std::vector<aura::Window*> other_windows; | 84 std::vector<aura::Window*> other_windows; |
85 }; | 85 }; |
86 | 86 |
87 class ResizeMouseWatcherHost; | 87 class ResizeMouseWatcherHost; |
88 class ResizeView; | 88 class ResizeView; |
89 | 89 |
90 void CreateMouseWatcher(); | |
91 | |
92 // Returns a ResizeWindows based on the specified arguments. Use is_valid() | 90 // Returns a ResizeWindows based on the specified arguments. Use is_valid() |
93 // to test if the return value is a valid multi window resize location. | 91 // to test if the return value is a valid multi window resize location. |
94 ResizeWindows DetermineWindows(aura::Window* window, | 92 ResizeWindows DetermineWindows(aura::Window* window, |
95 int window_component, | 93 int window_component, |
96 const gfx::Point& point) const; | 94 const gfx::Point& point) const; |
97 | 95 |
98 // Variant of DetermineWindows() that uses the current location of the mouse | 96 // Variant of DetermineWindows() that uses the current location of the mouse |
99 // to determine the resize windows. | 97 // to determine the resize windows. |
100 ResizeWindows DetermineWindowsFromScreenPoint(aura::Window* window) const; | 98 ResizeWindows DetermineWindowsFromScreenPoint(aura::Window* window) const; |
101 | 99 |
102 // Finds a window by edge (one of the constants HitTestCompat. | 100 // Finds a window by edge (one of the constants HitTestCompat. |
103 aura::Window* FindWindowByEdge(aura::Window* window_to_ignore, | 101 aura::Window* FindWindowByEdge(aura::Window* window_to_ignore, |
104 int edge_want, | 102 int edge_want, |
105 int x_in_parent, | 103 int x, |
106 int y_in_parent) const; | 104 int y) const; |
107 | 105 |
108 // Returns the first window touching |window|. | 106 // Returns the first window touching |window|. |
109 aura::Window* FindWindowTouching(aura::Window* window, | 107 aura::Window* FindWindowTouching(aura::Window* window, |
110 Direction direction) const; | 108 Direction direction) const; |
111 | 109 |
112 // Places any windows touching |start| into |others|. | 110 // Places any windows touching |start| into |others|. |
113 void FindWindowsTouching(aura::Window* start, | 111 void FindWindowsTouching(aura::Window* start, |
114 Direction direction, | 112 Direction direction, |
115 std::vector<aura::Window*>* others) const; | 113 std::vector<aura::Window*>* others) const; |
116 | 114 |
| 115 // Hides the window after a delay. |
| 116 void DelayedHide(); |
| 117 |
117 // Shows the resizer if the mouse is still at a valid location. This is called | 118 // Shows the resizer if the mouse is still at a valid location. This is called |
118 // from the |show_timer_|. | 119 // from the |show_timer_|. |
119 void ShowIfValidMouseLocation(); | 120 void ShowIfValidMouseLocation(); |
120 | 121 |
121 // Shows the widget immediately. | 122 // Shows the widget immediately. |
122 void ShowNow(); | 123 void ShowNow(); |
123 | 124 |
124 // Returns true if the widget is showing. | 125 // Returns true if the widget is showing. |
125 bool IsShowing() const; | 126 bool IsShowing() const; |
126 | 127 |
(...skipping 10 matching lines...) Expand all Loading... |
137 void CancelResize(); | 138 void CancelResize(); |
138 | 139 |
139 // Returns the bounds for the resize widget. | 140 // Returns the bounds for the resize widget. |
140 gfx::Rect CalculateResizeWidgetBounds( | 141 gfx::Rect CalculateResizeWidgetBounds( |
141 const gfx::Point& location_in_parent) const; | 142 const gfx::Point& location_in_parent) const; |
142 | 143 |
143 // Returns true if |location_in_screen| is over the resize windows | 144 // Returns true if |location_in_screen| is over the resize windows |
144 // (or the resize widget itself). | 145 // (or the resize widget itself). |
145 bool IsOverWindows(const gfx::Point& location_in_screen) const; | 146 bool IsOverWindows(const gfx::Point& location_in_screen) const; |
146 | 147 |
147 // Returns true if |location_in_screen| is over |component| in |window|. | 148 // Returns true if |location_in_screen| is over |window|. |
148 bool IsOverComponent(aura::Window* window, | 149 bool IsOverWindow(aura::Window* window, |
149 const gfx::Point& location_in_screen, | 150 const gfx::Point& location_in_screen, |
150 int component) const; | 151 int component) const; |
151 | 152 |
152 // Windows and direction to resize. | 153 // Windows and direction to resize. |
153 ResizeWindows windows_; | 154 ResizeWindows windows_; |
154 | 155 |
| 156 // Timer before hiding. |
| 157 base::OneShotTimer<MultiWindowResizeController> hide_timer_; |
| 158 |
155 // Timer used before showing. | 159 // Timer used before showing. |
156 base::OneShotTimer<MultiWindowResizeController> show_timer_; | 160 base::OneShotTimer<MultiWindowResizeController> show_timer_; |
157 | 161 |
158 scoped_ptr<views::Widget> resize_widget_; | 162 scoped_ptr<views::Widget> resize_widget_; |
159 | 163 |
160 // If non-null we're in a resize loop. | 164 // If non-null we're in a resize loop. |
161 scoped_ptr<WorkspaceWindowResizer> window_resizer_; | 165 scoped_ptr<WorkspaceWindowResizer> window_resizer_; |
162 | 166 |
163 // Mouse coordinate passed to Show() in container's coodinates. | 167 // Mouse coordinate passed to Show() in container's coodinates. |
164 gfx::Point show_location_in_parent_; | 168 gfx::Point show_location_in_parent_; |
165 | 169 |
166 // Bounds the widget was last shown at in screen coordinates. | 170 // Bounds the widget was last shown at in screen coordinates. |
167 gfx::Rect show_bounds_in_screen_; | 171 gfx::Rect show_bounds_in_screen_; |
168 | 172 |
169 // Used to detect whether the mouse is over the windows. While | 173 // Used to detect whether the mouse is over the windows. While |
170 // |resize_widget_| is non-NULL (ie the widget is showing) we ignore calls | 174 // |resize_widget_| is non-NULL (ie the widget is showing) we ignore calls |
171 // to Show(). | 175 // to Show(). |
172 scoped_ptr<views::MouseWatcher> mouse_watcher_; | 176 scoped_ptr<views::MouseWatcher> mouse_watcher_; |
173 | 177 |
174 DISALLOW_COPY_AND_ASSIGN(MultiWindowResizeController); | 178 DISALLOW_COPY_AND_ASSIGN(MultiWindowResizeController); |
175 }; | 179 }; |
176 | 180 |
177 } // namespace ash | 181 } // namespace ash |
178 | 182 |
179 #endif // ASH_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ | 183 #endif // ASH_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ |
OLD | NEW |