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_LOCK_WINDOW_STATE_H_ | 5 #ifndef ASH_WM_LOCK_WINDOW_STATE_H_ |
6 #define ASH_WM_LOCK_WINDOW_STATE_H_ | 6 #define ASH_WM_LOCK_WINDOW_STATE_H_ |
7 | 7 |
8 #include "ash/wm/window_state.h" | 8 #include "ash/wm/window_state.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 | 10 |
11 namespace ash { | 11 namespace ash { |
12 | 12 |
13 // The LockWindowState implementation which reduces all possible window | 13 // The LockWindowState implementation which reduces all possible window |
14 // states to maximized (or normal if can't be maximized)/minimized/full-screen | 14 // states to maximized (or normal if can't be maximized)/minimized/full-screen |
15 // and is applied only on lock (login) window container. | 15 // and is applied only on lock (login) window container. |
16 // LockWindowState implements Ash behavior without state machine. | 16 // LockWindowState implements Ash behavior without state machine. |
17 class LockWindowState : public wm::WindowState::State { | 17 class LockWindowState : public wm::WindowState::State { |
18 public: | 18 public: |
19 // The |window|'s state object will be modified to use this new window mode | 19 // The |window|'s state object will be modified to use this new window mode |
20 // state handler. | 20 // state handler. |
21 explicit LockWindowState(WmWindow* window); | 21 explicit LockWindowState(aura::Window* window); |
22 ~LockWindowState() override; | 22 ~LockWindowState() override; |
23 | 23 |
24 // WindowState::State overrides: | 24 // WindowState::State overrides: |
25 void OnWMEvent(wm::WindowState* window_state, | 25 void OnWMEvent(wm::WindowState* window_state, |
26 const wm::WMEvent* event) override; | 26 const wm::WMEvent* event) override; |
27 wm::WindowStateType GetType() const override; | 27 wm::WindowStateType GetType() const override; |
28 void AttachState(wm::WindowState* window_state, | 28 void AttachState(wm::WindowState* window_state, |
29 wm::WindowState::State* previous_state) override; | 29 wm::WindowState::State* previous_state) override; |
30 void DetachState(wm::WindowState* window_state) override; | 30 void DetachState(wm::WindowState* window_state) override; |
31 | 31 |
32 // Creates new LockWindowState instance and attaches it to |window|. | 32 // Creates new LockWindowState instance and attaches it to |window|. |
33 static wm::WindowState* SetLockWindowState(WmWindow* window); | 33 static wm::WindowState* SetLockWindowState(aura::Window* window); |
34 | 34 |
35 private: | 35 private: |
36 // Updates the window to |new_state_type| and resulting bounds: | 36 // Updates the window to |new_state_type| and resulting bounds: |
37 // Either full screen, maximized centered or minimized. If the state does not | 37 // Either full screen, maximized centered or minimized. If the state does not |
38 // change, only the bounds will be changed. | 38 // change, only the bounds will be changed. |
39 void UpdateWindow(wm::WindowState* window_state, | 39 void UpdateWindow(wm::WindowState* window_state, |
40 wm::WindowStateType new_state_type); | 40 wm::WindowStateType new_state_type); |
41 | 41 |
42 // Depending on the capabilities of the window we either return | 42 // Depending on the capabilities of the window we either return |
43 // |WINDOW_STATE_TYPE_MAXIMIZED| or |WINDOW_STATE_TYPE_NORMAL|. | 43 // |WINDOW_STATE_TYPE_MAXIMIZED| or |WINDOW_STATE_TYPE_NORMAL|. |
44 wm::WindowStateType GetMaximizedOrCenteredWindowType( | 44 wm::WindowStateType GetMaximizedOrCenteredWindowType( |
45 wm::WindowState* window_state); | 45 wm::WindowState* window_state); |
46 | 46 |
47 // Updates the bounds taking virtual keyboard bounds into consideration. | 47 // Updates the bounds taking virtual keyboard bounds into consideration. |
48 void UpdateBounds(wm::WindowState* window_state); | 48 void UpdateBounds(wm::WindowState* window_state); |
49 | 49 |
50 // The current state type. Due to the nature of this state, this can only be | 50 // The current state type. Due to the nature of this state, this can only be |
51 // WM_STATE_TYPE{NORMAL, MINIMIZED, MAXIMIZED}. | 51 // WM_STATE_TYPE{NORMAL, MINIMIZED, MAXIMIZED}. |
52 wm::WindowStateType current_state_type_; | 52 wm::WindowStateType current_state_type_; |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(LockWindowState); | 54 DISALLOW_COPY_AND_ASSIGN(LockWindowState); |
55 }; | 55 }; |
56 | 56 |
57 } // namespace ash | 57 } // namespace ash |
58 | 58 |
59 #endif // ASH_WM_LOCK_WINDOW_STATE_H_ | 59 #endif // ASH_WM_LOCK_WINDOW_STATE_H_ |
OLD | NEW |