| 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_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 6 #define ASH_COMMON_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" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // Called by the bubble wrapper when a click event occurs outside the bubble. | 101 // Called by the bubble wrapper when a click event occurs outside the bubble. |
| 102 // May close the bubble. | 102 // May close the bubble. |
| 103 virtual void ClickedOutsideBubble() = 0; | 103 virtual void ClickedOutsideBubble() = 0; |
| 104 | 104 |
| 105 // Sets |contents| as a child. | 105 // Sets |contents| as a child. |
| 106 void SetContents(views::View* contents); | 106 void SetContents(views::View* contents); |
| 107 | 107 |
| 108 // Creates and sets contents background to |background_|. | 108 // Creates and sets contents background to |background_|. |
| 109 void SetContentsBackground(); | 109 void SetContentsBackground(); |
| 110 | 110 |
| 111 // Returns the anchor rect for the bubble. | |
| 112 gfx::Rect GetBubbleAnchorRect( | |
| 113 views::Widget* anchor_widget, | |
| 114 views::TrayBubbleView::AnchorType anchor_type, | |
| 115 views::TrayBubbleView::AnchorAlignment anchor_alignment) const; | |
| 116 | |
| 117 // Returns the bubble anchor alignment based on |shelf_alignment_|. | 111 // Returns the bubble anchor alignment based on |shelf_alignment_|. |
| 118 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; | 112 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; |
| 119 | 113 |
| 120 // Forces the background to be drawn active if set to true. | 114 // Forces the background to be drawn active if set to true. |
| 121 void SetDrawBackgroundAsActive(bool visible); | 115 void SetDrawBackgroundAsActive(bool visible); |
| 122 | 116 |
| 123 // Returns true when the the background was overridden to be drawn as active. | 117 // Returns true when the the background was overridden to be drawn as active. |
| 124 bool draw_background_as_active() const { return draw_background_as_active_; } | 118 bool draw_background_as_active() const { return draw_background_as_active_; } |
| 125 | 119 |
| 126 TrayContainer* tray_container() const { return tray_container_; } | 120 TrayContainer* tray_container() const { return tray_container_; } |
| 127 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } | 121 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
| 128 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } | 122 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } |
| 129 WmShelf* shelf() { return wm_shelf_; } | 123 WmShelf* shelf() { return wm_shelf_; } |
| 130 | 124 |
| 131 // Updates the arrow visibility based on the launcher visibility. | 125 // Updates the arrow visibility based on the launcher visibility. |
| 132 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); | 126 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); |
| 133 | 127 |
| 134 // ShelfBackgroundAnimatorObserver: | 128 // ShelfBackgroundAnimatorObserver: |
| 135 void UpdateShelfItemBackground(int alpha) override; | 129 void UpdateShelfItemBackground(int alpha) override; |
| 136 | 130 |
| 137 // Updates the visibility of this tray's separator. | 131 // Updates the visibility of this tray's separator. |
| 138 void SetSeparatorVisibility(bool is_show); | 132 void SetSeparatorVisibility(bool is_show); |
| 139 | 133 |
| 134 // Gets the anchor for bubbles, which is tray_container(). |
| 135 views::View* GetBubbleAnchor() const; |
| 136 |
| 137 // Gets additional insets for positioning bubbles relative to |
| 138 // tray_container(). |
| 139 gfx::Insets GetBubbleAnchorInsets() const; |
| 140 |
| 140 private: | 141 private: |
| 141 class TrayWidgetObserver; | 142 class TrayWidgetObserver; |
| 142 | 143 |
| 143 // ui::ImplicitAnimationObserver: | 144 // ui::ImplicitAnimationObserver: |
| 144 void OnImplicitAnimationsCompleted() override; | 145 void OnImplicitAnimationsCompleted() override; |
| 145 bool RequiresNotificationWhenAnimatorDestroyed() const override; | 146 bool RequiresNotificationWhenAnimatorDestroyed() const override; |
| 146 | 147 |
| 147 // Applies transformations to the |layer()| to animate the view when | 148 // Applies transformations to the |layer()| to animate the view when |
| 148 // SetVisible(false) is called. | 149 // SetVisible(false) is called. |
| 149 void HideTransformation(); | 150 void HideTransformation(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 171 | 172 |
| 172 std::unique_ptr<TrayWidgetObserver> widget_observer_; | 173 std::unique_ptr<TrayWidgetObserver> widget_observer_; |
| 173 std::unique_ptr<TrayEventFilter> tray_event_filter_; | 174 std::unique_ptr<TrayEventFilter> tray_event_filter_; |
| 174 | 175 |
| 175 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 176 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
| 176 }; | 177 }; |
| 177 | 178 |
| 178 } // namespace ash | 179 } // namespace ash |
| 179 | 180 |
| 180 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 181 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| OLD | NEW |