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 "ash/wm/window_state.h" | 8 #include "ash/wm/window_state.h" |
9 | 9 |
10 namespace ash { | 10 namespace ash { |
11 class MaximizeModeWindowManager; | 11 class MaximizeModeWindowManager; |
12 | 12 |
13 // The MaximizeModeWindowState implementation which reduces all possible window | 13 // The MaximizeModeWindowState implementation which reduces all possible window |
14 // states to minimized and maximized. If a window cannot be maximized it will be | 14 // states to minimized and maximized. If a window cannot be maximized it will be |
15 // set to normal. If a window cannot fill the entire workspace it will be | 15 // set to normal. If a window cannot fill the entire workspace it will be |
16 // centered within the workspace. | 16 // centered within the workspace. |
17 class MaximizeModeWindowState : public wm::WindowState::State { | 17 class MaximizeModeWindowState : public wm::WindowState::State { |
18 public: | 18 public: |
19 // Called when the window position might need to be updated. | 19 // Called when the window position might need to be updated. |
20 static void UpdateWindowPosition(wm::WindowState* window_state, | 20 static void UpdateWindowPosition(wm::WindowState* window_state, |
21 bool animated); | 21 bool animated); |
22 | 22 |
23 // The |window|'s state object will be modified to use this new window mode | 23 // The |window|'s state object will be modified to use this new window mode |
24 // state handler. Upon destruction it will restore the previous state handler | 24 // state handler. Upon destruction it will restore the previous state handler |
25 // and call |creator::WindowStateDestroyed()| to inform that the window mode | 25 // and call |creator::WindowStateDestroyed()| to inform that the window mode |
26 // was reverted to the old window manager. | 26 // was reverted to the old window manager. |
27 MaximizeModeWindowState(aura::Window* window, | 27 MaximizeModeWindowState(aura::Window* window, |
28 MaximizeModeWindowManager* creator); | 28 MaximizeModeWindowManager* creator); |
29 virtual ~MaximizeModeWindowState(); | 29 ~MaximizeModeWindowState() override; |
30 | 30 |
31 // Leaves the maximize mode by reverting to previous state object. | 31 // Leaves the maximize mode by reverting to previous state object. |
32 void LeaveMaximizeMode(wm::WindowState* window_state); | 32 void LeaveMaximizeMode(wm::WindowState* window_state); |
33 | 33 |
34 // Sets whether to ignore bounds updates. If set to false, immediately does a | 34 // Sets whether to ignore bounds updates. If set to false, immediately does a |
35 // bounds update as the current window bounds may no longer be correct. | 35 // bounds update as the current window bounds may no longer be correct. |
36 void SetDeferBoundsUpdates(bool defer_bounds_updates); | 36 void SetDeferBoundsUpdates(bool defer_bounds_updates); |
37 | 37 |
38 // WindowState::State overrides: | 38 // WindowState::State overrides: |
39 virtual void OnWMEvent(wm::WindowState* window_state, | 39 void OnWMEvent(wm::WindowState* window_state, |
40 const wm::WMEvent* event) override; | 40 const wm::WMEvent* event) override; |
41 | 41 |
42 virtual wm::WindowStateType GetType() const override; | 42 wm::WindowStateType GetType() const override; |
43 virtual void AttachState(wm::WindowState* window_state, | 43 void AttachState(wm::WindowState* window_state, |
44 wm::WindowState::State* previous_state) override; | 44 wm::WindowState::State* previous_state) override; |
45 virtual void DetachState(wm::WindowState* window_state) override; | 45 void DetachState(wm::WindowState* window_state) override; |
46 | 46 |
47 private: | 47 private: |
48 // Updates the window to |new_state_type| and resulting bounds: | 48 // Updates the window to |new_state_type| and resulting bounds: |
49 // Either full screen, maximized centered or minimized. If the state does not | 49 // Either full screen, maximized centered or minimized. If the state does not |
50 // change, only the bounds will be changed. If |animate| is set, the bound | 50 // change, only the bounds will be changed. If |animate| is set, the bound |
51 // change get animated. | 51 // change get animated. |
52 void UpdateWindow(wm::WindowState* window_state, | 52 void UpdateWindow(wm::WindowState* window_state, |
53 wm::WindowStateType new_state_type, | 53 wm::WindowStateType new_state_type, |
54 bool animate); | 54 bool animate); |
55 | 55 |
(...skipping 21 matching lines...) Expand all Loading... |
77 | 77 |
78 // If true, do not update bounds. | 78 // If true, do not update bounds. |
79 bool defer_bounds_updates_; | 79 bool defer_bounds_updates_; |
80 | 80 |
81 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowState); | 81 DISALLOW_COPY_AND_ASSIGN(MaximizeModeWindowState); |
82 }; | 82 }; |
83 | 83 |
84 } // namespace ash | 84 } // namespace ash |
85 | 85 |
86 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_ | 86 #endif // ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_WINDOW_STATE_H_ |
OLD | NEW |