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

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

Issue 2860163005: chromeos: gets rid of wm_screen_util (Closed)
Patch Set: include 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
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/wm/workspace/workspace_layout_manager.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/keyboard/keyboard_observer_register.h" 9 #include "ash/keyboard/keyboard_observer_register.h"
10 #include "ash/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
11 #include "ash/root_window_controller.h" 11 #include "ash/root_window_controller.h"
12 #include "ash/screen_util.h"
12 #include "ash/session/session_controller.h" 13 #include "ash/session/session_controller.h"
13 #include "ash/shelf/wm_shelf.h" 14 #include "ash/shelf/wm_shelf.h"
14 #include "ash/shell.h" 15 #include "ash/shell.h"
15 #include "ash/wm/always_on_top_controller.h" 16 #include "ash/wm/always_on_top_controller.h"
16 #include "ash/wm/fullscreen_window_finder.h" 17 #include "ash/wm/fullscreen_window_finder.h"
17 #include "ash/wm/screen_pinning_controller.h" 18 #include "ash/wm/screen_pinning_controller.h"
18 #include "ash/wm/window_positioner.h" 19 #include "ash/wm/window_positioner.h"
19 #include "ash/wm/window_properties.h" 20 #include "ash/wm/window_properties.h"
20 #include "ash/wm/window_state.h" 21 #include "ash/wm/window_state.h"
21 #include "ash/wm/window_state_aura.h" 22 #include "ash/wm/window_state_aura.h"
22 #include "ash/wm/window_util.h" 23 #include "ash/wm/window_util.h"
23 #include "ash/wm/wm_event.h" 24 #include "ash/wm/wm_event.h"
24 #include "ash/wm/wm_screen_util.h"
25 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h" 25 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h"
26 #include "ash/wm_window.h" 26 #include "ash/wm_window.h"
27 #include "base/command_line.h" 27 #include "base/command_line.h"
28 #include "ui/aura/client/aura_constants.h" 28 #include "ui/aura/client/aura_constants.h"
29 #include "ui/base/ui_base_switches.h" 29 #include "ui/base/ui_base_switches.h"
30 #include "ui/compositor/layer.h" 30 #include "ui/compositor/layer.h"
31 #include "ui/display/display.h" 31 #include "ui/display/display.h"
32 #include "ui/display/screen.h" 32 #include "ui/display/screen.h"
33 #include "ui/keyboard/keyboard_controller.h" 33 #include "ui/keyboard/keyboard_controller.h"
34 #include "ui/keyboard/keyboard_controller_observer.h" 34 #include "ui/keyboard/keyboard_controller_observer.h"
35 #include "ui/wm/public/activation_client.h" 35 #include "ui/wm/public/activation_client.h"
36 36
37 namespace ash { 37 namespace ash {
38 38
39 WorkspaceLayoutManager::WorkspaceLayoutManager(WmWindow* window) 39 WorkspaceLayoutManager::WorkspaceLayoutManager(WmWindow* window)
40 : window_(window), 40 : window_(window),
41 root_window_(window->GetRootWindow()), 41 root_window_(window->GetRootWindow()),
42 root_window_controller_(root_window_->GetRootWindowController()), 42 root_window_controller_(root_window_->GetRootWindowController()),
43 work_area_in_parent_(wm::GetDisplayWorkAreaBoundsInParent(window_)), 43 work_area_in_parent_(
44 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_->aura_window())),
44 is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr), 45 is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr),
45 keyboard_observer_(this) { 46 keyboard_observer_(this) {
46 Shell::Get()->AddShellObserver(this); 47 Shell::Get()->AddShellObserver(this);
47 Shell::Get()->activation_client()->AddObserver(this); 48 Shell::Get()->activation_client()->AddObserver(this);
48 root_window_->aura_window()->AddObserver(this); 49 root_window_->aura_window()->AddObserver(this);
49 display::Screen::GetScreen()->AddObserver(this); 50 display::Screen::GetScreen()->AddObserver(this);
50 DCHECK(window->aura_window()->GetProperty(kSnapChildrenToPixelBoundary)); 51 DCHECK(window->aura_window()->GetProperty(kSnapChildrenToPixelBoundary));
51 } 52 }
52 53
53 WorkspaceLayoutManager::~WorkspaceLayoutManager() { 54 WorkspaceLayoutManager::~WorkspaceLayoutManager() {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 284
284 ////////////////////////////////////////////////////////////////////////////// 285 //////////////////////////////////////////////////////////////////////////////
285 // WorkspaceLayoutManager, display::DisplayObserver implementation: 286 // WorkspaceLayoutManager, display::DisplayObserver implementation:
286 287
287 void WorkspaceLayoutManager::OnDisplayMetricsChanged( 288 void WorkspaceLayoutManager::OnDisplayMetricsChanged(
288 const display::Display& display, 289 const display::Display& display,
289 uint32_t changed_metrics) { 290 uint32_t changed_metrics) {
290 if (window_->GetDisplayNearestWindow().id() != display.id()) 291 if (window_->GetDisplayNearestWindow().id() != display.id())
291 return; 292 return;
292 293
293 const gfx::Rect work_area(wm::GetDisplayWorkAreaBoundsInParent(window_)); 294 const gfx::Rect work_area(
295 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_->aura_window()));
294 if (work_area != work_area_in_parent_) { 296 if (work_area != work_area_in_parent_) {
295 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); 297 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
296 AdjustAllWindowsBoundsForWorkAreaChange(&event); 298 AdjustAllWindowsBoundsForWorkAreaChange(&event);
297 } 299 }
298 } 300 }
299 301
300 ////////////////////////////////////////////////////////////////////////////// 302 //////////////////////////////////////////////////////////////////////////////
301 // WorkspaceLayoutManager, ShellObserver implementation: 303 // WorkspaceLayoutManager, ShellObserver implementation:
302 304
303 void WorkspaceLayoutManager::OnFullscreenStateChanged(bool is_fullscreen, 305 void WorkspaceLayoutManager::OnFullscreenStateChanged(bool is_fullscreen,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 340 }
339 341
340 ////////////////////////////////////////////////////////////////////////////// 342 //////////////////////////////////////////////////////////////////////////////
341 // WorkspaceLayoutManager, private: 343 // WorkspaceLayoutManager, private:
342 344
343 void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange( 345 void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange(
344 const wm::WMEvent* event) { 346 const wm::WMEvent* event) {
345 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED || 347 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED ||
346 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); 348 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
347 349
348 work_area_in_parent_ = wm::GetDisplayWorkAreaBoundsInParent(window_); 350 work_area_in_parent_ =
351 ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_->aura_window());
349 352
350 // Don't do any adjustments of the insets while we are in screen locked mode. 353 // Don't do any adjustments of the insets while we are in screen locked mode.
351 // This would happen if the launcher was auto hidden before the login screen 354 // This would happen if the launcher was auto hidden before the login screen
352 // was shown and then gets shown when the login screen gets presented. 355 // was shown and then gets shown when the login screen gets presented.
353 if (event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED && 356 if (event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED &&
354 Shell::Get()->session_controller()->IsScreenLocked()) 357 Shell::Get()->session_controller()->IsScreenLocked())
355 return; 358 return;
356 359
357 // If a user plugs an external display into a laptop running Aura the 360 // If a user plugs an external display into a laptop running Aura the
358 // display size will change. Maximized windows need to resize to match. 361 // display size will change. Maximized windows need to resize to match.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 for (auto* window : windows) { 395 for (auto* window : windows) {
393 wm::WindowState* window_state = window->GetWindowState(); 396 wm::WindowState* window_state = window->GetWindowState();
394 if (window_on_top) 397 if (window_on_top)
395 window_state->DisableAlwaysOnTop(window_on_top); 398 window_state->DisableAlwaysOnTop(window_on_top);
396 else 399 else
397 window_state->RestoreAlwaysOnTop(); 400 window_state->RestoreAlwaysOnTop();
398 } 401 }
399 } 402 }
400 403
401 } // namespace ash 404 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698