OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ROOT_WINDOW_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_WM_ROOT_WINDOW_CONTROLLER_H_ |
6 #define ASH_COMMON_WM_ROOT_WINDOW_CONTROLLER_H_ | 6 #define ASH_COMMON_WM_ROOT_WINDOW_CONTROLLER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/common/wm/workspace/workspace_types.h" | 9 #include "ash/common/wm/workspace/workspace_types.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 namespace views { | 22 namespace views { |
23 class MenuModelAdapter; | 23 class MenuModelAdapter; |
24 class MenuRunner; | 24 class MenuRunner; |
25 } | 25 } |
26 | 26 |
27 namespace ash { | 27 namespace ash { |
28 | 28 |
29 class AlwaysOnTopController; | 29 class AlwaysOnTopController; |
30 class AnimatingWallpaperWidgetController; | 30 class AnimatingWallpaperWidgetController; |
31 class DockedWindowLayoutManager; | |
32 class PanelLayoutManager; | |
31 class SystemModalContainerLayoutManager; | 33 class SystemModalContainerLayoutManager; |
32 class WallpaperWidgetController; | 34 class WallpaperWidgetController; |
33 class WmShelf; | 35 class WmShelf; |
34 class WmShell; | 36 class WmShell; |
35 class WmWindow; | 37 class WmWindow; |
36 class WorkspaceController; | 38 class WorkspaceController; |
37 | 39 |
38 namespace wm { | 40 namespace wm { |
39 class RootWindowLayoutManager; | 41 class RootWindowLayoutManager; |
40 } | 42 } |
41 | 43 |
42 // Provides state associated with a root of a window hierarchy. | 44 // Provides state associated with a root of a window hierarchy. |
43 class ASH_EXPORT WmRootWindowController { | 45 class ASH_EXPORT WmRootWindowController { |
44 public: | 46 public: |
45 explicit WmRootWindowController(WmWindow* window); | 47 explicit WmRootWindowController(WmWindow* window); |
46 virtual ~WmRootWindowController(); | 48 virtual ~WmRootWindowController(); |
47 | 49 |
50 DockedWindowLayoutManager* docked_window_layout_manager() { | |
51 return docked_window_layout_manager_; | |
52 } | |
53 | |
54 PanelLayoutManager* panel_layout_manager() { return panel_layout_manager_; } | |
55 | |
48 wm::RootWindowLayoutManager* root_window_layout_manager() { | 56 wm::RootWindowLayoutManager* root_window_layout_manager() { |
49 return root_window_layout_manager_; | 57 return root_window_layout_manager_; |
50 } | 58 } |
51 | 59 |
52 WallpaperWidgetController* wallpaper_widget_controller() { | 60 WallpaperWidgetController* wallpaper_widget_controller() { |
53 return wallpaper_widget_controller_.get(); | 61 return wallpaper_widget_controller_.get(); |
54 } | 62 } |
55 void SetWallpaperWidgetController(WallpaperWidgetController* controller); | 63 void SetWallpaperWidgetController(WallpaperWidgetController* controller); |
56 | 64 |
57 AnimatingWallpaperWidgetController* animating_wallpaper_widget_controller() { | 65 AnimatingWallpaperWidgetController* animating_wallpaper_widget_controller() { |
(...skipping 15 matching lines...) Expand all Loading... | |
73 // If no window is specified (i.e. |window| is null), then the lockscreen | 81 // If no window is specified (i.e. |window| is null), then the lockscreen |
74 // modal container is used if the screen is currently locked. Otherwise, the | 82 // modal container is used if the screen is currently locked. Otherwise, the |
75 // default modal container is used. | 83 // default modal container is used. |
76 SystemModalContainerLayoutManager* GetSystemModalLayoutManager( | 84 SystemModalContainerLayoutManager* GetSystemModalLayoutManager( |
77 WmWindow* window); | 85 WmWindow* window); |
78 | 86 |
79 virtual bool HasShelf() = 0; | 87 virtual bool HasShelf() = 0; |
80 | 88 |
81 virtual WmShell* GetShell() = 0; | 89 virtual WmShell* GetShell() = 0; |
82 | 90 |
83 virtual AlwaysOnTopController* GetAlwaysOnTopController() = 0; | 91 AlwaysOnTopController* always_on_top_controller() { |
James Cook
2016/09/21 22:03:18
nit: move this up with other inline getters
sky
2016/09/21 22:47:48
Done.
| |
92 return always_on_top_controller_.get(); | |
93 } | |
84 | 94 |
85 virtual WmShelf* GetShelf() = 0; | 95 virtual WmShelf* GetShelf() = 0; |
86 | 96 |
87 // Returns the window associated with this WmRootWindowController. | 97 // Returns the window associated with this WmRootWindowController. |
88 virtual WmWindow* GetWindow() = 0; | 98 virtual WmWindow* GetWindow() = 0; |
89 | 99 |
90 // Gets the WmWindow whose shell window id is |container_id|. | 100 // Gets the WmWindow whose shell window id is |container_id|. |
91 WmWindow* GetContainer(int container_id); | 101 WmWindow* GetContainer(int container_id); |
92 const WmWindow* GetContainer(int container_id) const; | 102 const WmWindow* GetContainer(int container_id) const; |
93 | 103 |
(...skipping 27 matching lines...) Expand all Loading... | |
121 protected: | 131 protected: |
122 // Moves child windows to |dest|. | 132 // Moves child windows to |dest|. |
123 void MoveWindowsTo(WmWindow* dest); | 133 void MoveWindowsTo(WmWindow* dest); |
124 | 134 |
125 // Creates the containers (WmWindows) used by the shell. | 135 // Creates the containers (WmWindows) used by the shell. |
126 void CreateContainers(); | 136 void CreateContainers(); |
127 | 137 |
128 // Creates the LayoutManagers for the windows created by CreateContainers(). | 138 // Creates the LayoutManagers for the windows created by CreateContainers(). |
129 void CreateLayoutManagers(); | 139 void CreateLayoutManagers(); |
130 | 140 |
131 void DeleteWorkspaceController(); | 141 // Resets WmShell::GetRootWindowForNewWindows() if appropriate. This is called |
142 // during shutdown to make sure GetRootWindowForNewWindows() isn't referencing | |
143 // this. | |
144 void ResetRootForNewWindowsIfNecessary(); | |
145 | |
146 // Called during shutdown to destroy state such as windows and LayoutManagers. | |
147 void CloseChildWindows(); | |
148 | |
149 // Called from CloseChildWindows() to determine if the specified window should | |
150 // be destroyed. | |
151 virtual bool ShouldDestroyWindowInCloseChildWindows(WmWindow* window) = 0; | |
132 | 152 |
133 private: | 153 private: |
134 // Callback for MenuModelAdapter. | 154 // Callback for MenuModelAdapter. |
135 void OnMenuClosed(); | 155 void OnMenuClosed(); |
136 | 156 |
137 WmWindow* root_; | 157 WmWindow* root_; |
138 | 158 |
139 wm::RootWindowLayoutManager* root_window_layout_manager_; | 159 // LayoutManagers are owned by the window they are installed on. |
James Cook
2016/09/21 22:03:18
+1 for helpful ownership comment
| |
160 DockedWindowLayoutManager* docked_window_layout_manager_ = nullptr; | |
161 PanelLayoutManager* panel_layout_manager_ = nullptr; | |
162 wm::RootWindowLayoutManager* root_window_layout_manager_ = nullptr; | |
140 | 163 |
141 std::unique_ptr<WallpaperWidgetController> wallpaper_widget_controller_; | 164 std::unique_ptr<WallpaperWidgetController> wallpaper_widget_controller_; |
142 std::unique_ptr<AnimatingWallpaperWidgetController> | 165 std::unique_ptr<AnimatingWallpaperWidgetController> |
143 animating_wallpaper_widget_controller_; | 166 animating_wallpaper_widget_controller_; |
144 std::unique_ptr<WorkspaceController> workspace_controller_; | 167 std::unique_ptr<WorkspaceController> workspace_controller_; |
145 | 168 |
169 std::unique_ptr<AlwaysOnTopController> always_on_top_controller_; | |
170 | |
146 // Manages the context menu. | 171 // Manages the context menu. |
147 std::unique_ptr<ui::MenuModel> menu_model_; | 172 std::unique_ptr<ui::MenuModel> menu_model_; |
148 std::unique_ptr<views::MenuModelAdapter> menu_model_adapter_; | 173 std::unique_ptr<views::MenuModelAdapter> menu_model_adapter_; |
149 std::unique_ptr<views::MenuRunner> menu_runner_; | 174 std::unique_ptr<views::MenuRunner> menu_runner_; |
150 | 175 |
151 DISALLOW_COPY_AND_ASSIGN(WmRootWindowController); | 176 DISALLOW_COPY_AND_ASSIGN(WmRootWindowController); |
152 }; | 177 }; |
153 | 178 |
154 } // namespace ash | 179 } // namespace ash |
155 | 180 |
156 #endif // ASH_COMMON_WM_ROOT_WINDOW_CONTROLLER_H_ | 181 #endif // ASH_COMMON_WM_ROOT_WINDOW_CONTROLLER_H_ |
OLD | NEW |