| 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_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ |
| 6 #define ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/snap_to_pixel_layout_manager.h" | 11 #include "ash/snap_to_pixel_layout_manager.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
| 15 #include "ui/keyboard/keyboard_controller_observer.h" | 15 #include "ui/keyboard/keyboard_controller_observer.h" |
| 16 | 16 |
| 17 namespace aura { | 17 namespace aura { |
| 18 class Window; | 18 class Window; |
| 19 class EventFilter; | 19 class EventFilter; |
| 20 } | 20 } |
| 21 namespace gfx { | 21 namespace gfx { |
| 22 class Rect; | 22 class Rect; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace ash { | 25 namespace ash { |
| 26 class DimWindow; | 26 class WindowDimmer; |
| 27 | 27 |
| 28 // LayoutManager for the modal window container. | 28 // LayoutManager for the modal window container. |
| 29 // System modal windows which are centered on the screen will be kept centered | 29 // System modal windows which are centered on the screen will be kept centered |
| 30 // when the container size changes. | 30 // when the container size changes. |
| 31 class ASH_EXPORT SystemModalContainerLayoutManager | 31 class ASH_EXPORT SystemModalContainerLayoutManager |
| 32 : public SnapToPixelLayoutManager, | 32 : public SnapToPixelLayoutManager, |
| 33 public aura::WindowObserver, | 33 public aura::WindowObserver, |
| 34 public keyboard::KeyboardControllerObserver { | 34 public keyboard::KeyboardControllerObserver { |
| 35 public: | 35 public: |
| 36 explicit SystemModalContainerLayoutManager(aura::Window* container); | 36 explicit SystemModalContainerLayoutManager(aura::Window* container); |
| 37 ~SystemModalContainerLayoutManager() override; | 37 ~SystemModalContainerLayoutManager() override; |
| 38 | 38 |
| 39 bool has_modal_background() const { return modal_background_ != NULL; } | 39 bool has_window_dimmer() const { return window_dimmer_ != nullptr; } |
| 40 | 40 |
| 41 // Overridden from SnapToPixelLayoutManager: | 41 // Overridden from SnapToPixelLayoutManager: |
| 42 void OnWindowResized() override; | 42 void OnWindowResized() override; |
| 43 void OnWindowAddedToLayout(aura::Window* child) override; | 43 void OnWindowAddedToLayout(aura::Window* child) override; |
| 44 void OnWillRemoveWindowFromLayout(aura::Window* child) override; | 44 void OnWillRemoveWindowFromLayout(aura::Window* child) override; |
| 45 void SetChildBounds(aura::Window* child, | 45 void SetChildBounds(aura::Window* child, |
| 46 const gfx::Rect& requested_bounds) override; | 46 const gfx::Rect& requested_bounds) override; |
| 47 | 47 |
| 48 // Overridden from aura::WindowObserver: | 48 // Overridden from aura::WindowObserver: |
| 49 void OnWindowPropertyChanged(aura::Window* window, | 49 void OnWindowPropertyChanged(aura::Window* window, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Returns true if |window_bounds| is centered. | 90 // Returns true if |window_bounds| is centered. |
| 91 bool DialogIsCentered(const gfx::Rect& window_bounds); | 91 bool DialogIsCentered(const gfx::Rect& window_bounds); |
| 92 | 92 |
| 93 aura::Window* modal_window() { | 93 aura::Window* modal_window() { |
| 94 return !modal_windows_.empty() ? modal_windows_.back() : NULL; | 94 return !modal_windows_.empty() ? modal_windows_.back() : NULL; |
| 95 } | 95 } |
| 96 | 96 |
| 97 // The container that owns the layout manager. | 97 // The container that owns the layout manager. |
| 98 aura::Window* container_; | 98 aura::Window* container_; |
| 99 | 99 |
| 100 // A window that dims the windows behind the modal window(s) being | 100 // WindowDimmer used to dim windows behind the modal window(s) being shown in |
| 101 // shown in |container_|. | 101 // |container_|. |
| 102 DimWindow* modal_background_; | 102 WindowDimmer* window_dimmer_ = nullptr; |
| 103 | 103 |
| 104 // A stack of modal windows. Only the topmost can receive events. | 104 // A stack of modal windows. Only the topmost can receive events. |
| 105 std::vector<aura::Window*> modal_windows_; | 105 std::vector<aura::Window*> modal_windows_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerLayoutManager); | 107 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerLayoutManager); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace ash | 110 } // namespace ash |
| 111 | 111 |
| 112 #endif // ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ | 112 #endif // ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ |
| OLD | NEW |