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

Side by Side Diff: ash/screen_util.cc

Issue 1116313002: Layout login/lock screen, shelf and app list inside the first display in Unified Desktop mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « ash/screen_util.h ('k') | ash/screen_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/display/display_manager.h" 8 #include "ash/display/display_manager.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 Shell::GetScreen()->GetDisplayNearestWindow(window).bounds()); 45 Shell::GetScreen()->GetDisplayNearestWindow(window).bounds());
46 } 46 }
47 47
48 // static 48 // static
49 gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParent(aura::Window* window) { 49 gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParent(aura::Window* window) {
50 return ConvertRectFromScreen( 50 return ConvertRectFromScreen(
51 window->parent(), 51 window->parent(),
52 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area()); 52 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area());
53 } 53 }
54 54
55 gfx::Rect ScreenUtil::GetShelfDisplayBoundsInScreen(aura::Window* root_window) {
56 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
57 if (display_manager->IsInUnifiedMode()) {
58 // In unified desktop mode, there is only one shelf in the 1st display.
59 const gfx::Display& first =
60 display_manager->software_mirroring_display_list()[0];
61 return first.bounds();
62 } else {
63 return gfx::Screen::GetScreenFor(root_window)
64 ->GetDisplayNearestWindow(root_window)
65 .bounds();
66 }
67 }
68
55 // static 69 // static
56 gfx::Rect ScreenUtil::ConvertRectToScreen(aura::Window* window, 70 gfx::Rect ScreenUtil::ConvertRectToScreen(aura::Window* window,
57 const gfx::Rect& rect) { 71 const gfx::Rect& rect) {
58 gfx::Point point = rect.origin(); 72 gfx::Point point = rect.origin();
59 aura::client::GetScreenPositionClient(window->GetRootWindow())-> 73 aura::client::GetScreenPositionClient(window->GetRootWindow())->
60 ConvertPointToScreen(window, &point); 74 ConvertPointToScreen(window, &point);
61 return gfx::Rect(point, rect.size()); 75 return gfx::Rect(point, rect.size());
62 } 76 }
63 77
64 // static 78 // static
65 gfx::Rect ScreenUtil::ConvertRectFromScreen(aura::Window* window, 79 gfx::Rect ScreenUtil::ConvertRectFromScreen(aura::Window* window,
66 const gfx::Rect& rect) { 80 const gfx::Rect& rect) {
67 gfx::Point point = rect.origin(); 81 gfx::Point point = rect.origin();
68 aura::client::GetScreenPositionClient(window->GetRootWindow())-> 82 aura::client::GetScreenPositionClient(window->GetRootWindow())->
69 ConvertPointFromScreen(window, &point); 83 ConvertPointFromScreen(window, &point);
70 return gfx::Rect(point, rect.size()); 84 return gfx::Rect(point, rect.size());
71 } 85 }
72 86
73 // static 87 // static
74 const gfx::Display& ScreenUtil::GetSecondaryDisplay() { 88 const gfx::Display& ScreenUtil::GetSecondaryDisplay() {
75 DisplayManager* display_manager = GetDisplayManager(); 89 DisplayManager* display_manager = GetDisplayManager();
76 CHECK_LE(2U, display_manager->GetNumDisplays()); 90 CHECK_LE(2U, display_manager->GetNumDisplays());
77 return display_manager->GetDisplayAt(0).id() == 91 return display_manager->GetDisplayAt(0).id() ==
78 Shell::GetScreen()->GetPrimaryDisplay().id() ? 92 Shell::GetScreen()->GetPrimaryDisplay().id() ?
79 display_manager->GetDisplayAt(1) : display_manager->GetDisplayAt(0); 93 display_manager->GetDisplayAt(1) : display_manager->GetDisplayAt(0);
80 } 94 }
81 95
82 // static
83 const gfx::Display& ScreenUtil::GetDisplayForId(int64 display_id) {
84 return GetDisplayManager()->GetDisplayForId(display_id);
85 }
86
87 } // namespace ash 96 } // namespace ash
OLDNEW
« no previous file with comments | « ash/screen_util.h ('k') | ash/screen_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698