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

Side by Side Diff: ash/common/wm/wm_screen_util.cc

Issue 2736573002: chromeos: Move files in //ash/common to //ash, part 2 (Closed)
Patch Set: Created 3 years, 9 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/wm_screen_util.h ('k') | ash/common/wm/wm_snap_to_pixel_layout_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/common/wm/wm_screen_util.h"
6
7 #include "ash/common/wm_shell.h"
8 #include "ash/common/wm_window.h"
9 #include "ash/root_window_controller.h"
10 #include "ui/display/display.h"
11 #include "ui/display/screen.h"
12 #include "ui/gfx/geometry/size_conversions.h"
13
14 namespace ash {
15 namespace wm {
16
17 gfx::Rect GetDisplayWorkAreaBoundsInParent(WmWindow* window) {
18 display::Display display = window->GetDisplayNearestWindow();
19 return window->GetParent()->ConvertRectFromScreen(display.work_area());
20 }
21
22 gfx::Rect GetDisplayBoundsInParent(WmWindow* window) {
23 display::Display display = window->GetDisplayNearestWindow();
24 return window->GetParent()->ConvertRectFromScreen(display.bounds());
25 }
26
27 gfx::Rect GetMaximizedWindowBoundsInParent(WmWindow* window) {
28 if (window->GetRootWindowController()->HasShelf())
29 return GetDisplayWorkAreaBoundsInParent(window);
30
31 return GetDisplayBoundsInParent(window);
32 }
33
34 gfx::Rect GetDisplayBoundsWithShelf(WmWindow* window) {
35 if (WmShell::Get()->IsInUnifiedMode()) {
36 // In unified desktop mode, there is only one shelf in the first display.
37 gfx::SizeF size(WmShell::Get()->GetFirstDisplay().size());
38 float scale = window->GetRootWindow()->GetBounds().height() / size.height();
39 size.Scale(scale, scale);
40 return gfx::Rect(gfx::ToCeiledSize(size));
41 }
42
43 return window->GetRootWindow()->GetBounds();
44 }
45
46 } // namespace wm
47 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/wm_screen_util.h ('k') | ash/common/wm/wm_snap_to_pixel_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698