| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMMON_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_COMMON_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ |
| 6 #define ASH_COMMON_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ | 6 #define ASH_COMMON_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ash/ash_export.h" | 12 #include "ash/ash_export.h" |
| 13 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" | 13 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" |
| 14 #include "ash/common/wm_window_observer.h" | |
| 15 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "ui/aura/window_observer.h" |
| 16 #include "ui/keyboard/keyboard_controller_observer.h" | 16 #include "ui/keyboard/keyboard_controller_observer.h" |
| 17 | 17 |
| 18 namespace gfx { | 18 namespace gfx { |
| 19 class Rect; | 19 class Rect; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace ash { | 22 namespace ash { |
| 23 class WindowDimmer; | 23 class WindowDimmer; |
| 24 | 24 |
| 25 // LayoutManager for the modal window container. | 25 // LayoutManager for the modal window container. |
| 26 // System modal windows which are centered on the screen will be kept centered | 26 // System modal windows which are centered on the screen will be kept centered |
| 27 // when the container size changes. | 27 // when the container size changes. |
| 28 class ASH_EXPORT SystemModalContainerLayoutManager | 28 class ASH_EXPORT SystemModalContainerLayoutManager |
| 29 : public wm::WmSnapToPixelLayoutManager, | 29 : public wm::WmSnapToPixelLayoutManager, |
| 30 public WmWindowObserver, | 30 public aura::WindowObserver, |
| 31 public keyboard::KeyboardControllerObserver { | 31 public keyboard::KeyboardControllerObserver { |
| 32 public: | 32 public: |
| 33 explicit SystemModalContainerLayoutManager(WmWindow* container); | 33 explicit SystemModalContainerLayoutManager(WmWindow* container); |
| 34 ~SystemModalContainerLayoutManager() override; | 34 ~SystemModalContainerLayoutManager() override; |
| 35 | 35 |
| 36 bool has_window_dimmer() const { return window_dimmer_ != nullptr; } | 36 bool has_window_dimmer() const { return window_dimmer_ != nullptr; } |
| 37 | 37 |
| 38 // Overridden from WmSnapToPixelLayoutManager: | 38 // Overridden from WmSnapToPixelLayoutManager: |
| 39 void OnChildWindowVisibilityChanged(WmWindow* child, bool visible) override; | 39 void OnChildWindowVisibilityChanged(WmWindow* child, bool visible) override; |
| 40 void OnWindowResized() override; | 40 void OnWindowResized() override; |
| 41 void OnWindowAddedToLayout(WmWindow* child) override; | 41 void OnWindowAddedToLayout(WmWindow* child) override; |
| 42 void OnWillRemoveWindowFromLayout(WmWindow* child) override; | 42 void OnWillRemoveWindowFromLayout(WmWindow* child) override; |
| 43 void SetChildBounds(WmWindow* child, | 43 void SetChildBounds(WmWindow* child, |
| 44 const gfx::Rect& requested_bounds) override; | 44 const gfx::Rect& requested_bounds) override; |
| 45 | 45 |
| 46 // Overridden from WmWindowObserver: | 46 // Overridden from aura::WindowObserver: |
| 47 void OnWindowPropertyChanged(WmWindow* window, | 47 void OnWindowPropertyChanged(aura::Window* window, |
| 48 WmWindowProperty property) override; | 48 const void* key, |
| 49 intptr_t old) override; |
| 49 | 50 |
| 50 // Overridden from keyboard::KeyboardControllerObserver: | 51 // Overridden from keyboard::KeyboardControllerObserver: |
| 51 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; | 52 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; |
| 52 void OnKeyboardClosed() override; | 53 void OnKeyboardClosed() override; |
| 53 | 54 |
| 54 // True if the window is either contained by the top most modal window, | 55 // True if the window is either contained by the top most modal window, |
| 55 // or contained by its transient children. | 56 // or contained by its transient children. |
| 56 bool IsPartOfActiveModalWindow(WmWindow* window); | 57 bool IsPartOfActiveModalWindow(WmWindow* window); |
| 57 | 58 |
| 58 // Activates next modal window if any. Returns false if there | 59 // Activates next modal window if any. Returns false if there |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 // Windows contained in this set are centered. Windows are automatically | 107 // Windows contained in this set are centered. Windows are automatically |
| 107 // added to this based on IsBoundsCentered(). | 108 // added to this based on IsBoundsCentered(). |
| 108 std::set<const WmWindow*> windows_to_center_; | 109 std::set<const WmWindow*> windows_to_center_; |
| 109 | 110 |
| 110 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerLayoutManager); | 111 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerLayoutManager); |
| 111 }; | 112 }; |
| 112 | 113 |
| 113 } // namespace ash | 114 } // namespace ash |
| 114 | 115 |
| 115 #endif // ASH_COMMON_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ | 116 #endif // ASH_COMMON_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ |
| OLD | NEW |