| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 5 #ifndef ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| 6 #define ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 6 #define ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/shelf/shelf_background_animator_observer.h" | 11 #include "ash/shelf/shelf_background_animator_observer.h" |
| 12 #include "ash/system/tray/actionable_view.h" | 12 #include "ash/system/tray/actionable_view.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "ui/compositor/layer_animation_observer.h" | 14 #include "ui/compositor/layer_animation_observer.h" |
| 15 #include "ui/gfx/geometry/insets.h" | 15 #include "ui/gfx/geometry/insets.h" |
| 16 #include "ui/views/bubble/tray_bubble_view.h" | 16 #include "ui/views/bubble/tray_bubble_view.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 class Shelf; |
| 19 class TrayBackground; | 20 class TrayBackground; |
| 20 class TrayContainer; | 21 class TrayContainer; |
| 21 class TrayEventFilter; | 22 class TrayEventFilter; |
| 22 class WmShelf; | |
| 23 | 23 |
| 24 // Base class for some children of StatusAreaWidget. This class handles setting | 24 // Base class for some children of StatusAreaWidget. This class handles setting |
| 25 // and animating the background when the Launcher is shown/hidden. It also | 25 // and animating the background when the Launcher is shown/hidden. It also |
| 26 // inherits from ActionableView so that the tray items can override | 26 // inherits from ActionableView so that the tray items can override |
| 27 // PerformAction when clicked on. | 27 // PerformAction when clicked on. |
| 28 class ASH_EXPORT TrayBackgroundView : public ActionableView, | 28 class ASH_EXPORT TrayBackgroundView : public ActionableView, |
| 29 public ui::ImplicitAnimationObserver, | 29 public ui::ImplicitAnimationObserver, |
| 30 public ShelfBackgroundAnimatorObserver { | 30 public ShelfBackgroundAnimatorObserver { |
| 31 public: | 31 public: |
| 32 static const char kViewClassName[]; | 32 static const char kViewClassName[]; |
| 33 | 33 |
| 34 explicit TrayBackgroundView(WmShelf* wm_shelf); | 34 explicit TrayBackgroundView(Shelf* shelf); |
| 35 ~TrayBackgroundView() override; | 35 ~TrayBackgroundView() override; |
| 36 | 36 |
| 37 // Called after the tray has been added to the widget containing it. | 37 // Called after the tray has been added to the widget containing it. |
| 38 virtual void Initialize(); | 38 virtual void Initialize(); |
| 39 | 39 |
| 40 // Initializes animations for the bubble. | 40 // Initializes animations for the bubble. |
| 41 static void InitializeBubbleAnimations(views::Widget* bubble_widget); | 41 static void InitializeBubbleAnimations(views::Widget* bubble_widget); |
| 42 | 42 |
| 43 // views::View: | 43 // views::View: |
| 44 void SetVisible(bool visible) override; | 44 void SetVisible(bool visible) override; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 74 virtual void ClickedOutsideBubble() = 0; | 74 virtual void ClickedOutsideBubble() = 0; |
| 75 | 75 |
| 76 // Returns the bubble anchor alignment based on |shelf_alignment_|. | 76 // Returns the bubble anchor alignment based on |shelf_alignment_|. |
| 77 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; | 77 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; |
| 78 | 78 |
| 79 void SetIsActive(bool is_active); | 79 void SetIsActive(bool is_active); |
| 80 bool is_active() const { return is_active_; } | 80 bool is_active() const { return is_active_; } |
| 81 | 81 |
| 82 TrayContainer* tray_container() const { return tray_container_; } | 82 TrayContainer* tray_container() const { return tray_container_; } |
| 83 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } | 83 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } |
| 84 WmShelf* shelf() { return wm_shelf_; } | 84 Shelf* shelf() { return shelf_; } |
| 85 | 85 |
| 86 // Updates the arrow visibility based on the launcher visibility. | 86 // Updates the arrow visibility based on the launcher visibility. |
| 87 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); | 87 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); |
| 88 | 88 |
| 89 // ShelfBackgroundAnimatorObserver: | 89 // ShelfBackgroundAnimatorObserver: |
| 90 void UpdateShelfItemBackground(SkColor color) override; | 90 void UpdateShelfItemBackground(SkColor color) override; |
| 91 | 91 |
| 92 // Updates the visibility of this tray's separator. | 92 // Updates the visibility of this tray's separator. |
| 93 void set_separator_visibility(bool visible) { separator_visible_ = visible; } | 93 void set_separator_visibility(bool visible) { separator_visible_ = visible; } |
| 94 | 94 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 120 void HideTransformation(); | 120 void HideTransformation(); |
| 121 | 121 |
| 122 // Helper function that calculates background insets relative to local bounds. | 122 // Helper function that calculates background insets relative to local bounds. |
| 123 gfx::Insets GetBackgroundInsets() const; | 123 gfx::Insets GetBackgroundInsets() const; |
| 124 | 124 |
| 125 // Helper function that calculates background bounds relative to local bounds | 125 // Helper function that calculates background bounds relative to local bounds |
| 126 // based on background insets returned from GetBackgroundInsets(). | 126 // based on background insets returned from GetBackgroundInsets(). |
| 127 gfx::Rect GetBackgroundBounds() const; | 127 gfx::Rect GetBackgroundBounds() const; |
| 128 | 128 |
| 129 // The shelf containing the system tray for this view. | 129 // The shelf containing the system tray for this view. |
| 130 WmShelf* wm_shelf_; | 130 Shelf* shelf_; |
| 131 | 131 |
| 132 // Convenience pointer to the contents view. | 132 // Convenience pointer to the contents view. |
| 133 TrayContainer* tray_container_; | 133 TrayContainer* tray_container_; |
| 134 | 134 |
| 135 // Owned by the view passed to SetContents(). | 135 // Owned by the view passed to SetContents(). |
| 136 TrayBackground* background_; | 136 TrayBackground* background_; |
| 137 | 137 |
| 138 // Determines if the view is active. This changes how the ink drop ripples | 138 // Determines if the view is active. This changes how the ink drop ripples |
| 139 // behave. | 139 // behave. |
| 140 bool is_active_; | 140 bool is_active_; |
| 141 | 141 |
| 142 // Visibility of this tray's separator which is a line of 1x32px and 4px to | 142 // Visibility of this tray's separator which is a line of 1x32px and 4px to |
| 143 // right of tray. | 143 // right of tray. |
| 144 bool separator_visible_; | 144 bool separator_visible_; |
| 145 | 145 |
| 146 std::unique_ptr<TrayWidgetObserver> widget_observer_; | 146 std::unique_ptr<TrayWidgetObserver> widget_observer_; |
| 147 std::unique_ptr<TrayEventFilter> tray_event_filter_; | 147 std::unique_ptr<TrayEventFilter> tray_event_filter_; |
| 148 | 148 |
| 149 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 149 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 } // namespace ash | 152 } // namespace ash |
| 153 | 153 |
| 154 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 154 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| OLD | NEW |