| 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/common/shelf/shelf_types.h" | 11 #include "ash/common/shelf/shelf_types.h" |
| 12 #include "ash/common/system/tray/actionable_view.h" | 12 #include "ash/common/system/tray/actionable_view.h" |
| 13 #include "ash/common/wm/background_animator.h" | 13 #include "ash/common/wm/background_animator.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "ui/compositor/layer_animation_observer.h" | 15 #include "ui/compositor/layer_animation_observer.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 ShelfLayoutManager; | 19 class ShelfLayoutManager; |
| 20 class StatusAreaWidget; | 20 class StatusAreaWidget; |
| 21 class TrayEventFilter; | 21 class TrayEventFilter; |
| 22 class TrayBackground; | 22 class TrayBackground; |
| 23 class WmShelf; |
| 23 | 24 |
| 24 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray, | 25 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray, |
| 25 // LogoutButtonTray, OverviewButtonTray. | 26 // LogoutButtonTray, OverviewButtonTray. |
| 26 // This class handles setting and animating the background when the Launcher | 27 // This class handles setting and animating the background when the Launcher |
| 27 // his shown/hidden. It also inherits from ActionableView so that the tray | 28 // his shown/hidden. It also inherits from ActionableView so that the tray |
| 28 // items can override PerformAction when clicked on. | 29 // items can override PerformAction when clicked on. |
| 29 class ASH_EXPORT TrayBackgroundView : public ActionableView, | 30 class ASH_EXPORT TrayBackgroundView : public ActionableView, |
| 30 public BackgroundAnimatorDelegate, | 31 public BackgroundAnimatorDelegate, |
| 31 public ui::ImplicitAnimationObserver { | 32 public ui::ImplicitAnimationObserver { |
| 32 public: | 33 public: |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 StatusAreaWidget* status_area_widget() { | 134 StatusAreaWidget* status_area_widget() { |
| 134 return status_area_widget_; | 135 return status_area_widget_; |
| 135 } | 136 } |
| 136 const StatusAreaWidget* status_area_widget() const { | 137 const StatusAreaWidget* status_area_widget() const { |
| 137 return status_area_widget_; | 138 return status_area_widget_; |
| 138 } | 139 } |
| 139 TrayContainer* tray_container() const { return tray_container_; } | 140 TrayContainer* tray_container() const { return tray_container_; } |
| 140 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } | 141 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
| 141 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } | 142 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } |
| 142 | 143 |
| 143 ShelfLayoutManager* GetShelfLayoutManager(); | 144 WmShelf* GetShelf(); |
| 144 | 145 |
| 145 // Updates the arrow visibility based on the launcher visibility. | 146 // Updates the arrow visibility based on the launcher visibility. |
| 146 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); | 147 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); |
| 147 | 148 |
| 148 private: | 149 private: |
| 149 class TrayWidgetObserver; | 150 class TrayWidgetObserver; |
| 150 | 151 |
| 151 // Called from Initialize after all status area trays have been created. | 152 // Called from Initialize after all status area trays have been created. |
| 152 // Sets the border based on the position of the view. | 153 // Sets the border based on the position of the view. |
| 153 void SetTrayBorder(); | 154 void SetTrayBorder(); |
| 154 | 155 |
| 155 // ui::ImplicitAnimationObserver: | 156 // ui::ImplicitAnimationObserver: |
| 156 void OnImplicitAnimationsCompleted() override; | 157 void OnImplicitAnimationsCompleted() override; |
| 157 bool RequiresNotificationWhenAnimatorDestroyed() const override; | 158 bool RequiresNotificationWhenAnimatorDestroyed() const override; |
| 158 | 159 |
| 159 // Applies transformations to the |layer()| to animate the view when | 160 // Applies transformations to the |layer()| to animate the view when |
| 160 // SetVisible(false) is called. | 161 // SetVisible(false) is called. |
| 161 void HideTransformation(); | 162 void HideTransformation(); |
| 162 | 163 |
| 163 // Unowned pointer to parent widget. | 164 // Unowned pointer to parent widget. |
| 164 StatusAreaWidget* status_area_widget_; | 165 StatusAreaWidget* status_area_widget_; |
| 165 | 166 |
| 166 // Convenience pointer to the contents view. | 167 // Convenience pointer to the contents view. |
| 167 TrayContainer* tray_container_; | 168 TrayContainer* tray_container_; |
| 168 | 169 |
| 169 // Shelf alignment. | 170 // Shelf alignment. |
| 171 // TODO(jamescook): Don't cache this, get it from WmShelf. |
| 170 ShelfAlignment shelf_alignment_; | 172 ShelfAlignment shelf_alignment_; |
| 171 | 173 |
| 172 // Owned by the view passed to SetContents(). | 174 // Owned by the view passed to SetContents(). |
| 173 TrayBackground* background_; | 175 TrayBackground* background_; |
| 174 | 176 |
| 175 // This variable stores the activation override which will tint the background | 177 // This variable stores the activation override which will tint the background |
| 176 // differently if set to true. | 178 // differently if set to true. |
| 177 bool draw_background_as_active_; | 179 bool draw_background_as_active_; |
| 178 | 180 |
| 179 std::unique_ptr<TrayWidgetObserver> widget_observer_; | 181 std::unique_ptr<TrayWidgetObserver> widget_observer_; |
| 180 std::unique_ptr<TrayEventFilter> tray_event_filter_; | 182 std::unique_ptr<TrayEventFilter> tray_event_filter_; |
| 181 | 183 |
| 182 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 184 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
| 183 }; | 185 }; |
| 184 | 186 |
| 185 } // namespace ash | 187 } // namespace ash |
| 186 | 188 |
| 187 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 189 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| OLD | NEW |