Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: ash/wm/system_modal_container_layout_manager.h

Issue 2871813002: Converts remaining usage of WmLayoutManager to aura::LayoutManager (Closed)
Patch Set: cleanup Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/root_window_layout_manager.cc ('k') | ash/wm/system_modal_container_layout_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 12 matching lines...) Expand all
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 aura::WindowObserver, 30 public aura::WindowObserver,
31 public keyboard::KeyboardControllerObserver { 31 public keyboard::KeyboardControllerObserver {
32 public: 32 public:
33 explicit SystemModalContainerLayoutManager(WmWindow* container); 33 explicit SystemModalContainerLayoutManager(aura::Window* 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(aura::Window* child,
40 bool visible) override;
40 void OnWindowResized() override; 41 void OnWindowResized() override;
41 void OnWindowAddedToLayout(WmWindow* child) override; 42 void OnWindowAddedToLayout(aura::Window* child) override;
42 void OnWillRemoveWindowFromLayout(WmWindow* child) override; 43 void OnWillRemoveWindowFromLayout(aura::Window* child) override;
43 void SetChildBounds(WmWindow* child, 44 void SetChildBounds(aura::Window* child,
44 const gfx::Rect& requested_bounds) override; 45 const gfx::Rect& requested_bounds) override;
45 46
46 // Overridden from aura::WindowObserver: 47 // Overridden from aura::WindowObserver:
47 void OnWindowPropertyChanged(aura::Window* window, 48 void OnWindowPropertyChanged(aura::Window* window,
48 const void* key, 49 const void* key,
49 intptr_t old) override; 50 intptr_t old) override;
50 51
51 // Overridden from keyboard::KeyboardControllerObserver: 52 // Overridden from keyboard::KeyboardControllerObserver:
52 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override; 53 void OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) override;
53 void OnKeyboardClosed() override; 54 void OnKeyboardClosed() override;
54 55
55 // True if the window is either contained by the top most modal window, 56 // True if the window is either contained by the top most modal window,
56 // or contained by its transient children. 57 // or contained by its transient children.
57 bool IsPartOfActiveModalWindow(WmWindow* window); 58 bool IsPartOfActiveModalWindow(aura::Window* window);
58 59
59 // Activates next modal window if any. Returns false if there 60 // Activates next modal window if any. Returns false if there
60 // are no more modal windows in this layout manager. 61 // are no more modal windows in this layout manager.
61 bool ActivateNextModalWindow(); 62 bool ActivateNextModalWindow();
62 63
63 // Creates modal background window, which is a partially-opaque 64 // Creates modal background window, which is a partially-opaque
64 // fullscreen window. If there is already a modal background window, 65 // fullscreen window. If there is already a modal background window,
65 // it will bring it the top. 66 // it will bring it the top.
66 void CreateModalBackground(); 67 void CreateModalBackground();
67 68
68 void DestroyModalBackground(); 69 void DestroyModalBackground();
69 70
70 // Is the |window| modal background? 71 // Is the |window| modal background?
71 static bool IsModalBackground(WmWindow* window); 72 static bool IsModalBackground(aura::Window* window);
72 73
73 private: 74 private:
74 void AddModalWindow(WmWindow* window); 75 void AddModalWindow(aura::Window* window);
75 76
76 // Removes |window| from |modal_windows_|. Returns true if |window| was in 77 // Removes |window| from |modal_windows_|. Returns true if |window| was in
77 // |modal_windows_|. 78 // |modal_windows_|.
78 bool RemoveModalWindow(WmWindow* window); 79 bool RemoveModalWindow(aura::Window* window);
79 80
80 // Reposition the dialogs to become visible after the work area changes. 81 // Reposition the dialogs to become visible after the work area changes.
81 void PositionDialogsAfterWorkAreaResize(); 82 void PositionDialogsAfterWorkAreaResize();
82 83
83 // Get the usable bounds rectangle for enclosed dialogs. 84 // Get the usable bounds rectangle for enclosed dialogs.
84 gfx::Rect GetUsableDialogArea() const; 85 gfx::Rect GetUsableDialogArea() const;
85 86
86 // Gets the new bounds for a |window| to use which are either centered (if the 87 // Gets the new bounds for a |window| to use which are either centered (if the
87 // window was previously centered) or fitted to the screen. 88 // window was previously centered) or fitted to the screen.
88 gfx::Rect GetCenteredAndOrFittedBounds(const WmWindow* window); 89 gfx::Rect GetCenteredAndOrFittedBounds(const aura::Window* window);
89 90
90 // Returns true if |bounds| is considered centered. 91 // Returns true if |bounds| is considered centered.
91 bool IsBoundsCentered(const gfx::Rect& window_bounds) const; 92 bool IsBoundsCentered(const gfx::Rect& window_bounds) const;
92 93
93 WmWindow* modal_window() { 94 aura::Window* modal_window() {
94 return !modal_windows_.empty() ? modal_windows_.back() : nullptr; 95 return !modal_windows_.empty() ? modal_windows_.back() : nullptr;
95 } 96 }
96 97
97 // The container that owns the layout manager. 98 // The container that owns the layout manager.
98 WmWindow* container_; 99 aura::Window* container_;
99 100
100 // WindowDimmer used to dim windows behind the modal window(s) being shown in 101 // WindowDimmer used to dim windows behind the modal window(s) being shown in
101 // |container_|. 102 // |container_|.
102 std::unique_ptr<WindowDimmer> window_dimmer_; 103 std::unique_ptr<WindowDimmer> window_dimmer_;
103 104
104 // A stack of modal windows. Only the topmost can receive events. 105 // A stack of modal windows. Only the topmost can receive events.
105 std::vector<WmWindow*> modal_windows_; 106 std::vector<aura::Window*> modal_windows_;
106 107
107 // Windows contained in this set are centered. Windows are automatically 108 // Windows contained in this set are centered. Windows are automatically
108 // added to this based on IsBoundsCentered(). 109 // added to this based on IsBoundsCentered().
109 std::set<const WmWindow*> windows_to_center_; 110 std::set<const aura::Window*> windows_to_center_;
110 111
111 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerLayoutManager); 112 DISALLOW_COPY_AND_ASSIGN(SystemModalContainerLayoutManager);
112 }; 113 };
113 114
114 } // namespace ash 115 } // namespace ash
115 116
116 #endif // ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_ 117 #endif // ASH_WM_SYSTEM_MODAL_CONTAINER_LAYOUT_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/wm/root_window_layout_manager.cc ('k') | ash/wm/system_modal_container_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698