Commit 79ff0353 authored by yoshiki iguchi's avatar yoshiki iguchi Committed by Commit Bot

Make Sidebar 360px width

Previously the width was 362px, which is 360px (notification width) plus 2px (notification border). This CL removes the border and shrinks the width of sidebar by 2px.

Bug: 726250
Change-Id: Iae5a14a9057561223e5e2afe39fee840a3073de1
Reviewed-on: https://chromium-review.googlesource.com/825042
Commit-Queue: Yoshiki Iguchi <yoshiki@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524353}
parent dea1003f
......@@ -195,6 +195,9 @@ MessageCenterView::MessageCenterView(
AddChildView(settings_view_);
AddChildView(no_notifications_view_);
AddChildView(button_bar_);
if (switches::IsSidebarEnabled())
MessageView::SetSidebarEnabled();
}
MessageCenterView::~MessageCenterView() {
......
......@@ -40,15 +40,14 @@ display::Display GetCurrentDisplay(aura::Window* window) {
const SkColor kLightShadingColor = SkColorSetARGB(200, 0, 0, 0);
// TODO(yoshiki): Remove the margins from the sidebar.
constexpr size_t kWidth = message_center::kNotificationWidth + 2;
// The blur radius of the background.
constexpr int kSidebarBackgroundBlurRadius = 30;
gfx::Rect CalculateBounds(const gfx::Rect& display_bounds) {
return gfx::Rect(display_bounds.x() + display_bounds.width() - kWidth,
display_bounds.y(), kWidth, display_bounds.height());
return gfx::Rect(display_bounds.x() + display_bounds.width() -
message_center::kNotificationWidth,
display_bounds.y(), message_center::kNotificationWidth,
display_bounds.height());
}
} // namespace
......
......@@ -32,6 +32,9 @@ const SkColor kBorderColor = SkColorSetARGB(0x1F, 0x0, 0x0, 0x0);
const int kShadowCornerRadius = 0;
const int kShadowElevation = 2;
// The global flag of Sidebar enability.
bool sidebar_enabled = false;
// Creates a text for spoken feedback from the data contained in the
// notification.
base::string16 CreateAccessibleName(
......@@ -65,8 +68,14 @@ bool ShouldRoundMessageViewCorners() {
namespace message_center {
// static
const char MessageView::kViewClassName[] = "MessageView";
// static
void MessageView::SetSidebarEnabled() {
sidebar_enabled = true;
}
MessageView::MessageView(const Notification& notification)
: notification_id_(notification.id()), slide_out_controller_(this, this) {
SetFocusBehavior(FocusBehavior::ALWAYS);
......@@ -99,19 +108,26 @@ void MessageView::UpdateWithNotification(const Notification& notification) {
void MessageView::SetIsNested() {
is_nested_ = true;
if (ShouldRoundMessageViewCorners()) {
SetBorder(views::CreateRoundedRectBorder(
kNotificationBorderThickness, kNotificationCornerRadius, kBorderColor));
if (sidebar_enabled) {
DCHECK(ShouldRoundMessageViewCorners());
SetBorder(views::CreateRoundedRectBorder(0, kNotificationCornerRadius,
kBorderColor));
} else {
const auto& shadow =
gfx::ShadowDetails::Get(kShadowElevation, kShadowCornerRadius);
gfx::Insets ninebox_insets =
gfx::ShadowValue::GetBlurRegion(shadow.values) +
gfx::Insets(kShadowCornerRadius);
SetBorder(views::CreateBorderPainter(
std::unique_ptr<views::Painter>(views::Painter::CreateImagePainter(
shadow.ninebox_image, ninebox_insets)),
-gfx::ShadowValue::GetMargin(shadow.values)));
if (ShouldRoundMessageViewCorners()) {
SetBorder(views::CreateRoundedRectBorder(kNotificationBorderThickness,
kNotificationCornerRadius,
kBorderColor));
} else {
const auto& shadow =
gfx::ShadowDetails::Get(kShadowElevation, kShadowCornerRadius);
gfx::Insets ninebox_insets =
gfx::ShadowValue::GetBlurRegion(shadow.values) +
gfx::Insets(kShadowCornerRadius);
SetBorder(views::CreateBorderPainter(
std::unique_ptr<views::Painter>(views::Painter::CreateImagePainter(
shadow.ninebox_image, ninebox_insets)),
-gfx::ShadowValue::GetMargin(shadow.values)));
}
}
}
......
......@@ -38,6 +38,13 @@ class MESSAGE_CENTER_EXPORT MessageView
public:
static const char kViewClassName[];
// Notify this notification view is in the sidebar. This is necessary until
// removing the experimental flag for Sidebar, since the flag exists in Ash,
// so we don't refer the flag directly. Some layout and behavior may change by
// this flag.
// TODO(yoshiki, tetsui): Remove this after removing the flag for Sidebar.
static void SetSidebarEnabled();
explicit MessageView(const Notification& notification);
~MessageView() override;
......
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