Chromium Code Reviews| 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 <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" | |
| 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 | |
|
oshima
2014/06/04 19:20:14
nuke empty line
Nikita (slow)
2014/06/05 10:51:37
Done.
| |
| 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 // Overridden from aura::LayoutManager: | |
| 62 virtual void OnWindowResized() OVERRIDE; | |
| 63 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | |
| 64 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | |
| 65 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | |
| 66 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | |
| 67 bool visibile) OVERRIDE; | |
| 68 virtual void SetChildBounds(aura::Window* child, | |
| 69 const gfx::Rect& requested_bounds) OVERRIDE; | |
| 70 | |
| 71 // Overriden from aura::WindowObserver: | |
| 72 virtual void OnWindowHierarchyChanged( | |
| 73 const WindowObserver::HierarchyChangeParams& params) OVERRIDE; | |
| 74 virtual void OnWindowPropertyChanged(aura::Window* window, | |
| 75 const void* key, | |
| 76 intptr_t old) OVERRIDE; | |
| 77 virtual void OnWindowStackingChanged(aura::Window* window) OVERRIDE; | |
| 78 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | |
| 79 virtual void OnWindowBoundsChanged(aura::Window* window, | |
| 80 const gfx::Rect& old_bounds, | |
| 81 const gfx::Rect& new_bounds) OVERRIDE; | |
| 82 | |
| 83 // VirtualKeyboardStateObserver overrides: | |
| 84 virtual void OnVirtualKeyboardStateChanged(bool activated) OVERRIDE; | |
| 85 | |
| 86 // keyboard::KeyboardControllerObserver overrides: | |
| 87 virtual void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) OVERRIDE; | |
| 88 | |
| 89 private: | |
| 90 typedef std::set<aura::Window*> WindowSet; | |
| 91 typedef std::map<aura::Window*, LockWindowState*> WindowToState; | |
| 92 | |
| 93 // Adjusts the bounds of all managed windows when the display area changes. | |
| 94 // This happens when the display size, work area insets has changed. | |
| 95 void AdjustWindowsForWorkAreaChange(const wm::WMEvent* event); | |
| 96 | |
| 97 // Remove a window from our tracking list. | |
| 98 void ForgetWindow(aura::Window* window); | |
| 99 | |
| 100 aura::Window* window_; | |
| 101 aura::Window* root_window_; | |
| 102 | |
| 103 // Set of windows we're managing. | |
| 104 WindowSet windows_; | |
| 105 | |
| 106 // Mapping from Window to a custom WindowState instance. | |
| 107 WindowToState window_state_map_; | |
| 108 | |
| 109 // True is subscribed as keyboard controller observer. | |
| 110 bool is_observing_keyboard_; | |
| 111 | |
| 112 // The bounds of the keyboard. | |
| 113 gfx::Rect keyboard_bounds_; | |
| 114 | |
| 115 DISALLOW_COPY_AND_ASSIGN(LockLayoutManager); | |
| 116 }; | |
| 117 | |
| 118 } // namespace ash | |
| 119 | |
| 120 #endif // ASH_WM_LOCK_LAYOUT_MANAGER_H_ | |
| OLD | NEW |