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

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

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
11 #include "ash/session/session_state_delegate.h" 11 #include "ash/session/session_state_delegate.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/wm/always_on_top_controller.h" 13 #include "ash/wm/always_on_top_controller.h"
14 #include "ash/wm/aura/wm_window_aura.h" 14 #include "ash/wm/aura/wm_window_aura.h"
15 #include "ash/wm/common/window_state.h" 15 #include "ash/wm/common/window_state.h"
16 #include "ash/wm/common/wm_event.h" 16 #include "ash/wm/common/wm_event.h"
17 #include "ash/wm/common/workspace/workspace_layout_manager_delegate.h" 17 #include "ash/wm/common/workspace/workspace_layout_manager_delegate.h"
18 #include "ash/wm/window_animations.h" 18 #include "ash/wm/window_animations.h"
19 #include "ash/wm/window_positioner.h" 19 #include "ash/wm/window_positioner.h"
20 #include "ash/wm/window_properties.h" 20 #include "ash/wm/window_properties.h"
21 #include "ash/wm/window_state_aura.h" 21 #include "ash/wm/window_state_aura.h"
22 #include "ash/wm/window_util.h" 22 #include "ash/wm/window_util.h"
23 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h" 23 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h"
24 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
25 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
26 #include "ui/aura/window_observer.h" 26 #include "ui/aura/window_observer.h"
27 #include "ui/base/ui_base_types.h" 27 #include "ui/base/ui_base_types.h"
28 #include "ui/compositor/layer.h" 28 #include "ui/compositor/layer.h"
29 #include "ui/display/screen.h"
29 #include "ui/events/event.h" 30 #include "ui/events/event.h"
30 #include "ui/gfx/screen.h"
31 #include "ui/keyboard/keyboard_controller_observer.h" 31 #include "ui/keyboard/keyboard_controller_observer.h"
32 #include "ui/wm/core/window_util.h" 32 #include "ui/wm/core/window_util.h"
33 #include "ui/wm/public/activation_client.h" 33 #include "ui/wm/public/activation_client.h"
34 34
35 using aura::Window; 35 using aura::Window;
36 36
37 namespace ash { 37 namespace ash {
38 38
39 WorkspaceLayoutManager::WorkspaceLayoutManager( 39 WorkspaceLayoutManager::WorkspaceLayoutManager(
40 aura::Window* window, 40 aura::Window* window,
41 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate) 41 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate)
42 : window_(window), 42 : window_(window),
43 root_window_(window->GetRootWindow()), 43 root_window_(window->GetRootWindow()),
44 delegate_(std::move(delegate)), 44 delegate_(std::move(delegate)),
45 work_area_in_parent_(ScreenUtil::ConvertRectFromScreen( 45 work_area_in_parent_(ScreenUtil::ConvertRectFromScreen(
46 window_, 46 window_,
47 gfx::Screen::GetScreen() 47 display::Screen::GetScreen()
48 ->GetDisplayNearestWindow(window_) 48 ->GetDisplayNearestWindow(window_)
49 .work_area())), 49 .work_area())),
50 is_fullscreen_(GetRootWindowController(window->GetRootWindow()) 50 is_fullscreen_(GetRootWindowController(window->GetRootWindow())
51 ->GetWindowForFullscreenMode() != NULL) { 51 ->GetWindowForFullscreenMode() != NULL) {
52 Shell::GetInstance()->activation_client()->AddObserver(this); 52 Shell::GetInstance()->activation_client()->AddObserver(this);
53 Shell::GetInstance()->AddShellObserver(this); 53 Shell::GetInstance()->AddShellObserver(this);
54 root_window_->AddObserver(this); 54 root_window_->AddObserver(this);
55 DCHECK(window->GetProperty(kSnapChildrenToPixelBoundary)); 55 DCHECK(window->GetProperty(kSnapChildrenToPixelBoundary));
56 } 56 }
57 57
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // override user intent. 170 // override user intent.
171 window_state->SetAndClearRestoreBounds(); 171 window_state->SetAndClearRestoreBounds();
172 } 172 }
173 } 173 }
174 174
175 ////////////////////////////////////////////////////////////////////////////// 175 //////////////////////////////////////////////////////////////////////////////
176 // WorkspaceLayoutManager, ash::ShellObserver implementation: 176 // WorkspaceLayoutManager, ash::ShellObserver implementation:
177 177
178 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { 178 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() {
179 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( 179 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen(
180 window_, 180 window_, display::Screen::GetScreen()
181 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_).work_area())); 181 ->GetDisplayNearestWindow(window_)
182 .work_area()));
182 if (work_area != work_area_in_parent_) { 183 if (work_area != work_area_in_parent_) {
183 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); 184 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
184 AdjustAllWindowsBoundsForWorkAreaChange(&event); 185 AdjustAllWindowsBoundsForWorkAreaChange(&event);
185 } 186 }
186 if (backdrop_delegate_) 187 if (backdrop_delegate_)
187 backdrop_delegate_->OnDisplayWorkAreaInsetsChanged(); 188 backdrop_delegate_->OnDisplayWorkAreaInsetsChanged();
188 } 189 }
189 190
190 void WorkspaceLayoutManager::OnFullscreenStateChanged( 191 void WorkspaceLayoutManager::OnFullscreenStateChanged(
191 bool is_fullscreen, 192 bool is_fullscreen,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 311
311 ////////////////////////////////////////////////////////////////////////////// 312 //////////////////////////////////////////////////////////////////////////////
312 // WorkspaceLayoutManager, private: 313 // WorkspaceLayoutManager, private:
313 314
314 void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange( 315 void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange(
315 const wm::WMEvent* event) { 316 const wm::WMEvent* event) {
316 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED || 317 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED ||
317 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); 318 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
318 319
319 work_area_in_parent_ = ScreenUtil::ConvertRectFromScreen( 320 work_area_in_parent_ = ScreenUtil::ConvertRectFromScreen(
320 window_, 321 window_, display::Screen::GetScreen()
321 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_).work_area()); 322 ->GetDisplayNearestWindow(window_)
323 .work_area());
322 324
323 // Don't do any adjustments of the insets while we are in screen locked mode. 325 // Don't do any adjustments of the insets while we are in screen locked mode.
324 // This would happen if the launcher was auto hidden before the login screen 326 // This would happen if the launcher was auto hidden before the login screen
325 // was shown and then gets shown when the login screen gets presented. 327 // was shown and then gets shown when the login screen gets presented.
326 if (event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED && 328 if (event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED &&
327 Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) 329 Shell::GetInstance()->session_state_delegate()->IsScreenLocked())
328 return; 330 return;
329 331
330 // If a user plugs an external display into a laptop running Aura the 332 // If a user plugs an external display into a laptop running Aura the
331 // display size will change. Maximized windows need to resize to match. 333 // display size will change. Maximized windows need to resize to match.
(...skipping 22 matching lines...) Expand all
354 return; 356 return;
355 bool is_fullscreen = GetRootWindowController( 357 bool is_fullscreen = GetRootWindowController(
356 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; 358 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL;
357 if (is_fullscreen != is_fullscreen_) { 359 if (is_fullscreen != is_fullscreen_) {
358 delegate_->OnFullscreenStateChanged(is_fullscreen); 360 delegate_->OnFullscreenStateChanged(is_fullscreen);
359 is_fullscreen_ = is_fullscreen; 361 is_fullscreen_ = is_fullscreen;
360 } 362 }
361 } 363 }
362 364
363 } // namespace ash 365 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_event_handler_unittest.cc ('k') | ash/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698