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

CrOS shelf: permanent highlight for status tray

See what it looks like in comment #15 of the linked bug.

Bug: 874161
Change-Id: I42a81c93742fb68720e237e34e2b66b68b3e9de5
Reviewed-on: https://chromium-review.googlesource.com/1197730
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587849}
parent 67f243da
......@@ -128,7 +128,10 @@ class ShelfConstants {
}
// The radius of the circular material design app list button.
static int app_list_button_radius() { return overflow_button_size() / 2; }
static int app_list_button_radius() { return control_border_radius(); }
// The radius of shelf control buttons.
static int control_border_radius() { return kShelfControlSizeNewUi / 2; }
// The distance between the edge of the shelf and the status indicators.
static int status_indicator_offset_from_edge() {
......
......@@ -201,6 +201,10 @@ void StatusAreaWidgetDelegate::SetBorderOnChild(views::View* child,
int left_edge = 0;
int bottom_edge = padding;
int right_edge = extend_border_to_edge ? kPaddingFromEdgeOfShelf : 0;
// In the new UI, since all corners are rounded, add some extra space so that
// borders don't overlap.
if (chromeos::switches::ShouldUseShelfNewUi())
left_edge += ShelfConstants::control_border_radius() / 3;
// In UnifiedSystemTray, clock is on the right, so extra padding should be on
// the left.
......
......@@ -68,12 +68,18 @@ void MirrorInsetsIfNecessary(gfx::Insets* insets) {
// mirrored if RTL mode is active.
gfx::Insets GetMirroredBackgroundInsets(bool is_shelf_horizontal) {
gfx::Insets insets;
// "Primary" is the same direction as the shelf, "secondary" is orthogonal.
const int primary_padding =
chromeos::switches::ShouldUseShelfNewUi() ? 0 : ash::kHitRegionPadding;
const int secondary_padding =
chromeos::switches::ShouldUseShelfNewUi() ? -ash::kHitRegionPadding : 0;
if (is_shelf_horizontal) {
insets.Set(0, ash::kHitRegionPadding, 0,
ash::kHitRegionPadding + ash::kSeparatorWidth);
insets.Set(secondary_padding, primary_padding, secondary_padding,
primary_padding + ash::kSeparatorWidth);
} else {
insets.Set(ash::kHitRegionPadding, 0,
ash::kHitRegionPadding + ash::kSeparatorWidth, 0);
insets.Set(primary_padding, secondary_padding,
primary_padding + ash::kSeparatorWidth, secondary_padding);
}
MirrorInsetsIfNecessary(&insets);
return insets;
......@@ -125,12 +131,18 @@ class TrayBackground : public views::Background {
gfx::ScopedCanvas scoped_canvas(canvas);
cc::PaintFlags background_flags;
background_flags.setAntiAlias(true);
background_flags.setColor(color_);
int border_radius = kTrayRoundedBorderRadius;
if (chromeos::switches::ShouldUseShelfNewUi()) {
background_flags.setColor(kShelfControlPermanentHighlightBackground);
border_radius = ShelfConstants::control_border_radius();
} else {
background_flags.setColor(color_);
}
gfx::Rect bounds = tray_background_view_->GetBackgroundBounds();
const float dsf = canvas->UndoDeviceScaleFactor();
canvas->DrawRoundRect(gfx::ScaleToRoundedRect(bounds, dsf),
kTrayRoundedBorderRadius * dsf, background_flags);
border_radius * dsf, background_flags);
}
// Reference to the TrayBackgroundView for which this is a background.
......@@ -541,8 +553,11 @@ gfx::Rect TrayBackgroundView::GetBackgroundBounds() const {
std::unique_ptr<views::InkDropMask> TrayBackgroundView::CreateInkDropMask()
const {
const int border_radius = chromeos::switches::ShouldUseShelfNewUi()
? ShelfConstants::control_border_radius()
: kTrayRoundedBorderRadius;
return std::make_unique<views::RoundRectInkDropMask>(
size(), GetBackgroundInsets(), kTrayRoundedBorderRadius);
size(), GetBackgroundInsets(), border_radius);
}
bool TrayBackgroundView::ShouldEnterPushedState(const ui::Event& event) {
......
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