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_WM_LOCK_LAYOUT_MANAGER_H_ |
| 6 #define ASH_WM_LOCK_LAYOUT_MANAGER_H_ |
| 7 |
| 8 #include "ash/ash_export.h" |
| 9 #include "ash/shell_delegate.h" |
| 10 #include "ash/wm/wm_types.h" |
| 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "ui/aura/layout_manager.h" |
| 15 #include "ui/aura/window_observer.h" |
| 16 #include "ui/gfx/rect.h" |
| 17 #include "ui/keyboard/keyboard_controller.h" |
| 18 #include "ui/keyboard/keyboard_controller_observer.h" |
| 19 |
| 20 namespace aura { |
| 21 class RootWindow; |
| 22 class Window; |
| 23 } |
| 24 |
| 25 namespace ui { |
| 26 class Layer; |
| 27 } |
| 28 |
| 29 namespace ash { |
| 30 namespace wm { |
| 31 class WindowState; |
| 32 class WMEvent; |
| 33 } |
| 34 |
| 35 // LockLayoutManager is used for the windows created in LockScreenContainer. |
| 36 // For Chrome OS this includes out-of-box/login/lock/multi-profile login use |
| 37 // cases. LockScreenContainer does not use default work area definition. |
| 38 // By default work area is defined as display area minus shelf, docked windows |
| 39 // and minus virtual keyboard bounds. |
| 40 // For windows in LockScreenContainer work area is display area minus virtual |
| 41 // keyboard bounds (only if keyboard overscroll is disabled). If keyboard |
| 42 // overscroll is enabled then work area always equals to display area size since |
| 43 // virtual keyboard changes inner workspace of each WebContents. |
| 44 // For all windows in LockScreenContainer default wm::WindowState is replaced |
| 45 // with LockWindowState. |
| 46 class ASH_EXPORT LockLayoutManager |
| 47 : public aura::LayoutManager, |
| 48 public aura::WindowObserver, |
| 49 public VirtualKeyboardStateObserver, |
| 50 public keyboard::KeyboardControllerObserver { |
| 51 public: |
| 52 explicit LockLayoutManager(aura::Window* window); |
| 53 virtual ~LockLayoutManager(); |
| 54 |
| 55 // Overridden from aura::LayoutManager: |
| 56 virtual void OnWindowResized() OVERRIDE; |
| 57 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
| 58 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
| 59 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
| 60 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| 61 bool visibile) OVERRIDE; |
| 62 virtual void SetChildBounds(aura::Window* child, |
| 63 const gfx::Rect& requested_bounds) OVERRIDE; |
| 64 |
| 65 // Overriden from aura::WindowObserver: |
| 66 virtual void OnWindowHierarchyChanged( |
| 67 const WindowObserver::HierarchyChangeParams& params) OVERRIDE; |
| 68 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 69 const void* key, |
| 70 intptr_t old) OVERRIDE; |
| 71 virtual void OnWindowStackingChanged(aura::Window* window) OVERRIDE; |
| 72 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
| 73 virtual void OnWindowBoundsChanged(aura::Window* window, |
| 74 const gfx::Rect& old_bounds, |
| 75 const gfx::Rect& new_bounds) OVERRIDE; |
| 76 |
| 77 // VirtualKeyboardStateObserver overrides: |
| 78 virtual void OnVirtualKeyboardStateChanged(bool activated) OVERRIDE; |
| 79 |
| 80 // keyboard::KeyboardControllerObserver overrides: |
| 81 virtual void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) 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_ |
OLD | NEW |