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

Side by Side Diff: ash/common/wm_shell.cc

Issue 2336653002: Ports SystemModalContainerLayoutManager to ash/common (Closed)
Patch Set: merge again Created 4 years, 3 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/common/wm_shell.h ('k') | ash/common/wm_window_property.h » ('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 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 #include "ash/common/wm_shell.h" 5 #include "ash/common/wm_shell.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/accelerators/accelerator_controller.h" 9 #include "ash/common/accelerators/accelerator_controller.h"
10 #include "ash/common/accelerators/ash_focus_manager_factory.h" 10 #include "ash/common/accelerators/ash_focus_manager_factory.h"
(...skipping 13 matching lines...) Expand all
24 #include "ash/common/system/keyboard_brightness_control_delegate.h" 24 #include "ash/common/system/keyboard_brightness_control_delegate.h"
25 #include "ash/common/system/toast/toast_manager.h" 25 #include "ash/common/system/toast/toast_manager.h"
26 #include "ash/common/system/tray/system_tray_delegate.h" 26 #include "ash/common/system/tray/system_tray_delegate.h"
27 #include "ash/common/system/tray/system_tray_notifier.h" 27 #include "ash/common/system/tray/system_tray_notifier.h"
28 #include "ash/common/wallpaper/wallpaper_controller.h" 28 #include "ash/common/wallpaper/wallpaper_controller.h"
29 #include "ash/common/wallpaper/wallpaper_delegate.h" 29 #include "ash/common/wallpaper/wallpaper_delegate.h"
30 #include "ash/common/wm/immersive_context_ash.h" 30 #include "ash/common/wm/immersive_context_ash.h"
31 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 31 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
32 #include "ash/common/wm/mru_window_tracker.h" 32 #include "ash/common/wm/mru_window_tracker.h"
33 #include "ash/common/wm/overview/window_selector_controller.h" 33 #include "ash/common/wm/overview/window_selector_controller.h"
34 #include "ash/common/wm/system_modal_container_layout_manager.h"
34 #include "ash/common/wm/window_cycle_controller.h" 35 #include "ash/common/wm/window_cycle_controller.h"
36 #include "ash/common/wm_root_window_controller.h"
35 #include "ash/common/wm_window.h" 37 #include "ash/common/wm_window.h"
36 #include "base/bind.h" 38 #include "base/bind.h"
37 #include "base/logging.h" 39 #include "base/logging.h"
38 #include "base/memory/ptr_util.h" 40 #include "base/memory/ptr_util.h"
39 #include "ui/app_list/presenter/app_list_presenter.h" 41 #include "ui/app_list/presenter/app_list_presenter.h"
40 #include "ui/display/display.h" 42 #include "ui/display/display.h"
41 #include "ui/views/focus/focus_manager_factory.h" 43 #include "ui/views/focus/focus_manager_factory.h"
42 44
43 #if defined(OS_CHROMEOS) 45 #if defined(OS_CHROMEOS)
44 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h " 46 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h "
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 window_cycle_controller_(new WindowCycleController), 195 window_cycle_controller_(new WindowCycleController),
194 window_selector_controller_(new WindowSelectorController) { 196 window_selector_controller_(new WindowSelectorController) {
195 #if defined(OS_CHROMEOS) 197 #if defined(OS_CHROMEOS)
196 brightness_control_delegate_.reset(new system::BrightnessControllerChromeos); 198 brightness_control_delegate_.reset(new system::BrightnessControllerChromeos);
197 keyboard_brightness_control_delegate_.reset(new KeyboardBrightnessController); 199 keyboard_brightness_control_delegate_.reset(new KeyboardBrightnessController);
198 #endif 200 #endif
199 } 201 }
200 202
201 WmShell::~WmShell() {} 203 WmShell::~WmShell() {}
202 204
205 WmRootWindowController* WmShell::GetPrimaryRootWindowController() {
206 return GetPrimaryRootWindow()->GetRootWindowController();
207 }
208
203 WmWindow* WmShell::GetRootWindowForNewWindows() { 209 WmWindow* WmShell::GetRootWindowForNewWindows() {
204 if (scoped_root_window_for_new_windows_) 210 if (scoped_root_window_for_new_windows_)
205 return scoped_root_window_for_new_windows_; 211 return scoped_root_window_for_new_windows_;
206 return root_window_for_new_windows_; 212 return root_window_for_new_windows_;
207 } 213 }
208 214
209 bool WmShell::IsSystemModalWindowOpen() { 215 bool WmShell::IsSystemModalWindowOpen() {
210 if (simulate_modal_window_open_for_testing_) 216 if (simulate_modal_window_open_for_testing_)
211 return true; 217 return true;
212 218
213 // Traverse all system modal containers, and find its direct child window 219 // Traverse all system modal containers, and find its direct child window
214 // with "SystemModal" setting, and visible. 220 // with "SystemModal" setting, and visible.
215 for (WmWindow* root : GetAllRootWindows()) { 221 for (WmWindow* root : GetAllRootWindows()) {
216 WmWindow* system_modal = 222 WmWindow* system_modal =
217 root->GetChildByShellWindowId(kShellWindowId_SystemModalContainer); 223 root->GetChildByShellWindowId(kShellWindowId_SystemModalContainer);
218 if (!system_modal) 224 if (!system_modal)
219 continue; 225 continue;
220 for (const WmWindow* child : system_modal->GetChildren()) { 226 for (const WmWindow* child : system_modal->GetChildren()) {
221 if (child->IsSystemModal() && child->GetTargetVisibility()) { 227 if (child->IsSystemModal() && child->GetTargetVisibility()) {
222 return true; 228 return true;
223 } 229 }
224 } 230 }
225 } 231 }
226 return false; 232 return false;
227 } 233 }
228 234
235 void WmShell::CreateModalBackground(WmWindow* window) {
236 for (WmWindow* root_window : GetAllRootWindows()) {
237 root_window->GetRootWindowController()
238 ->GetSystemModalLayoutManager(window)
239 ->CreateModalBackground();
240 }
241 }
242
243 void WmShell::OnModalWindowRemoved(WmWindow* removed) {
244 WmWindow::Windows root_windows = GetAllRootWindows();
245 for (WmWindow* root_window : root_windows) {
246 if (root_window->GetRootWindowController()
247 ->GetSystemModalLayoutManager(removed)
248 ->ActivateNextModalWindow()) {
249 return;
250 }
251 }
252 for (WmWindow* root_window : root_windows) {
253 root_window->GetRootWindowController()
254 ->GetSystemModalLayoutManager(removed)
255 ->DestroyModalBackground();
256 }
257 }
258
229 void WmShell::ShowAppList() { 259 void WmShell::ShowAppList() {
230 // Show the app list on the default display for new windows. 260 // Show the app list on the default display for new windows.
231 int64_t display_id = 261 int64_t display_id =
232 GetRootWindowForNewWindows()->GetDisplayNearestWindow().id(); 262 GetRootWindowForNewWindows()->GetDisplayNearestWindow().id();
233 delegate_->GetAppListPresenter()->Show(display_id); 263 delegate_->GetAppListPresenter()->Show(display_id);
234 } 264 }
235 265
236 void WmShell::DismissAppList() { 266 void WmShell::DismissAppList() {
237 delegate_->GetAppListPresenter()->Dismiss(); 267 delegate_->GetAppListPresenter()->Dismiss();
238 } 268 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 void WmShell::DeleteToastManager() { 335 void WmShell::DeleteToastManager() {
306 toast_manager_.reset(); 336 toast_manager_.reset();
307 } 337 }
308 338
309 void WmShell::SetAcceleratorController( 339 void WmShell::SetAcceleratorController(
310 std::unique_ptr<AcceleratorController> accelerator_controller) { 340 std::unique_ptr<AcceleratorController> accelerator_controller) {
311 accelerator_controller_ = std::move(accelerator_controller); 341 accelerator_controller_ = std::move(accelerator_controller);
312 } 342 }
313 343
314 } // namespace ash 344 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm_shell.h ('k') | ash/common/wm_window_property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698