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

Unified Diff: ash/wm/window_animations.cc

Issue 1743493002: Cleanup ash shelf accessor functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert ash/shelf/shelf_widget.cc for browser_tests crash... 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/window_animations.cc
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index 98574487a1115c70be204c042f4222d6a3f83363..3689f3f4be8a8a0d60c5c94bb5244e43f0f49e6d 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -466,12 +466,10 @@ gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) {
// width will be 0 but the position in the launcher and the major dimension
// are still reported correctly and the window can be animated to the launcher
// item's light bar.
- ShelfLayoutManager* layout_manager =
- shelf->shelf_widget()->shelf_layout_manager();
if (item_rect.width() != 0 || item_rect.height() != 0) {
- if (layout_manager->visibility_state() == SHELF_AUTO_HIDE) {
+ if (shelf->shelf_layout_manager()->visibility_state() == SHELF_AUTO_HIDE) {
gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen();
- switch (layout_manager->GetAlignment()) {
+ switch (shelf->alignment()) {
case SHELF_ALIGNMENT_BOTTOM:
item_rect.set_y(shelf_bounds.y());
break;
@@ -495,18 +493,11 @@ gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) {
gfx::Rect work_area =
gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area();
int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x();
- switch (layout_manager->GetAlignment()) {
- case SHELF_ALIGNMENT_BOTTOM:
- return gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0);
- case SHELF_ALIGNMENT_TOP:
- return gfx::Rect(ltr_adjusted_x, work_area.y(), 0, 0);
- case SHELF_ALIGNMENT_LEFT:
- return gfx::Rect(work_area.x(), work_area.y(), 0, 0);
- case SHELF_ALIGNMENT_RIGHT:
- return gfx::Rect(work_area.right(), work_area.y(), 0, 0);
- }
- NOTREACHED();
- return gfx::Rect();
+ return shelf->SelectValueForShelfAlignment(
+ gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0),
+ gfx::Rect(work_area.x(), work_area.y(), 0, 0),
+ gfx::Rect(work_area.right(), work_area.y(), 0, 0),
+ gfx::Rect(ltr_adjusted_x, work_area.y(), 0, 0));
}
} // namespace ash
« no previous file with comments | « ash/wm/panels/panel_layout_manager_unittest.cc ('k') | ash/wm/workspace/workspace_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698