OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
oshima
2014/06/03 22:36:44
2014
nuke (c)
| |
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_WM_LOCK_LAYOUT_MANAGER_H_ | |
6 #define ASH_WM_LOCK_LAYOUT_MANAGER_H_ | |
7 | |
8 #include <map> | |
9 #include <set> | |
10 | |
11 #include "ash/ash_export.h" | |
12 #include "ash/shell_delegate.h" | |
13 #include "ash/wm/wm_types.h" | |
14 #include "base/basictypes.h" | |
oshima
2014/06/03 22:36:44
macros.h
| |
15 #include "base/compiler_specific.h" | |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "ui/aura/layout_manager.h" | |
18 #include "ui/aura/window_observer.h" | |
19 #include "ui/gfx/rect.h" | |
20 #include "ui/keyboard/keyboard_controller.h" | |
21 #include "ui/keyboard/keyboard_controller_observer.h" | |
22 | |
23 namespace aura { | |
24 class RootWindow; | |
25 class Window; | |
26 } | |
27 | |
28 namespace ui { | |
29 class Layer; | |
30 } | |
31 | |
32 namespace ash { | |
33 | |
34 class LockWindowState; | |
35 | |
36 namespace wm { | |
37 class WindowState; | |
38 class WMEvent; | |
39 } | |
40 | |
41 // LockLayoutManager is used for the windows created in LockScreenContainer. | |
42 // For Chrome OS this includes out-of-box/login/lock/multi-profile login use | |
43 // cases. LockScreenContainer does not use default work area definition. | |
44 // By default work area is defined as display area minus shelf, docked windows | |
45 // and minus virtual keyboard bounds. | |
46 // For windows in LockScreenContainer work area is display area minus virtual | |
47 // keyboard bounds (only if keyboard overscroll is disabled). If keyboard | |
48 // overscroll is enabled then work area always equals to display area size since | |
49 // virtual keyboard changes inner workspace of each WebContents. | |
50 // For all windows in LockScreenContainer default wm::WindowState is replaced | |
51 // with LockWindowState. | |
52 class ASH_EXPORT LockLayoutManager | |
53 : public aura::LayoutManager, | |
54 public aura::WindowObserver, | |
55 public VirtualKeyboardStateObserver, | |
56 public keyboard::KeyboardControllerObserver { | |
57 public: | |
58 explicit LockLayoutManager(aura::Window* window); | |
59 virtual ~LockLayoutManager(); | |
60 | |
61 // Called from a window state object when it gets destroyed. | |
62 void WindowStateDestroyed(aura::Window* window); | |
63 | |
64 // Overridden from aura::LayoutManager: | |
65 virtual void OnWindowResized() OVERRIDE; | |
66 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | |
67 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | |
68 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | |
69 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | |
70 bool visibile) OVERRIDE; | |
71 virtual void SetChildBounds(aura::Window* child, | |
72 const gfx::Rect& requested_bounds) OVERRIDE; | |
73 | |
74 // Overriden from aura::WindowObserver: | |
75 virtual void OnWindowHierarchyChanged( | |
76 const WindowObserver::HierarchyChangeParams& params) OVERRIDE; | |
77 virtual void OnWindowPropertyChanged(aura::Window* window, | |
78 const void* key, | |
79 intptr_t old) OVERRIDE; | |
80 virtual void OnWindowStackingChanged(aura::Window* window) OVERRIDE; | |
81 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | |
82 virtual void OnWindowBoundsChanged(aura::Window* window, | |
83 const gfx::Rect& old_bounds, | |
84 const gfx::Rect& new_bounds) OVERRIDE; | |
85 | |
86 // VirtualKeyboardStateObserver overrides: | |
87 virtual void OnVirtualKeyboardStateChanged(bool activated) OVERRIDE; | |
88 | |
89 // keyboard::KeyboardControllerObserver overrides: | |
90 virtual void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) OVERRIDE; | |
91 | |
92 private: | |
93 typedef std::set<aura::Window*> WindowSet; | |
94 typedef std::map<aura::Window*, LockWindowState*> WindowToState; | |
95 | |
96 // Adjusts the bounds of all managed windows when the display area changes. | |
97 // This happens when the display size, work area insets has changed. | |
98 void AdjustWindowsForWorkAreaChange(const wm::WMEvent* event); | |
99 | |
100 // Remove a window from our tracking list. | |
101 void ForgetWindow(aura::Window* window); | |
102 | |
103 aura::Window* window_; | |
104 aura::Window* root_window_; | |
105 | |
106 // Set of windows we're managing. | |
107 WindowSet windows_; | |
108 | |
109 // Mapping from Window to a custom WindowState instance. | |
110 WindowToState window_state_map_; | |
111 | |
112 // True is subscribed as keyboard controller observer. | |
113 bool is_observing_keyboard_; | |
114 | |
115 // The bounds of the keyboard. | |
116 gfx::Rect keyboard_bounds_; | |
117 | |
118 DISALLOW_COPY_AND_ASSIGN(LockLayoutManager); | |
119 }; | |
120 | |
121 } // namespace ash | |
122 | |
123 #endif // ASH_WM_LOCK_LAYOUT_MANAGER_H_ | |
OLD | NEW |