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

Unified Diff: ash/screen_util.cc

Issue 2007003002: mash: Preliminary support for shelf auto-hide (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shutdown
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/mus/shelf_delegate_mus.cc ('k') | ash/shelf/shelf_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/screen_util.cc
diff --git a/ash/screen_util.cc b/ash/screen_util.cc
index 9bbd52bb01f1c57ae52b916810097eee0fa2a51d..b855dae900a66ea726b65e22914d8f5e676767a3 100644
--- a/ash/screen_util.cc
+++ b/ash/screen_util.cc
@@ -53,6 +53,7 @@ gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParent(aura::Window* window) {
.work_area());
}
+// static
gfx::Rect ScreenUtil::GetShelfDisplayBoundsInRoot(aura::Window* window) {
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
if (display_manager->IsInUnifiedMode()) {
@@ -65,19 +66,17 @@ gfx::Rect ScreenUtil::GetShelfDisplayBoundsInRoot(aura::Window* window) {
gfx::SizeF size(first.size());
size.Scale(scale, scale);
return gfx::Rect(gfx::ToCeiledSize(size));
- } else {
- if (window->GetRootWindow()->bounds().IsEmpty()) {
- // TODO(sad): This only happens when running with mustash, since the
- // root-window here refers to the shelf Widget, which has not been
- // sized/positioned yet. Use the bounds of the display in this case.
- // Ideally, we would not run this code at all for mustash.
- NOTIMPLEMENTED();
- display::Display display =
- display::Screen::GetScreen()->GetDisplayNearestWindow(window);
- return gfx::Rect(display.size());
- }
- return window->GetRootWindow()->bounds();
}
+
+ if (Shell::GetInstance()->in_mus()) {
+ // In mus the RootWindow is the widget's root window, so use the display
+ // bounds.
+ display::Display display =
+ display::Screen::GetScreen()->GetDisplayNearestWindow(window);
+ return display.bounds();
+ }
+
+ return window->GetRootWindow()->bounds();
}
// static
« no previous file with comments | « ash/mus/shelf_delegate_mus.cc ('k') | ash/shelf/shelf_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698