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

Side by Side Diff: ash/screen_util.cc

Issue 1688453002: [exp] Always use the Display bounds. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | 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_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_widget.h" 10 #include "ash/shelf/shelf_widget.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // In unified desktop mode, there is only one shelf in the 1st display. 58 // In unified desktop mode, there is only one shelf in the 1st display.
59 const gfx::Display& first = 59 const gfx::Display& first =
60 display_manager->software_mirroring_display_list()[0]; 60 display_manager->software_mirroring_display_list()[0];
61 float scale = 61 float scale =
62 static_cast<float>(window->GetRootWindow()->bounds().height()) / 62 static_cast<float>(window->GetRootWindow()->bounds().height()) /
63 first.size().height(); 63 first.size().height();
64 gfx::SizeF size(first.size()); 64 gfx::SizeF size(first.size());
65 size.Scale(scale, scale); 65 size.Scale(scale, scale);
66 return gfx::Rect(gfx::ToCeiledSize(size)); 66 return gfx::Rect(gfx::ToCeiledSize(size));
67 } else { 67 } else {
68 return window->GetRootWindow()->bounds(); 68 gfx::Display display =
69 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window);
70 return gfx::Rect(display.size());
69 } 71 }
70 } 72 }
71 73
72 // static 74 // static
73 gfx::Rect ScreenUtil::ConvertRectToScreen(aura::Window* window, 75 gfx::Rect ScreenUtil::ConvertRectToScreen(aura::Window* window,
74 const gfx::Rect& rect) { 76 const gfx::Rect& rect) {
75 gfx::Point point = rect.origin(); 77 gfx::Point point = rect.origin();
76 aura::client::GetScreenPositionClient(window->GetRootWindow())-> 78 aura::client::GetScreenPositionClient(window->GetRootWindow())->
77 ConvertPointToScreen(window, &point); 79 ConvertPointToScreen(window, &point);
78 return gfx::Rect(point, rect.size()); 80 return gfx::Rect(point, rect.size());
(...skipping 12 matching lines...) Expand all
91 const gfx::Display& ScreenUtil::GetSecondaryDisplay() { 93 const gfx::Display& ScreenUtil::GetSecondaryDisplay() {
92 DisplayManager* display_manager = GetDisplayManager(); 94 DisplayManager* display_manager = GetDisplayManager();
93 CHECK_LE(2U, display_manager->GetNumDisplays()); 95 CHECK_LE(2U, display_manager->GetNumDisplays());
94 return display_manager->GetDisplayAt(0).id() == 96 return display_manager->GetDisplayAt(0).id() ==
95 gfx::Screen::GetScreen()->GetPrimaryDisplay().id() 97 gfx::Screen::GetScreen()->GetPrimaryDisplay().id()
96 ? display_manager->GetDisplayAt(1) 98 ? display_manager->GetDisplayAt(1)
97 : display_manager->GetDisplayAt(0); 99 : display_manager->GetDisplayAt(0);
98 } 100 }
99 101
100 } // namespace ash 102 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698