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