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