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

Unified Diff: ash/system/tray/tray_background_view.cc

Issue 10830190: Fix status area tray spacing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 4 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/system/tray/tray_background_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/tray_background_view.cc
diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc
index 2d6298277c54b405d3f950b0e4fa61eca5496ec2..824a57ce40a7e9e753c2469419d49265863b023f 100644
--- a/ash/system/tray/tray_background_view.cc
+++ b/ash/system/tray/tray_background_view.cc
@@ -7,6 +7,8 @@
#include "ash/launcher/background_animator.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
+#include "ash/system/status_area_widget.h"
+#include "ash/system/status_area_widget_delegate.h"
#include "ash/system/tray/tray_constants.h"
#include "ui/aura/window.h"
#include "ui/gfx/canvas.h"
@@ -137,8 +139,6 @@ TrayBackgroundView::TrayBackgroundView(
hover_background_animator_.SetPaintsBackground(false,
internal::BackgroundAnimator::CHANGE_IMMEDIATE);
- SetBorder();
-
tray_container_ = new TrayContainer(shelf_alignment_);
SetContents(tray_container_);
}
@@ -193,20 +193,24 @@ void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) {
}
void TrayBackgroundView::SetBorder() {
+ views::View* parent = status_area_widget_->status_area_widget_delegate();
+ int child_count = parent->child_count();
+ DCHECK(child_count > 0);
+ int on_edge = (this == parent->child_at(child_count-1));
// Change the border padding for different shelf alignment.
if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) {
- set_border(views::Border::CreateEmptyBorder(0, 0,
- kPaddingFromBottomOfScreenBottomAlignment,
- kPaddingFromRightEdgeOfScreenBottomAlignment));
+ set_border(views::Border::CreateEmptyBorder(
+ 0, 0, kPaddingFromBottomOfScreenBottomAlignment,
+ on_edge ? kPaddingFromRightEdgeOfScreenBottomAlignment : 0));
} else if (shelf_alignment() == SHELF_ALIGNMENT_LEFT) {
- set_border(views::Border::CreateEmptyBorder(0,
- kPaddingFromOuterEdgeOfLauncherVerticalAlignment,
- kPaddingFromBottomOfScreenVerticalAlignment,
+ set_border(views::Border::CreateEmptyBorder(
+ 0, kPaddingFromOuterEdgeOfLauncherVerticalAlignment,
+ on_edge ? kPaddingFromBottomOfScreenVerticalAlignment : 0,
kPaddingFromInnerEdgeOfLauncherVerticalAlignment));
} else {
- set_border(views::Border::CreateEmptyBorder(0,
- kPaddingFromInnerEdgeOfLauncherVerticalAlignment,
- kPaddingFromBottomOfScreenVerticalAlignment,
+ set_border(views::Border::CreateEmptyBorder(
+ 0, kPaddingFromInnerEdgeOfLauncherVerticalAlignment,
+ on_edge ? kPaddingFromBottomOfScreenVerticalAlignment : 0,
kPaddingFromOuterEdgeOfLauncherVerticalAlignment));
}
}
« no previous file with comments | « ash/system/tray/tray_background_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698