Commit c334b9d1 authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

CrOS shelf: some more 'old UI' cleanup

Change-Id: Ie294e13bd2b4eaf14343e328b0d5fb2b22a30251
Bug: 864701
Reviewed-on: https://chromium-review.googlesource.com/c/1278616Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599642}
parent 0f6f1ad0
......@@ -78,7 +78,7 @@ AppListButton::AppListButton(InkDropButtonListener* listener,
set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity);
SetAccessibleName(
l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE));
SetSize(gfx::Size(kShelfControlSizeNewUi, kShelfControlSizeNewUi));
SetSize(gfx::Size(kShelfControlSize, kShelfControlSize));
SetFocusPainter(TrayPopupUtils::CreateFocusPainter());
set_notify_action(Button::NOTIFY_ON_PRESS);
......
......@@ -34,7 +34,7 @@ BackButton::BackButton() : views::ImageButton(nullptr) {
set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity);
SetAccessibleName(l10n_util::GetStringUTF16(IDS_ASH_SHELF_BACK_BUTTON_TITLE));
SetSize(gfx::Size(kShelfControlSizeNewUi, kShelfControlSizeNewUi));
SetSize(gfx::Size(kShelfControlSize, kShelfControlSize));
SetFocusPainter(TrayPopupUtils::CreateFocusPainter());
}
......
......@@ -71,7 +71,7 @@ std::pair<int, int> GetTargetColorAlphaValues(
target_item_color_alpha = SK_AlphaTRANSPARENT;
break;
case SHELF_BACKGROUND_MAXIMIZED:
target_shelf_color_alpha = kShelfTranslucentMaximizedWindowNewUi;
target_shelf_color_alpha = kShelfTranslucentMaximizedWindow;
target_item_color_alpha = SK_AlphaTRANSPARENT;
break;
case SHELF_BACKGROUND_APP_LIST:
......
......@@ -246,8 +246,7 @@ TEST_F(ShelfBackgroundAnimatorTest, MaximizedBackground) {
PaintBackground(SHELF_BACKGROUND_MAXIMIZED);
EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, animator_->target_background_type());
EXPECT_EQ(kShelfTranslucentMaximizedWindowNewUi,
observer_.GetBackgroundAlpha());
EXPECT_EQ(kShelfTranslucentMaximizedWindow, observer_.GetBackgroundAlpha());
EXPECT_EQ(0, observer_.GetItemBackgroundAlpha());
}
......
......@@ -15,15 +15,13 @@ namespace ash {
// Size of the shelf when visible (height when the shelf is horizontal and
// width when the shelf is vertical).
constexpr int kShelfSize = 48;
constexpr int kShelfSizeNewUi = 56;
constexpr int kShelfSize = 56;
// Size of the icons within shelf buttons.
constexpr int kShelfButtonIconSize = 32;
constexpr int kShelfButtonIconSizeNewUi = 44;
constexpr int kShelfButtonIconSize = 44;
// Size for controls like the app list button, back button, etc.
constexpr int kShelfControlSizeNewUi = 40;
constexpr int kShelfControlSize = 40;
ASH_EXPORT constexpr SkColor kShelfControlPermanentHighlightBackground =
SkColorSetA(SK_ColorWHITE, 26); // 10%
......@@ -47,12 +45,10 @@ ASH_EXPORT constexpr int kTimeToSwitchBackgroundMs = 1000;
ASH_EXPORT constexpr SkColor kShelfDefaultBaseColor = SK_ColorBLACK;
// Size allocated for each app button on the shelf.
ASH_EXPORT constexpr int kShelfButtonSize = 48;
ASH_EXPORT constexpr int kShelfButtonSizeNewUi = 56;
ASH_EXPORT constexpr int kShelfButtonSize = 56;
// Size of the space between buttons on the shelf.
ASH_EXPORT constexpr int kShelfButtonSpacing = 16;
ASH_EXPORT constexpr int kShelfButtonSpacingNewUi = 8;
ASH_EXPORT constexpr int kShelfButtonSpacing = 8;
// Highlight color used for shelf button activated states.
// TODO(bruthig|mohsen): Use of this color is temporary. Draw the active state
......@@ -73,7 +69,7 @@ ASH_EXPORT constexpr SkColor kShelfIconColor = SK_ColorWHITE;
// The alpha value for the shelf background.
ASH_EXPORT constexpr int kShelfTranslucentOverAppList = 51; // 20%
ASH_EXPORT constexpr int kShelfTranslucentAlpha = 153; // 60%
ASH_EXPORT constexpr int kShelfTranslucentMaximizedWindowNewUi = 230; // 90%
ASH_EXPORT constexpr int kShelfTranslucentMaximizedWindow = 230; // 90%
// The alpha value used to darken a colorized shelf when the shelf is
// translucent.
......@@ -89,8 +85,7 @@ constexpr int kOverflowButtonSize = 32;
constexpr int kOverflowButtonCornerRadiusOldUi = 2;
// The distance between the edge of the shelf and the status indicators.
constexpr int kStatusIndicatorOffsetFromShelfEdge = 3;
constexpr int kStatusIndicatorOffsetFromShelfEdgeNewUi = 2;
constexpr int kStatusIndicatorOffsetFromShelfEdge = 2;
// The direction of the focus cycling.
enum CycleDirection { CYCLE_FORWARD, CYCLE_BACKWARD };
......@@ -99,19 +94,19 @@ class ShelfConstants {
public:
// Size of the shelf when visible (height when the shelf is horizontal and
// width when the shelf is vertical).
static int shelf_size() { return kShelfSizeNewUi; }
static int shelf_size() { return kShelfSize; }
// Size allocated for each app button on the shelf.
static int button_size() { return kShelfButtonSizeNewUi; }
static int button_size() { return kShelfButtonSize; }
// Size of the space between buttons on the shelf.
static int button_spacing() { return kShelfButtonSpacingNewUi; }
static int button_spacing() { return kShelfButtonSpacing; }
// Size of the icons within shelf buttons.
static int button_icon_size() { return kShelfButtonIconSizeNewUi; }
static int button_icon_size() { return kShelfButtonIconSize; }
// The width and height of the material design overflow button.
static int overflow_button_size() { return kShelfControlSizeNewUi; }
static int overflow_button_size() { return kShelfControlSize; }
// The radius of the rounded corners of the overflow button.
static int overflow_button_corner_radius() {
......@@ -122,11 +117,11 @@ class ShelfConstants {
static int app_list_button_radius() { return control_border_radius(); }
// The radius of shelf control buttons.
static int control_border_radius() { return kShelfControlSizeNewUi / 2; }
static int control_border_radius() { return kShelfControlSize / 2; }
// The distance between the edge of the shelf and the status indicators.
static int status_indicator_offset_from_edge() {
return kStatusIndicatorOffsetFromShelfEdgeNewUi;
return kStatusIndicatorOffsetFromShelfEdge;
}
DISALLOW_IMPLICIT_CONSTRUCTORS(ShelfConstants);
......
......@@ -930,7 +930,7 @@ int ShelfView::GetSeparatorIndex() const {
return -1;
}
int ShelfView::GetDimensionOfCenteredShelfItemsInNewUi() const {
int ShelfView::GetDimensionOfCenteredShelfItems() const {
int size = 0;
int added_items = 0;
for (ShelfItem item : model_->items()) {
......@@ -977,16 +977,16 @@ void ShelfView::LayoutAppListAndBackButtonHighlight() const {
const int button_spacing = ShelfConstants::button_spacing();
// "Secondary" as in "orthogonal to the shelf primary axis".
const int control_secondary_padding =
(ShelfConstants::shelf_size() - kShelfControlSizeNewUi) / 2;
(ShelfConstants::shelf_size() - kShelfControlSize) / 2;
const int back_and_app_list_background_size =
kShelfControlSizeNewUi +
(IsTabletModeEnabled() ? kShelfControlSizeNewUi + button_spacing : 0);
kShelfControlSize +
(IsTabletModeEnabled() ? kShelfControlSize + button_spacing : 0);
back_and_app_list_background_->SetBounds(
shelf_->PrimaryAxisValue(button_spacing, control_secondary_padding),
shelf_->PrimaryAxisValue(control_secondary_padding, button_spacing),
shelf_->PrimaryAxisValue(back_and_app_list_background_size,
kShelfControlSizeNewUi),
shelf_->PrimaryAxisValue(kShelfControlSizeNewUi,
kShelfControlSize),
shelf_->PrimaryAxisValue(kShelfControlSize,
back_and_app_list_background_size));
}
......@@ -1023,7 +1023,7 @@ void ShelfView::CalculateIdealBounds(gfx::Rect* overflow_bounds) const {
// Start centering after we've laid out the app list button.
// Center the shelf items on the whole shelf, including the status
// area widget.
int centered_shelf_items_size = GetDimensionOfCenteredShelfItemsInNewUi();
int centered_shelf_items_size = GetDimensionOfCenteredShelfItems();
StatusAreaWidget* status_widget = shelf_widget_->status_area_widget();
int status_widget_size =
status_widget ? shelf_->PrimaryAxisValue(
......
......@@ -234,7 +234,7 @@ class ASH_EXPORT ShelfView : public views::View,
// Enumerates the shelf items that are centered in the new UI and returns
// the total size they occupy.
int GetDimensionOfCenteredShelfItemsInNewUi() const;
int GetDimensionOfCenteredShelfItems() const;
// Returns the index of the item after which the separator should be shown,
// or -1 if no separator is required.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment