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