| 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_COMMON_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ |
| 6 #define ASH_COMMON_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ | 6 #define ASH_COMMON_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
| 12 #include "ash/common/wm_window_observer.h" | |
| 13 #include "base/macros.h" | 12 #include "base/macros.h" |
| 14 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "ui/aura/window_observer.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/views/mouse_watcher.h" | 16 #include "ui/views/mouse_watcher.h" |
| 17 | 17 |
| 18 namespace views { | 18 namespace views { |
| 19 class Widget; | 19 class Widget; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace ash { | 22 namespace ash { |
| 23 class MultiWindowResizeControllerTest; | 23 class MultiWindowResizeControllerTest; |
| 24 class WmWindow; |
| 24 class WorkspaceWindowResizer; | 25 class WorkspaceWindowResizer; |
| 25 | 26 |
| 26 // Two directions resizes happen in. | 27 // Two directions resizes happen in. |
| 27 enum Direction { | 28 enum Direction { |
| 28 TOP_BOTTOM, | 29 TOP_BOTTOM, |
| 29 LEFT_RIGHT, | 30 LEFT_RIGHT, |
| 30 }; | 31 }; |
| 31 | 32 |
| 32 // MultiWindowResizeController is responsible for determining and showing a | 33 // MultiWindowResizeController is responsible for determining and showing a |
| 33 // widget that allows resizing multiple windows at the same time. | 34 // widget that allows resizing multiple windows at the same time. |
| 34 // MultiWindowResizeController is driven by WorkspaceEventFilter. | 35 // MultiWindowResizeController is driven by WorkspaceEventFilter. |
| 35 class ASH_EXPORT MultiWindowResizeController | 36 class ASH_EXPORT MultiWindowResizeController |
| 36 : public views::MouseWatcherListener, | 37 : public views::MouseWatcherListener, |
| 37 public WmWindowObserver { | 38 public aura::WindowObserver { |
| 38 public: | 39 public: |
| 39 MultiWindowResizeController(); | 40 MultiWindowResizeController(); |
| 40 ~MultiWindowResizeController() override; | 41 ~MultiWindowResizeController() override; |
| 41 | 42 |
| 42 // If necessary, shows the resize widget. |window| is the window the mouse | 43 // If necessary, shows the resize widget. |window| is the window the mouse |
| 43 // is over, |component| the edge and |point| the location of the mouse. | 44 // is over, |component| the edge and |point| the location of the mouse. |
| 44 void Show(WmWindow* window, int component, const gfx::Point& point); | 45 void Show(WmWindow* window, int component, const gfx::Point& point); |
| 45 | 46 |
| 46 // Hides the resize widget. | 47 // Hides the resize widget. |
| 47 void Hide(); | 48 void Hide(); |
| 48 | 49 |
| 49 // MouseWatcherListenre overrides: | 50 // MouseWatcherListenre overrides: |
| 50 void MouseMovedOutOfHost() override; | 51 void MouseMovedOutOfHost() override; |
| 51 | 52 |
| 52 // WindowObserver overrides: | 53 // WindowObserver overrides: |
| 53 void OnWindowDestroying(WmWindow* window) override; | 54 void OnWindowDestroying(aura::Window* window) override; |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 friend class MultiWindowResizeControllerTest; | 57 friend class MultiWindowResizeControllerTest; |
| 57 | 58 |
| 58 // Used to track the two resizable windows and direction. | 59 // Used to track the two resizable windows and direction. |
| 59 struct ResizeWindows { | 60 struct ResizeWindows { |
| 60 ResizeWindows(); | 61 ResizeWindows(); |
| 61 ResizeWindows(const ResizeWindows& other); | 62 ResizeWindows(const ResizeWindows& other); |
| 62 ~ResizeWindows(); | 63 ~ResizeWindows(); |
| 63 | 64 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // |resize_widget_| is non-NULL (ie the widget is showing) we ignore calls | 171 // |resize_widget_| is non-NULL (ie the widget is showing) we ignore calls |
| 171 // to Show(). | 172 // to Show(). |
| 172 std::unique_ptr<views::MouseWatcher> mouse_watcher_; | 173 std::unique_ptr<views::MouseWatcher> mouse_watcher_; |
| 173 | 174 |
| 174 DISALLOW_COPY_AND_ASSIGN(MultiWindowResizeController); | 175 DISALLOW_COPY_AND_ASSIGN(MultiWindowResizeController); |
| 175 }; | 176 }; |
| 176 | 177 |
| 177 } // namespace ash | 178 } // namespace ash |
| 178 | 179 |
| 179 #endif // ASH_COMMON_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ | 180 #endif // ASH_COMMON_WM_WORKSPACE_MULTI_WINDOW_RESIZE_CONTROLLER_H_ |
| OLD | NEW |