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

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

Issue 2354533004: Ports LockLayoutManager/LockWindowState to ash/common (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
(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_WM_LOCK_LAYOUT_MANAGER_H_
6 #define ASH_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_types.h"
11 #include "ash/snap_to_pixel_layout_manager.h"
12 #include "base/macros.h"
13 #include "ui/aura/layout_manager.h"
14 #include "ui/aura/window_observer.h"
15 #include "ui/gfx/geometry/rect.h"
16 #include "ui/keyboard/keyboard_controller.h"
17 #include "ui/keyboard/keyboard_controller_observer.h"
18
19 namespace aura {
20 class RootWindow;
21 class Window;
22 }
23
24 namespace ui {
25 class Layer;
26 }
27
28 namespace ash {
29 namespace wm {
30 class WindowState;
31 class WMEvent;
32 }
33
34 // LockLayoutManager is used for the windows created in LockScreenContainer.
35 // For Chrome OS this includes out-of-box/login/lock/multi-profile login use
36 // cases. LockScreenContainer does not use default work area definition.
37 // By default work area is defined as display area minus shelf, docked windows
38 // and minus virtual keyboard bounds.
39 // For windows in LockScreenContainer work area is display area minus virtual
40 // keyboard bounds (only if keyboard overscroll is disabled). If keyboard
41 // overscroll is enabled then work area always equals to display area size since
42 // virtual keyboard changes inner workspace of each WebContents.
43 // For all windows in LockScreenContainer default wm::WindowState is replaced
44 // with LockWindowState.
45 class ASH_EXPORT LockLayoutManager
46 : public SnapToPixelLayoutManager,
47 public aura::WindowObserver,
48 public ShellObserver,
49 public keyboard::KeyboardControllerObserver {
50 public:
51 explicit LockLayoutManager(aura::Window* window);
52 ~LockLayoutManager() override;
53
54 // Overridden from aura::LayoutManager:
55 void OnWindowResized() override;
56 void OnWindowAddedToLayout(aura::Window* child) override;
57 void OnWillRemoveWindowFromLayout(aura::Window* child) override;
58 void OnWindowRemovedFromLayout(aura::Window* child) override;
59 void OnChildWindowVisibilityChanged(aura::Window* child,
60 bool visibile) override;
61 void SetChildBounds(aura::Window* child,
62 const gfx::Rect& requested_bounds) override;
63
64 // Overriden from aura::WindowObserver:
65 void OnWindowHierarchyChanged(
66 const WindowObserver::HierarchyChangeParams& params) override;
67 void OnWindowPropertyChanged(aura::Window* window,
68 const void* key,
69 intptr_t old) override;
70 void OnWindowStackingChanged(aura::Window* window) override;
71 void OnWindowDestroying(aura::Window* window) override;
72 void OnWindowBoundsChanged(aura::Window* window,
73 const gfx::Rect& old_bounds,
74 const gfx::Rect& new_bounds) override;
75
76 // ShellObserver:
77 void OnVirtualKeyboardStateChanged(bool activated) override;
78
79 // keyboard::KeyboardControllerObserver overrides:
80 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
81 void OnKeyboardClosed() override;
82
83 private:
84 // Adjusts the bounds of all managed windows when the display area changes.
85 // This happens when the display size, work area insets has changed.
86 void AdjustWindowsForWorkAreaChange(const wm::WMEvent* event);
87
88 aura::Window* window_;
89 aura::Window* root_window_;
90
91 // True is subscribed as keyboard controller observer.
92 bool is_observing_keyboard_;
93
94 // The bounds of the keyboard.
95 gfx::Rect keyboard_bounds_;
96
97 DISALLOW_COPY_AND_ASSIGN(LockLayoutManager);
98 };
99
100 } // namespace ash
101
102 #endif // ASH_WM_LOCK_LAYOUT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698