third_party: Add OWNERS for re2 library.
[chromium-blink-merge.git] / ash / wm / lock_layout_manager.h
blobec79434cb7c5114fa40d77583c49a407c583c675
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.
5 #ifndef ASH_WM_LOCK_LAYOUT_MANAGER_H_
6 #define ASH_WM_LOCK_LAYOUT_MANAGER_H_
8 #include "ash/ash_export.h"
9 #include "ash/shell_delegate.h"
10 #include "ash/snap_to_pixel_layout_manager.h"
11 #include "ash/wm/wm_types.h"
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "ui/aura/layout_manager.h"
16 #include "ui/aura/window_observer.h"
17 #include "ui/gfx/geometry/rect.h"
18 #include "ui/keyboard/keyboard_controller.h"
19 #include "ui/keyboard/keyboard_controller_observer.h"
21 namespace aura {
22 class RootWindow;
23 class Window;
26 namespace ui {
27 class Layer;
30 namespace ash {
31 namespace wm {
32 class WindowState;
33 class WMEvent;
36 // LockLayoutManager is used for the windows created in LockScreenContainer.
37 // For Chrome OS this includes out-of-box/login/lock/multi-profile login use
38 // cases. LockScreenContainer does not use default work area definition.
39 // By default work area is defined as display area minus shelf, docked windows
40 // and minus virtual keyboard bounds.
41 // For windows in LockScreenContainer work area is display area minus virtual
42 // keyboard bounds (only if keyboard overscroll is disabled). If keyboard
43 // overscroll is enabled then work area always equals to display area size since
44 // virtual keyboard changes inner workspace of each WebContents.
45 // For all windows in LockScreenContainer default wm::WindowState is replaced
46 // with LockWindowState.
47 class ASH_EXPORT LockLayoutManager
48 : public SnapToPixelLayoutManager,
49 public aura::WindowObserver,
50 public VirtualKeyboardStateObserver,
51 public keyboard::KeyboardControllerObserver {
52 public:
53 explicit LockLayoutManager(aura::Window* window);
54 ~LockLayoutManager() override;
56 // Overridden from aura::LayoutManager:
57 void OnWindowResized() override;
58 void OnWindowAddedToLayout(aura::Window* child) override;
59 void OnWillRemoveWindowFromLayout(aura::Window* child) override;
60 void OnWindowRemovedFromLayout(aura::Window* child) override;
61 void OnChildWindowVisibilityChanged(aura::Window* child,
62 bool visibile) override;
63 void SetChildBounds(aura::Window* child,
64 const gfx::Rect& requested_bounds) override;
66 // Overriden from aura::WindowObserver:
67 void OnWindowHierarchyChanged(
68 const WindowObserver::HierarchyChangeParams& params) override;
69 void OnWindowPropertyChanged(aura::Window* window,
70 const void* key,
71 intptr_t old) override;
72 void OnWindowStackingChanged(aura::Window* window) override;
73 void OnWindowDestroying(aura::Window* window) override;
74 void OnWindowBoundsChanged(aura::Window* window,
75 const gfx::Rect& old_bounds,
76 const gfx::Rect& new_bounds) override;
78 // VirtualKeyboardStateObserver overrides:
79 void OnVirtualKeyboardStateChanged(bool activated) override;
81 // keyboard::KeyboardControllerObserver overrides:
82 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
84 private:
85 // Adjusts the bounds of all managed windows when the display area changes.
86 // This happens when the display size, work area insets has changed.
87 void AdjustWindowsForWorkAreaChange(const wm::WMEvent* event);
89 aura::Window* window_;
90 aura::Window* root_window_;
92 // True is subscribed as keyboard controller observer.
93 bool is_observing_keyboard_;
95 // The bounds of the keyboard.
96 gfx::Rect keyboard_bounds_;
98 DISALLOW_COPY_AND_ASSIGN(LockLayoutManager);
101 } // namespace ash
103 #endif // ASH_WM_LOCK_LAYOUT_MANAGER_H_