Chromium Code Reviews| Index: ash/common/system/tray/tray_background_view.h |
| diff --git a/ash/common/system/tray/tray_background_view.h b/ash/common/system/tray/tray_background_view.h |
| index 905a083cc86d6abb9895e8576d2b2ef253960cb8..5ff158c136d7f2c47130d06750c7055bc041bb7c 100644 |
| --- a/ash/common/system/tray/tray_background_view.h |
| +++ b/ash/common/system/tray/tray_background_view.h |
| @@ -20,11 +20,12 @@ class ShelfLayoutManager; |
| class TrayEventFilter; |
| class TrayBackground; |
| class WmShelf; |
| +class WmShelfObserver; |
|
James Cook
2016/08/11 20:36:55
not needed
yiyix
2016/08/18 00:43:00
Done.
|
| // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray, |
| // LogoutButtonTray, OverviewButtonTray. |
| // This class handles setting and animating the background when the Launcher |
| -// his shown/hidden. It also inherits from ActionableView so that the tray |
| +// is shown/hidden. It also inherits from ActionableView so that the tray |
| // items can override PerformAction when clicked on. |
| class ASH_EXPORT TrayBackgroundView : public ActionableView, |
| public ui::ImplicitAnimationObserver, |
| @@ -62,7 +63,10 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView, |
| DISALLOW_COPY_AND_ASSIGN(TrayContainer); |
| }; |
| - explicit TrayBackgroundView(WmShelf* wm_shelf); |
| + // Creates a TrayBackgroundView and adds a |tray_background_view_observer| to |
|
James Cook
2016/08/11 20:36:55
Remove this comment.
yiyix
2016/08/18 00:43:00
Done.
|
| + // observe when this tray visibility changes, so that the separator visibility |
| + // can be updated accordingly. |
| + TrayBackgroundView(WmShelf* wm_shelf); |
| ~TrayBackgroundView() override; |
| // Called after the tray has been added to the widget containing it. |
| @@ -77,6 +81,7 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView, |
| void ChildPreferredSizeChanged(views::View* child) override; |
| void GetAccessibleState(ui::AXViewState* state) override; |
| void AboutToRequestFocusFromTabTraversal(bool reverse) override; |
| + void OnPaint(gfx::Canvas* canvas) override; |
| // ActionableView: |
| bool PerformAction(const ui::Event& event) override; |
| @@ -135,13 +140,17 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView, |
| // ShelfBackgroundAnimatorObserver: |
| void UpdateShelfItemBackground(int alpha) override; |
| + // Updates the visibility of this tray's separator. |
| + void SetSeparatorVisibility(bool is_show); |
| + |
| + protected: |
| + // In the given |canvas|, draws a 1px wide and 32dp tall separator line to the |
|
James Cook
2016/08/11 20:36:55
super nit: I would mention the dimensions here, si
yiyix
2016/08/18 00:43:00
Done.
|
| + // right of the TrayBackgroundView. |
| + void DrawSeparator(gfx::Canvas* canvas); |
| + |
| private: |
| class TrayWidgetObserver; |
| - // Called from Initialize after all status area trays have been created. |
| - // Sets the border based on the position of the view. |
| - void SetTrayBorder(); |
| - |
| // ui::ImplicitAnimationObserver: |
| void OnImplicitAnimationsCompleted() override; |
| bool RequiresNotificationWhenAnimatorDestroyed() const override; |
| @@ -150,6 +159,12 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView, |
| // SetVisible(false) is called. |
| void HideTransformation(); |
| + // For Material Design, extra padding is added to tray items so there is |
| + // enough places to draw separator between this tray and the tray to the left |
| + // (if horizontally aligned) or to the bottom (if vertically aligned) if a |
| + // separator is needed. No border is set for non-MD. |
| + void CalculateAndSetTrayContainerBorder(); |
| + |
| // The shelf containing the system tray for this view. |
| WmShelf* wm_shelf_; |
| @@ -167,6 +182,7 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView, |
| // differently if set to true. |
| bool draw_background_as_active_; |
| + bool is_separator_visible_; |
| std::unique_ptr<TrayWidgetObserver> widget_observer_; |
| std::unique_ptr<TrayEventFilter> tray_event_filter_; |