Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_WM_LOCK_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_COMMON_WM_LOCK_LAYOUT_MANAGER_H_ |
| 6 #define ASH_WM_LOCK_LAYOUT_MANAGER_H_ | 6 #define ASH_COMMON_WM_LOCK_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/common/shell_observer.h" | 9 #include "ash/common/shell_observer.h" |
| 10 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" | |
| 10 #include "ash/common/wm/wm_types.h" | 11 #include "ash/common/wm/wm_types.h" |
| 11 #include "ash/snap_to_pixel_layout_manager.h" | 12 #include "ash/common/wm_window_observer.h" |
| 12 #include "base/macros.h" | 13 #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" | 14 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/keyboard/keyboard_controller.h" | 15 #include "ui/keyboard/keyboard_controller.h" |
| 17 #include "ui/keyboard/keyboard_controller_observer.h" | 16 #include "ui/keyboard/keyboard_controller_observer.h" |
| 18 | 17 |
| 19 namespace aura { | |
| 20 class RootWindow; | |
| 21 class Window; | |
| 22 } | |
| 23 | |
| 24 namespace ui { | |
| 25 class Layer; | |
| 26 } | |
| 27 | |
| 28 namespace ash { | 18 namespace ash { |
| 29 namespace wm { | 19 namespace wm { |
| 30 class WindowState; | 20 class WindowState; |
| 31 class WMEvent; | 21 class WMEvent; |
| 32 } | 22 } |
| 33 | 23 |
| 34 // LockLayoutManager is used for the windows created in LockScreenContainer. | 24 // LockLayoutManager is used for the windows created in LockScreenContainer. |
| 35 // For Chrome OS this includes out-of-box/login/lock/multi-profile login use | 25 // For Chrome OS this includes out-of-box/login/lock/multi-profile login use |
| 36 // cases. LockScreenContainer does not use default work area definition. | 26 // cases. LockScreenContainer does not use default work area definition. |
| 37 // By default work area is defined as display area minus shelf, docked windows | 27 // By default work area is defined as display area minus shelf, docked windows |
| 38 // and minus virtual keyboard bounds. | 28 // and minus virtual keyboard bounds. |
| 39 // For windows in LockScreenContainer work area is display area minus virtual | 29 // For windows in LockScreenContainer work area is display area minus virtual |
| 40 // keyboard bounds (only if keyboard overscroll is disabled). If keyboard | 30 // keyboard bounds (only if keyboard overscroll is disabled). If keyboard |
| 41 // overscroll is enabled then work area always equals to display area size since | 31 // overscroll is enabled then work area always equals to display area size since |
| 42 // virtual keyboard changes inner workspace of each WebContents. | 32 // virtual keyboard changes inner workspace of each WebContents. |
| 43 // For all windows in LockScreenContainer default wm::WindowState is replaced | 33 // For all windows in LockScreenContainer default wm::WindowState is replaced |
| 44 // with LockWindowState. | 34 // with LockWindowState. |
| 45 class ASH_EXPORT LockLayoutManager | 35 class ASH_EXPORT LockLayoutManager |
| 46 : public SnapToPixelLayoutManager, | 36 : public wm::WmSnapToPixelLayoutManager, |
| 47 public aura::WindowObserver, | 37 public WmWindowObserver, |
| 48 public ShellObserver, | 38 public ShellObserver, |
| 49 public keyboard::KeyboardControllerObserver { | 39 public keyboard::KeyboardControllerObserver { |
| 50 public: | 40 public: |
| 51 explicit LockLayoutManager(aura::Window* window); | 41 explicit LockLayoutManager(WmWindow* window); |
| 52 ~LockLayoutManager() override; | 42 ~LockLayoutManager() override; |
| 53 | 43 |
| 54 // Overridden from aura::LayoutManager: | 44 // Overridden from WmSnapToPixelLayoutManager: |
| 55 void OnWindowResized() override; | 45 void OnWindowResized() override; |
| 56 void OnWindowAddedToLayout(aura::Window* child) override; | 46 void OnWindowAddedToLayout(WmWindow* child) override; |
| 57 void OnWillRemoveWindowFromLayout(aura::Window* child) override; | 47 void OnWillRemoveWindowFromLayout(WmWindow* child) override; |
| 58 void OnWindowRemovedFromLayout(aura::Window* child) override; | 48 void OnWindowRemovedFromLayout(WmWindow* child) override; |
| 59 void OnChildWindowVisibilityChanged(aura::Window* child, | 49 void OnChildWindowVisibilityChanged(WmWindow* child, bool visibile) override; |
| 60 bool visibile) override; | 50 void SetChildBounds(WmWindow* child, |
| 61 void SetChildBounds(aura::Window* child, | |
| 62 const gfx::Rect& requested_bounds) override; | 51 const gfx::Rect& requested_bounds) override; |
| 63 | 52 |
| 64 // Overriden from aura::WindowObserver: | 53 // Overriden from WmWindowObserver: |
|
James Cook
2016/09/20 18:22:47
super-nit: "Overridden" or just WmWindowObserver:
| |
| 65 void OnWindowHierarchyChanged( | 54 void OnWindowDestroying(WmWindow* window) override; |
| 66 const WindowObserver::HierarchyChangeParams& params) override; | 55 void OnWindowBoundsChanged(WmWindow* window, |
| 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, | 56 const gfx::Rect& old_bounds, |
| 74 const gfx::Rect& new_bounds) override; | 57 const gfx::Rect& new_bounds) override; |
| 75 | 58 |
| 76 // ShellObserver: | 59 // ShellObserver: |
| 77 void OnVirtualKeyboardStateChanged(bool activated) override; | 60 void OnVirtualKeyboardStateChanged(bool activated) override; |
| 78 | 61 |
| 79 // keyboard::KeyboardControllerObserver overrides: | 62 // keyboard::KeyboardControllerObserver overrides: |
| 80 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; | 63 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; |
| 81 void OnKeyboardClosed() override; | 64 void OnKeyboardClosed() override; |
| 82 | 65 |
| 83 private: | 66 private: |
| 84 // Adjusts the bounds of all managed windows when the display area changes. | 67 // Adjusts the bounds of all managed windows when the display area changes. |
| 85 // This happens when the display size, work area insets has changed. | 68 // This happens when the display size, work area insets has changed. |
| 86 void AdjustWindowsForWorkAreaChange(const wm::WMEvent* event); | 69 void AdjustWindowsForWorkAreaChange(const wm::WMEvent* event); |
| 87 | 70 |
| 88 aura::Window* window_; | 71 WmWindow* window_; |
| 89 aura::Window* root_window_; | 72 WmWindow* root_window_; |
| 90 | 73 |
| 91 // True is subscribed as keyboard controller observer. | 74 // True is subscribed as keyboard controller observer. |
| 92 bool is_observing_keyboard_; | 75 bool is_observing_keyboard_; |
| 93 | 76 |
| 94 // The bounds of the keyboard. | 77 // The bounds of the keyboard. |
| 95 gfx::Rect keyboard_bounds_; | 78 gfx::Rect keyboard_bounds_; |
| 96 | 79 |
| 97 DISALLOW_COPY_AND_ASSIGN(LockLayoutManager); | 80 DISALLOW_COPY_AND_ASSIGN(LockLayoutManager); |
| 98 }; | 81 }; |
| 99 | 82 |
| 100 } // namespace ash | 83 } // namespace ash |
| 101 | 84 |
| 102 #endif // ASH_WM_LOCK_LAYOUT_MANAGER_H_ | 85 #endif // ASH_COMMON_WM_LOCK_LAYOUT_MANAGER_H_ |
| OLD | NEW |