| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_ | 5 #ifndef ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_ |
| 6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_ | 6 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 class MaximizeModeWindowManager; | 14 class MaximizeModeWindowManager; |
| 15 class WmWindow; |
| 15 | 16 |
| 16 // The MaximizeModeWindowState implementation which reduces all possible window | 17 // The MaximizeModeWindowState implementation which reduces all possible window |
| 17 // states to minimized and maximized. If a window cannot be maximized it will be | 18 // states to minimized and maximized. If a window cannot be maximized it will be |
| 18 // set to normal. If a window cannot fill the entire workspace it will be | 19 // set to normal. If a window cannot fill the entire workspace it will be |
| 19 // centered within the workspace. | 20 // centered within the workspace. |
| 20 class MaximizeModeWindowState : public wm::WindowState::State { | 21 class MaximizeModeWindowState : public wm::WindowState::State { |
| 21 public: | 22 public: |
| 22 // Called when the window position might need to be updated. | 23 // Called when the window position might need to be updated. |
| 23 static void UpdateWindowPosition(wm::WindowState* window_state); | 24 static void UpdateWindowPosition(wm::WindowState* window_state); |
| 24 | 25 |
| 25 // The |window|'s state object will be modified to use this new window mode | 26 // The |window|'s state object will be modified to use this new window mode |
| 26 // state handler. Upon destruction it will restore the previous state handler | 27 // state handler. Upon destruction it will restore the previous state handler |
| 27 // and call |creator::WindowStateDestroyed()| to inform that the window mode | 28 // and call |creator::WindowStateDestroyed()| to inform that the window mode |
| 28 // was reverted to the old window manager. | 29 // was reverted to the old window manager. |
| 29 MaximizeModeWindowState(aura::Window* window, | 30 MaximizeModeWindowState(WmWindow* window, MaximizeModeWindowManager* creator); |
| 30 MaximizeModeWindowManager* creator); | |
| 31 ~MaximizeModeWindowState() override; | 31 ~MaximizeModeWindowState() override; |
| 32 | 32 |
| 33 // Leaves the maximize mode by reverting to previous state object. | 33 // Leaves the maximize mode by reverting to previous state object. |
| 34 void LeaveMaximizeMode(wm::WindowState* window_state); | 34 void LeaveMaximizeMode(wm::WindowState* window_state); |
| 35 | 35 |
| 36 // Sets whether to ignore bounds updates. If set to false, immediately does a | 36 // Sets whether to ignore bounds updates. If set to false, immediately does a |
| 37 // bounds update as the current window bounds may no longer be correct. | 37 // bounds update as the current window bounds may no longer be correct. |
| 38 void SetDeferBoundsUpdates(bool defer_bounds_updates); | 38 void SetDeferBoundsUpdates(bool defer_bounds_updates); |
| 39 | 39 |
| 40 // WindowState::State overrides: | 40 // WindowState::State overrides: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 61 wm::WindowState* window_state); | 61 wm::WindowState* window_state); |
| 62 | 62 |
| 63 // Updates the bounds to the maximum possible bounds according to the current | 63 // Updates the bounds to the maximum possible bounds according to the current |
| 64 // window state. If |animated| is set we animate the change. | 64 // window state. If |animated| is set we animate the change. |
| 65 void UpdateBounds(wm::WindowState* window_state, bool animated); | 65 void UpdateBounds(wm::WindowState* window_state, bool animated); |
| 66 | 66 |
| 67 // The original state object of the window. | 67 // The original state object of the window. |
| 68 std::unique_ptr<wm::WindowState::State> old_state_; | 68 std::unique_ptr<wm::WindowState::State> old_state_; |
| 69 | 69 |
| 70 // The state object for this object which owns this instance. | 70 // The state object for this object which owns this instance. |
| 71 aura::Window* window_; | 71 WmWindow* window_; |
| 72 | 72 |
| 73 // The creator which needs to be informed when this state goes away. | 73 // The creator which needs to be informed when this state goes away. |
| 74 MaximizeModeWindowManager* creator_; | 74 MaximizeModeWindowManager* creator_; |
| 75 | 75 |
| 76 // The current state type. Due to the nature of this state, this can only be | 76 // The current state type. Due to the nature of this state, this can only be |
| 77 // WM_STATE_TYPE{NORMAL, MINIMIZED, MAXIMIZED}. | 77 // WM_STATE_TYPE{NORMAL, MINIMIZED, MAXIMIZED}. |
| 78 wm::WindowStateType current_state_type_; | 78 wm::WindowStateType current_state_type_; |
| 79 | 79 |
| 80 // If true, do not update bounds. | 80 // If true, do not update bounds. |
| 81 bool defer_bounds_updates_; | 81 bool defer_bounds_updates_; |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowState); | 83 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowState); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace ash | 86 } // namespace ash |
| 87 | 87 |
| 88 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_ | 88 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_ |
| OLD | NEW |