Chromium Code Reviews| Index: ash/system/web_notification/web_notification_tray.cc |
| diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc |
| index ca678b9f02af8488fbe187a4a11685609a497bd9..59c821c0b1f947a5017b9033b278cca60ad4b5eb 100644 |
| --- a/ash/system/web_notification/web_notification_tray.cc |
| +++ b/ash/system/web_notification/web_notification_tray.cc |
| @@ -18,6 +18,7 @@ |
| #include "ash/system/tray/system_tray_delegate.h" |
| #include "ash/system/tray/tray_bubble_wrapper.h" |
| #include "ash/system/tray/tray_constants.h" |
| +#include "ash/system/tray/tray_container.h" |
|
James Cook
2017/04/17 16:54:35
Is this needed?
mohsen
2017/04/19 22:59:07
Yes, this file works with TrayBackgroundView::tray
|
| #include "ash/system/tray/tray_utils.h" |
| #include "ash/system/web_notification/ash_popup_alignment_delegate.h" |
| #include "ash/wm_shell.h" |
| @@ -165,7 +166,7 @@ class WebNotificationItem : public views::View, public gfx::AnimationDelegate { |
| // the icons on the left are shifted with the animation. |
| // Note that TrayItemView does the same thing. |
| gfx::Size size = kTrayItemOuterSize; |
| - if (IsHorizontalLayout()) { |
| + if (tray_->shelf()->IsHorizontalAlignment()) { |
| size.set_width(std::max( |
| 1, gfx::ToRoundedInt(size.width() * animation_->GetCurrentValue()))); |
| } else { |
| @@ -179,15 +180,11 @@ class WebNotificationItem : public views::View, public gfx::AnimationDelegate { |
| return GetPreferredSize().height(); |
| } |
| - bool IsHorizontalLayout() const { |
| - return IsHorizontalAlignment(tray_->shelf_alignment()); |
| - } |
| - |
| private: |
| // gfx::AnimationDelegate: |
| void AnimationProgressed(const gfx::Animation* animation) override { |
| gfx::Transform transform; |
| - if (IsHorizontalLayout()) { |
| + if (tray_->shelf()->IsHorizontalAlignment()) { |
| transform.Translate(0, animation->CurrentValueBetween( |
| static_cast<double>(height()) / 2., 0.)); |
| } else { |
| @@ -274,7 +271,7 @@ class WebNotificationLabel : public WebNotificationItem { |
| WebNotificationTray::WebNotificationTray(WmShelf* shelf, |
| WmWindow* status_area_window, |
| SystemTray* system_tray) |
| - : TrayBackgroundView(shelf, true), |
| + : TrayBackgroundView(shelf), |
| status_area_window_(status_area_window), |
| system_tray_(system_tray), |
| show_message_center_on_unlock_(false), |
| @@ -334,7 +331,7 @@ bool WebNotificationTray::ShowMessageCenterInternal(bool show_settings) { |
| // In the horizontal case, message center starts from the top of the shelf. |
| // In the vertical case, it starts from the bottom of WebNotificationTray. |
| - const int max_height = IsHorizontalAlignment(shelf_alignment()) |
| + const int max_height = shelf()->IsHorizontalAlignment() |
| ? shelf()->GetIdealBounds().y() |
| : GetBoundsInScreen().bottom(); |
| message_center_bubble->SetMaxHeight(max_height); |
| @@ -345,7 +342,7 @@ bool WebNotificationTray::ShowMessageCenterInternal(bool show_settings) { |
| // For vertical shelf alignments, anchor to the WebNotificationTray, but for |
| // horizontal (i.e. bottom) shelves, anchor to the system tray. |
| TrayBackgroundView* anchor_tray = this; |
| - if (IsHorizontalAlignment(shelf_alignment())) { |
| + if (shelf()->IsHorizontalAlignment()) { |
| anchor_tray = WmShelf::ForWindow(status_area_window_) |
| ->GetStatusAreaWidget() |
| ->system_tray(); |
| @@ -420,10 +417,8 @@ void WebNotificationTray::UpdateAfterLoginStatusChange( |
| OnMessageCenterTrayChanged(); |
| } |
| -void WebNotificationTray::SetShelfAlignment(ShelfAlignment alignment) { |
| - if (alignment == shelf_alignment()) |
| - return; |
| - TrayBackgroundView::SetShelfAlignment(alignment); |
| +void WebNotificationTray::UpdateAfterShelfAlignmentChange() { |
| + TrayBackgroundView::UpdateAfterShelfAlignmentChange(); |
| // Destroy any existing bubble so that it will be rebuilt correctly. |
| message_center_tray_->HideMessageCenterBubble(); |
| message_center_tray_->HidePopupBubble(); |