Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: ash/wm/lock_window_state.h

Issue 2876993002: Introduce window container to be used by lock screen app windows (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/lock_layout_manager.h ('k') | ash/wm/lock_window_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 and window containers
16 // associated with apps handling lock screen tray actions.
16 // LockWindowState implements Ash behavior without state machine. 17 // LockWindowState implements Ash behavior without state machine.
17 class LockWindowState : public wm::WindowState::State { 18 class LockWindowState : public wm::WindowState::State {
18 public: 19 public:
19 // The |window|'s state object will be modified to use this new window mode 20 // The |window|'s state object will be modified to use this new window mode
20 // state handler. 21 // state handler.
21 explicit LockWindowState(aura::Window* window); 22 // |exclude_shelf| - if set, the maximized window size will be
23 // restricted to work area defined by ash shelf, rather than taking only
24 // virtual keyboard window into consideration when calculating the window
25 // size.
26 LockWindowState(aura::Window* window, bool exclude_shelf);
27
22 ~LockWindowState() override; 28 ~LockWindowState() override;
23 29
24 // WindowState::State overrides: 30 // WindowState::State overrides:
25 void OnWMEvent(wm::WindowState* window_state, 31 void OnWMEvent(wm::WindowState* window_state,
26 const wm::WMEvent* event) override; 32 const wm::WMEvent* event) override;
27 wm::WindowStateType GetType() const override; 33 wm::WindowStateType GetType() const override;
28 void AttachState(wm::WindowState* window_state, 34 void AttachState(wm::WindowState* window_state,
29 wm::WindowState::State* previous_state) override; 35 wm::WindowState::State* previous_state) override;
30 void DetachState(wm::WindowState* window_state) override; 36 void DetachState(wm::WindowState* window_state) override;
31 37
32 // Creates new LockWindowState instance and attaches it to |window|. 38 // Creates new LockWindowState instance and attaches it to |window|.
33 static wm::WindowState* SetLockWindowState(aura::Window* window); 39 static wm::WindowState* SetLockWindowState(aura::Window* window);
40 static wm::WindowState* SetLockWindowStateWithShelfExcluded(
41 aura::Window* window);
34 42
35 private: 43 private:
36 // Updates the window to |new_state_type| and resulting bounds: 44 // Updates the window to |new_state_type| and resulting bounds:
37 // Either full screen, maximized centered or minimized. If the state does not 45 // Either full screen, maximized centered or minimized. If the state does not
38 // change, only the bounds will be changed. 46 // change, only the bounds will be changed.
39 void UpdateWindow(wm::WindowState* window_state, 47 void UpdateWindow(wm::WindowState* window_state,
40 wm::WindowStateType new_state_type); 48 wm::WindowStateType new_state_type);
41 49
42 // Depending on the capabilities of the window we either return 50 // Depending on the capabilities of the window we either return
43 // |WINDOW_STATE_TYPE_MAXIMIZED| or |WINDOW_STATE_TYPE_NORMAL|. 51 // |WINDOW_STATE_TYPE_MAXIMIZED| or |WINDOW_STATE_TYPE_NORMAL|.
44 wm::WindowStateType GetMaximizedOrCenteredWindowType( 52 wm::WindowStateType GetMaximizedOrCenteredWindowType(
45 wm::WindowState* window_state); 53 wm::WindowState* window_state);
46 54
55 // Returns boudns to be used for the provided window.
56 gfx::Rect GetWindowBounds(aura::Window* window);
57
47 // Updates the bounds taking virtual keyboard bounds into consideration. 58 // Updates the bounds taking virtual keyboard bounds into consideration.
48 void UpdateBounds(wm::WindowState* window_state); 59 void UpdateBounds(wm::WindowState* window_state);
49 60
50 // The current state type. Due to the nature of this state, this can only be 61 // The current state type. Due to the nature of this state, this can only be
51 // WM_STATE_TYPE{NORMAL, MINIMIZED, MAXIMIZED}. 62 // WM_STATE_TYPE{NORMAL, MINIMIZED, MAXIMIZED}.
52 wm::WindowStateType current_state_type_; 63 wm::WindowStateType current_state_type_;
53 64
65 // Restrict window size to the work area defined by the shelf - i.e. window
66 // bounds exclude system shelf bounds.
67 bool exclude_shelf_ = false;
68
54 DISALLOW_COPY_AND_ASSIGN(LockWindowState); 69 DISALLOW_COPY_AND_ASSIGN(LockWindowState);
55 }; 70 };
56 71
57 } // namespace ash 72 } // namespace ash
58 73
59 #endif // ASH_WM_LOCK_WINDOW_STATE_H_ 74 #endif // ASH_WM_LOCK_WINDOW_STATE_H_
OLDNEW
« no previous file with comments | « ash/wm/lock_layout_manager.h ('k') | ash/wm/lock_window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698