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