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

Unified Diff: ash/common/system/status_area_widget_delegate.cc

Issue 2709903004: Consolidate some more ash tray constants. (Closed)
Patch Set: rebase Created 3 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/common/system/status_area_widget_delegate.cc
diff --git a/ash/common/system/status_area_widget_delegate.cc b/ash/common/system/status_area_widget_delegate.cc
index 49866a90a799d3574116a4be09fa874a954ba306..19de40825d42f4c9c26d250b89254c3522dfd8c5 100644
--- a/ash/common/system/status_area_widget_delegate.cc
+++ b/ash/common/system/status_area_widget_delegate.cc
@@ -29,7 +29,9 @@
namespace {
-const int kAnimationDurationMs = 250;
+constexpr int kAnimationDurationMs = 250;
+
+constexpr int kPaddingFromEdgeOfShelf = 3;
class StatusAreaWidgetDelegateAnimationSettings
: public ui::ScopedLayerAnimationSettings {
@@ -180,15 +182,14 @@ void StatusAreaWidgetDelegate::UpdateWidgetSize() {
void StatusAreaWidgetDelegate::SetBorderOnChild(views::View* child,
bool extend_border_to_edge) {
const int shelf_size = GetShelfConstant(SHELF_SIZE);
- const int item_height = GetTrayConstant(TRAY_ITEM_HEIGHT_LEGACY);
+ const int item_height = kTrayItemSize;
int top_edge, left_edge, bottom_edge, right_edge;
// Tray views are laid out right-to-left or bottom-to-top.
if (MaterialDesignController::IsShelfMaterial()) {
const bool horizontal_alignment = IsHorizontalAlignment(alignment_);
const int padding = (shelf_size - item_height) / 2;
- const int extended_padding =
- GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF);
+ const int extended_padding = kPaddingFromEdgeOfShelf;
top_edge = horizontal_alignment ? padding : 0;
left_edge = horizontal_alignment ? 0 : padding;
@@ -204,19 +205,16 @@ void StatusAreaWidgetDelegate::SetBorderOnChild(views::View* child,
top_edge = kShelfItemInset;
left_edge = 0;
bottom_edge = shelf_size - kShelfItemInset - item_height;
- right_edge =
- on_edge ? GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF) : 0;
+ right_edge = on_edge ? kPaddingFromEdgeOfShelf : 0;
} else if (alignment_ == SHELF_ALIGNMENT_LEFT) {
top_edge = 0;
left_edge = shelf_size - kShelfItemInset - item_height;
- bottom_edge =
- on_edge ? GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF) : 0;
+ bottom_edge = on_edge ? kPaddingFromEdgeOfShelf : 0;
right_edge = kShelfItemInset;
} else { // SHELF_ALIGNMENT_RIGHT
top_edge = 0;
left_edge = kShelfItemInset;
- bottom_edge =
- on_edge ? GetTrayConstant(TRAY_PADDING_FROM_EDGE_OF_SHELF) : 0;
+ bottom_edge = on_edge ? kPaddingFromEdgeOfShelf : 0;
right_edge = shelf_size - kShelfItemInset - item_height;
}
}

Powered by Google App Engine
This is Rietveld 408576698