OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_COMMON_WM_LOCK_LAYOUT_MANAGER_H_ | |
6 #define ASH_COMMON_WM_LOCK_LAYOUT_MANAGER_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "ash/common/shell_observer.h" | |
10 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" | |
11 #include "ash/common/wm/wm_types.h" | |
12 #include "base/macros.h" | |
13 #include "ui/aura/window_observer.h" | |
14 #include "ui/gfx/geometry/rect.h" | |
15 #include "ui/keyboard/keyboard_controller.h" | |
16 #include "ui/keyboard/keyboard_controller_observer.h" | |
17 | |
18 namespace ash { | |
19 namespace wm { | |
20 class WindowState; | |
21 class WMEvent; | |
22 } | |
23 | |
24 // LockLayoutManager is used for the windows created in LockScreenContainer. | |
25 // For Chrome OS this includes out-of-box/login/lock/multi-profile login use | |
26 // cases. LockScreenContainer does not use default work area definition. | |
27 // By default work area is defined as display area minus shelf, docked windows | |
28 // and minus virtual keyboard bounds. | |
29 // For windows in LockScreenContainer work area is display area minus virtual | |
30 // keyboard bounds (only if keyboard overscroll is disabled). If keyboard | |
31 // overscroll is enabled then work area always equals to display area size since | |
32 // virtual keyboard changes inner workspace of each WebContents. | |
33 // For all windows in LockScreenContainer default wm::WindowState is replaced | |
34 // with LockWindowState. | |
35 class ASH_EXPORT LockLayoutManager | |
36 : public wm::WmSnapToPixelLayoutManager, | |
37 public aura::WindowObserver, | |
38 public ShellObserver, | |
39 public keyboard::KeyboardControllerObserver { | |
40 public: | |
41 explicit LockLayoutManager(WmWindow* window); | |
42 ~LockLayoutManager() override; | |
43 | |
44 // Overridden from WmSnapToPixelLayoutManager: | |
45 void OnWindowResized() override; | |
46 void OnWindowAddedToLayout(WmWindow* child) override; | |
47 void OnWillRemoveWindowFromLayout(WmWindow* child) override; | |
48 void OnWindowRemovedFromLayout(WmWindow* child) override; | |
49 void OnChildWindowVisibilityChanged(WmWindow* child, bool visibile) override; | |
50 void SetChildBounds(WmWindow* child, | |
51 const gfx::Rect& requested_bounds) override; | |
52 | |
53 // Overriden from aura::WindowObserver: | |
54 void OnWindowDestroying(aura::Window* window) override; | |
55 void OnWindowBoundsChanged(aura::Window* window, | |
56 const gfx::Rect& old_bounds, | |
57 const gfx::Rect& new_bounds) override; | |
58 | |
59 // ShellObserver: | |
60 void OnVirtualKeyboardStateChanged(bool activated) override; | |
61 | |
62 // keyboard::KeyboardControllerObserver overrides: | |
63 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; | |
64 void OnKeyboardClosed() override; | |
65 | |
66 private: | |
67 // Adjusts the bounds of all managed windows when the display area changes. | |
68 // This happens when the display size, work area insets has changed. | |
69 void AdjustWindowsForWorkAreaChange(const wm::WMEvent* event); | |
70 | |
71 WmWindow* window_; | |
72 WmWindow* root_window_; | |
73 | |
74 // True is subscribed as keyboard controller observer. | |
75 bool is_observing_keyboard_; | |
76 | |
77 // The bounds of the keyboard. | |
78 gfx::Rect keyboard_bounds_; | |
79 | |
80 DISALLOW_COPY_AND_ASSIGN(LockLayoutManager); | |
81 }; | |
82 | |
83 } // namespace ash | |
84 | |
85 #endif // ASH_COMMON_WM_LOCK_LAYOUT_MANAGER_H_ | |
OLD | NEW |