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

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

Issue 1998933002: Update shelf spacing in Chrome OS according to the MD specs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 6 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/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 28a3764ba5d703467f2f117c0e850de95759b69d..2619db54a6fac837d47a1a04e2bdd662149fed70 100644
--- a/ash/system/tray/tray_background_view.cc
+++ b/ash/system/tray/tray_background_view.cc
@@ -212,32 +212,21 @@ void TrayBackgroundView::TrayContainer::ViewHierarchyChanged(
PreferredSizeChanged();
}
+// TODO(tdanderson): Adjust TrayContainer borders according to the material
+// design specs. See crbug.com/617295.
void TrayBackgroundView::TrayContainer::UpdateLayout() {
// Adjust the size of status tray dark background by adding additional
// empty border.
- if (IsHorizontalAlignment(alignment_)) {
- SetBorder(views::Border::CreateEmptyBorder(
- kPaddingFromEdgeOfShelf,
- kPaddingFromEdgeOfShelf,
- kPaddingFromEdgeOfShelf,
- kPaddingFromEdgeOfShelf));
-
- views::BoxLayout* layout =
- new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0);
- layout->SetDefaultFlex(1);
- views::View::SetLayoutManager(layout);
- } else {
- SetBorder(views::Border::CreateEmptyBorder(
- kPaddingFromEdgeOfShelf,
- kPaddingFromEdgeOfShelf,
- kPaddingFromEdgeOfShelf,
- kPaddingFromEdgeOfShelf));
-
- views::BoxLayout* layout =
- new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0);
- layout->SetDefaultFlex(1);
- views::View::SetLayoutManager(layout);
- }
+ views::BoxLayout::Orientation orientation =
+ IsHorizontalAlignment(alignment_) ? views::BoxLayout::kHorizontal
+ : views::BoxLayout::kVertical;
+ SetBorder(views::Border::CreateEmptyBorder(
+ kAdjustBackgroundPadding, kAdjustBackgroundPadding,
+ kAdjustBackgroundPadding, kAdjustBackgroundPadding));
+
+ views::BoxLayout* layout = new views::BoxLayout(orientation, 0, 0, 0);
+ layout->SetDefaultFlex(1);
+ views::View::SetLayoutManager(layout);
PreferredSizeChanged();
}
@@ -271,7 +260,6 @@ TrayBackgroundView::~TrayBackgroundView() {
void TrayBackgroundView::Initialize() {
GetWidget()->AddObserver(widget_observer_.get());
- SetTrayBorder();
}
// static
@@ -400,38 +388,9 @@ ShelfLayoutManager* TrayBackgroundView::GetShelfLayoutManager() {
void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) {
shelf_alignment_ = alignment;
- SetTrayBorder();
tray_container_->SetAlignment(alignment);
}
-void TrayBackgroundView::SetTrayBorder() {
- views::View* parent = status_area_widget_->status_area_widget_delegate();
- // Tray views are laid out right-to-left or bottom-to-top
- bool on_edge = (this == parent->child_at(0));
- int left_edge, top_edge, right_edge, bottom_edge;
- if (IsHorizontalAlignment(shelf_alignment())) {
- top_edge = ShelfLayoutManager::kShelfItemInset;
- left_edge = 0;
- bottom_edge = kShelfSize -
- ShelfLayoutManager::kShelfItemInset - kShelfItemHeight;
- right_edge = on_edge ? kPaddingFromEdgeOfShelf : 0;
- } else if (shelf_alignment() == SHELF_ALIGNMENT_LEFT) {
- top_edge = 0;
- left_edge = kShelfSize -
- ShelfLayoutManager::kShelfItemInset - kShelfItemHeight;
- bottom_edge = on_edge ? kPaddingFromEdgeOfShelf : 0;
- right_edge = ShelfLayoutManager::kShelfItemInset;
- } else { // SHELF_ALIGNMENT_RIGHT
- top_edge = 0;
- left_edge = ShelfLayoutManager::kShelfItemInset;
- bottom_edge = on_edge ? kPaddingFromEdgeOfShelf : 0;
- right_edge = kShelfSize -
- ShelfLayoutManager::kShelfItemInset - kShelfItemHeight;
- }
- SetBorder(views::Border::CreateEmptyBorder(
- top_edge, left_edge, bottom_edge, right_edge));
-}
-
void TrayBackgroundView::OnImplicitAnimationsCompleted() {
// If there is another animation in the queue, the reverse animation was
// triggered before the completion of animating to invisible. Do not turn off
« no previous file with comments | « ash/system/toast/toast_manager_unittest.cc ('k') | ash/system/web_notification/ash_popup_alignment_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698