OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/screen_util.h" | 5 #include "ash/screen_util.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_port.h" | 10 #include "ash/shell_port.h" |
11 #include "ash/wm_window.h" | |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "ui/aura/client/screen_position_client.h" | 13 #include "ui/aura/client/screen_position_client.h" |
13 #include "ui/aura/window_event_dispatcher.h" | 14 #include "ui/aura/window_event_dispatcher.h" |
14 #include "ui/display/display.h" | 15 #include "ui/display/display.h" |
15 #include "ui/display/manager/display_manager.h" | 16 #include "ui/display/manager/display_manager.h" |
16 #include "ui/display/screen.h" | 17 #include "ui/display/screen.h" |
17 #include "ui/gfx/geometry/size_conversions.h" | 18 #include "ui/gfx/geometry/size_conversions.h" |
18 #include "ui/wm/core/coordinate_conversion.h" | 19 #include "ui/wm/core/coordinate_conversion.h" |
19 | 20 |
20 namespace ash { | 21 namespace ash { |
(...skipping 16 matching lines...) Expand all Loading... | |
37 | 38 |
38 // static | 39 // static |
39 gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParent(aura::Window* window) { | 40 gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParent(aura::Window* window) { |
40 gfx::Rect result = | 41 gfx::Rect result = |
41 display::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); | 42 display::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
42 ::wm::ConvertRectFromScreen(window->parent(), &result); | 43 ::wm::ConvertRectFromScreen(window->parent(), &result); |
43 return result; | 44 return result; |
44 } | 45 } |
45 | 46 |
46 // static | 47 // static |
48 gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParentForLockScreen( | |
49 aura::Window* window) { | |
50 Shelf* shelf = Shelf::ForWindow(window); | |
51 if (!shelf) | |
52 return GetDisplayBoundsInParent(window); | |
oshima
2017/05/25 19:49:59
nit: looks like shelf shouldn't be null? If so, pl
tbarzic
2017/05/25 20:32:20
yeah, it seems so.
Done.
| |
53 gfx::Rect bounds = shelf->GetUserWorkAreaBounds(); | |
54 ::wm::ConvertRectFromScreen(window->parent(), &bounds); | |
55 return bounds; | |
56 } | |
57 | |
58 // static | |
47 gfx::Rect ScreenUtil::GetDisplayBoundsWithShelf(aura::Window* window) { | 59 gfx::Rect ScreenUtil::GetDisplayBoundsWithShelf(aura::Window* window) { |
48 if (ShellPort::Get()->IsInUnifiedMode()) { | 60 if (ShellPort::Get()->IsInUnifiedMode()) { |
49 // In unified desktop mode, there is only one shelf in the first display. | 61 // In unified desktop mode, there is only one shelf in the first display. |
50 gfx::SizeF size(ShellPort::Get()->GetFirstDisplay().size()); | 62 gfx::SizeF size(ShellPort::Get()->GetFirstDisplay().size()); |
51 float scale = window->GetRootWindow()->bounds().height() / size.height(); | 63 float scale = window->GetRootWindow()->bounds().height() / size.height(); |
52 size.Scale(scale, scale); | 64 size.Scale(scale, scale); |
53 return gfx::Rect(gfx::ToCeiledSize(size)); | 65 return gfx::Rect(gfx::ToCeiledSize(size)); |
54 } | 66 } |
55 | 67 |
56 return window->GetRootWindow()->bounds(); | 68 return window->GetRootWindow()->bounds(); |
57 } | 69 } |
58 | 70 |
59 } // namespace ash | 71 } // namespace ash |
OLD | NEW |