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 { ...@@ -128,7 +128,10 @@ class ShelfConstants {
} }
// The radius of the circular material design app list button. // 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. // The distance between the edge of the shelf and the status indicators.
static int status_indicator_offset_from_edge() { static int status_indicator_offset_from_edge() {
......
...@@ -201,6 +201,10 @@ void StatusAreaWidgetDelegate::SetBorderOnChild(views::View* child, ...@@ -201,6 +201,10 @@ void StatusAreaWidgetDelegate::SetBorderOnChild(views::View* child,
int left_edge = 0; int left_edge = 0;
int bottom_edge = padding; int bottom_edge = padding;
int right_edge = extend_border_to_edge ? kPaddingFromEdgeOfShelf : 0; 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 // In UnifiedSystemTray, clock is on the right, so extra padding should be on
// the left. // the left.
......
...@@ -68,12 +68,18 @@ void MirrorInsetsIfNecessary(gfx::Insets* insets) { ...@@ -68,12 +68,18 @@ void MirrorInsetsIfNecessary(gfx::Insets* insets) {
// mirrored if RTL mode is active. // mirrored if RTL mode is active.
gfx::Insets GetMirroredBackgroundInsets(bool is_shelf_horizontal) { gfx::Insets GetMirroredBackgroundInsets(bool is_shelf_horizontal) {
gfx::Insets insets; 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) { if (is_shelf_horizontal) {
insets.Set(0, ash::kHitRegionPadding, 0, insets.Set(secondary_padding, primary_padding, secondary_padding,
ash::kHitRegionPadding + ash::kSeparatorWidth); primary_padding + ash::kSeparatorWidth);
} else { } else {
insets.Set(ash::kHitRegionPadding, 0, insets.Set(primary_padding, secondary_padding,
ash::kHitRegionPadding + ash::kSeparatorWidth, 0); primary_padding + ash::kSeparatorWidth, secondary_padding);
} }
MirrorInsetsIfNecessary(&insets); MirrorInsetsIfNecessary(&insets);
return insets; return insets;
...@@ -125,12 +131,18 @@ class TrayBackground : public views::Background { ...@@ -125,12 +131,18 @@ class TrayBackground : public views::Background {
gfx::ScopedCanvas scoped_canvas(canvas); gfx::ScopedCanvas scoped_canvas(canvas);
cc::PaintFlags background_flags; cc::PaintFlags background_flags;
background_flags.setAntiAlias(true); 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(); gfx::Rect bounds = tray_background_view_->GetBackgroundBounds();
const float dsf = canvas->UndoDeviceScaleFactor(); const float dsf = canvas->UndoDeviceScaleFactor();
canvas->DrawRoundRect(gfx::ScaleToRoundedRect(bounds, dsf), 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. // Reference to the TrayBackgroundView for which this is a background.
...@@ -541,8 +553,11 @@ gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { ...@@ -541,8 +553,11 @@ gfx::Rect TrayBackgroundView::GetBackgroundBounds() const {
std::unique_ptr<views::InkDropMask> TrayBackgroundView::CreateInkDropMask() std::unique_ptr<views::InkDropMask> TrayBackgroundView::CreateInkDropMask()
const { const {
const int border_radius = chromeos::switches::ShouldUseShelfNewUi()
? ShelfConstants::control_border_radius()
: kTrayRoundedBorderRadius;
return std::make_unique<views::RoundRectInkDropMask>( return std::make_unique<views::RoundRectInkDropMask>(
size(), GetBackgroundInsets(), kTrayRoundedBorderRadius); size(), GetBackgroundInsets(), border_radius);
} }
bool TrayBackgroundView::ShouldEnterPushedState(const ui::Event& event) { 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