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

Side by Side Diff: ash/common/wm/workspace/workspace_layout_manager.cc

Issue 2780943002: Enables ScreenPinningController for mash/mus (Closed)
Patch Set: local Created 3 years, 8 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
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 #include "ash/common/wm/workspace/workspace_layout_manager.h" 5 #include "ash/common/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/common/keyboard/keyboard_observer_register.h" 9 #include "ash/common/keyboard/keyboard_observer_register.h"
10 #include "ash/common/session/session_controller.h" 10 #include "ash/common/session/session_controller.h"
11 #include "ash/common/shelf/wm_shelf.h" 11 #include "ash/common/shelf/wm_shelf.h"
12 #include "ash/common/wm/always_on_top_controller.h" 12 #include "ash/common/wm/always_on_top_controller.h"
13 #include "ash/common/wm/fullscreen_window_finder.h" 13 #include "ash/common/wm/fullscreen_window_finder.h"
14 #include "ash/common/wm/window_positioner.h" 14 #include "ash/common/wm/window_positioner.h"
15 #include "ash/common/wm/window_state.h" 15 #include "ash/common/wm/window_state.h"
16 #include "ash/common/wm/wm_event.h" 16 #include "ash/common/wm/wm_event.h"
17 #include "ash/common/wm/wm_screen_util.h" 17 #include "ash/common/wm/wm_screen_util.h"
18 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h" 18 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h"
19 #include "ash/common/wm_shell.h" 19 #include "ash/common/wm_shell.h"
20 #include "ash/common/wm_window.h" 20 #include "ash/common/wm_window.h"
21 #include "ash/public/cpp/shell_window_ids.h" 21 #include "ash/public/cpp/shell_window_ids.h"
22 #include "ash/root_window_controller.h" 22 #include "ash/root_window_controller.h"
23 #include "ash/shell.h" 23 #include "ash/shell.h"
24 #include "ash/wm/screen_pinning_controller.h"
24 #include "ash/wm/window_properties.h" 25 #include "ash/wm/window_properties.h"
25 #include "ash/wm/window_state_aura.h" 26 #include "ash/wm/window_state_aura.h"
26 #include "base/command_line.h" 27 #include "base/command_line.h"
27 #include "ui/aura/client/aura_constants.h" 28 #include "ui/aura/client/aura_constants.h"
28 #include "ui/base/ui_base_switches.h" 29 #include "ui/base/ui_base_switches.h"
29 #include "ui/compositor/layer.h" 30 #include "ui/compositor/layer.h"
30 #include "ui/display/display.h" 31 #include "ui/display/display.h"
31 #include "ui/display/screen.h" 32 #include "ui/display/screen.h"
32 #include "ui/keyboard/keyboard_controller.h" 33 #include "ui/keyboard/keyboard_controller.h"
33 #include "ui/keyboard/keyboard_controller_observer.h" 34 #include "ui/keyboard/keyboard_controller_observer.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE); 79 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE);
79 window_state->OnWMEvent(&event); 80 window_state->OnWMEvent(&event);
80 windows_.insert(child); 81 windows_.insert(child);
81 child->aura_window()->AddObserver(this); 82 child->aura_window()->AddObserver(this);
82 window_state->AddObserver(this); 83 window_state->AddObserver(this);
83 UpdateShelfVisibility(); 84 UpdateShelfVisibility();
84 UpdateFullscreenState(); 85 UpdateFullscreenState();
85 if (backdrop_delegate_) 86 if (backdrop_delegate_)
86 backdrop_delegate_->OnWindowAddedToLayout(child); 87 backdrop_delegate_->OnWindowAddedToLayout(child);
87 WindowPositioner::RearrangeVisibleWindowOnShow(child); 88 WindowPositioner::RearrangeVisibleWindowOnShow(child);
88 if (WmShell::Get()->IsPinned()) 89 if (Shell::Get()->screen_pinning_controller()->IsPinned())
89 child->GetWindowState()->DisableAlwaysOnTop(nullptr); 90 child->GetWindowState()->DisableAlwaysOnTop(nullptr);
90 } 91 }
91 92
92 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(WmWindow* child) { 93 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(WmWindow* child) {
93 windows_.erase(child); 94 windows_.erase(child);
94 child->aura_window()->RemoveObserver(this); 95 child->aura_window()->RemoveObserver(this);
95 child->GetWindowState()->RemoveObserver(this); 96 child->GetWindowState()->RemoveObserver(this);
96 97
97 if (child->GetTargetVisibility()) 98 if (child->GetTargetVisibility())
98 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); 99 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 302
302 ////////////////////////////////////////////////////////////////////////////// 303 //////////////////////////////////////////////////////////////////////////////
303 // WorkspaceLayoutManager, ShellObserver implementation: 304 // WorkspaceLayoutManager, ShellObserver implementation:
304 305
305 void WorkspaceLayoutManager::OnFullscreenStateChanged(bool is_fullscreen, 306 void WorkspaceLayoutManager::OnFullscreenStateChanged(bool is_fullscreen,
306 WmWindow* root_window) { 307 WmWindow* root_window) {
307 if (root_window != root_window_ || is_fullscreen_ == is_fullscreen) 308 if (root_window != root_window_ || is_fullscreen_ == is_fullscreen)
308 return; 309 return;
309 310
310 is_fullscreen_ = is_fullscreen; 311 is_fullscreen_ = is_fullscreen;
311 if (WmShell::Get()->IsPinned()) { 312 if (Shell::Get()->screen_pinning_controller()->IsPinned()) {
312 // If this is in pinned mode, then this event does not trigger the 313 // If this is in pinned mode, then this event does not trigger the
313 // always-on-top state change, because it is kept disabled regardless of 314 // always-on-top state change, because it is kept disabled regardless of
314 // the fullscreen state change. 315 // the fullscreen state change.
315 return; 316 return;
316 } 317 }
317 318
318 UpdateAlwaysOnTop(is_fullscreen_ ? wm::GetWindowForFullscreenMode(window_) 319 UpdateAlwaysOnTop(is_fullscreen_ ? wm::GetWindowForFullscreenMode(window_)
319 : nullptr); 320 : nullptr);
320 } 321 }
321 322
322 void WorkspaceLayoutManager::OnPinnedStateChanged(WmWindow* pinned_window) { 323 void WorkspaceLayoutManager::OnPinnedStateChanged(WmWindow* pinned_window) {
323 if (!WmShell::Get()->IsPinned() && is_fullscreen_) { 324 const bool is_pinned = Shell::Get()->screen_pinning_controller()->IsPinned();
325 if (!is_pinned && is_fullscreen_) {
324 // On exiting from pinned mode, if the workspace is still in fullscreen 326 // On exiting from pinned mode, if the workspace is still in fullscreen
325 // mode, then this event does not trigger the restoring yet. On exiting 327 // mode, then this event does not trigger the restoring yet. On exiting
326 // from fullscreen, the temporarily disabled always-on-top property will be 328 // from fullscreen, the temporarily disabled always-on-top property will be
327 // restored. 329 // restored.
328 return; 330 return;
329 } 331 }
330 332
331 UpdateAlwaysOnTop(WmShell::Get()->IsPinned() ? pinned_window : nullptr); 333 UpdateAlwaysOnTop(is_pinned ? pinned_window : nullptr);
332 } 334 }
333 335
334 void WorkspaceLayoutManager::OnVirtualKeyboardStateChanged( 336 void WorkspaceLayoutManager::OnVirtualKeyboardStateChanged(
335 bool activated, 337 bool activated,
336 WmWindow* root_window) { 338 WmWindow* root_window) {
337 UpdateKeyboardObserverFromStateChanged(activated, root_window, root_window_, 339 UpdateKeyboardObserverFromStateChanged(activated, root_window, root_window_,
338 &keyboard_observer_); 340 &keyboard_observer_);
339 } 341 }
340 342
341 ////////////////////////////////////////////////////////////////////////////// 343 //////////////////////////////////////////////////////////////////////////////
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 for (auto* window : windows) { 396 for (auto* window : windows) {
395 wm::WindowState* window_state = window->GetWindowState(); 397 wm::WindowState* window_state = window->GetWindowState();
396 if (window_on_top) 398 if (window_on_top)
397 window_state->DisableAlwaysOnTop(window_on_top); 399 window_state->DisableAlwaysOnTop(window_on_top);
398 else 400 else
399 window_state->RestoreAlwaysOnTop(); 401 window_state->RestoreAlwaysOnTop();
400 } 402 }
401 } 403 }
402 404
403 } // namespace ash 405 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/window_cycle_controller.cc ('k') | ash/common/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698