| 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" |
| 11 #include "ash/common/shelf/shelf_background_animator_observer.h" | 11 #include "ash/common/shelf/shelf_background_animator_observer.h" |
| 12 #include "ash/common/system/tray/actionable_view.h" | 12 #include "ash/common/system/tray/actionable_view.h" |
| 13 #include "ash/public/cpp/shelf_types.h" | 13 #include "ash/public/cpp/shelf_types.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/gfx/geometry/insets.h" |
| 16 #include "ui/views/bubble/tray_bubble_view.h" | 17 #include "ui/views/bubble/tray_bubble_view.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 class ShelfLayoutManager; | 20 class ShelfLayoutManager; |
| 20 class TrayEventFilter; | 21 class TrayEventFilter; |
| 21 class TrayBackground; | 22 class TrayBackground; |
| 22 class WmShelf; | 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. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void SetSeparatorVisibility(bool is_show); | 133 void SetSeparatorVisibility(bool is_show); |
| 133 | 134 |
| 134 // Gets the anchor for bubbles, which is tray_container(). | 135 // Gets the anchor for bubbles, which is tray_container(). |
| 135 views::View* GetBubbleAnchor() const; | 136 views::View* GetBubbleAnchor() const; |
| 136 | 137 |
| 137 // Gets additional insets for positioning bubbles relative to | 138 // Gets additional insets for positioning bubbles relative to |
| 138 // tray_container(). | 139 // tray_container(). |
| 139 gfx::Insets GetBubbleAnchorInsets() const; | 140 gfx::Insets GetBubbleAnchorInsets() const; |
| 140 | 141 |
| 141 protected: | 142 protected: |
| 143 // Background insets relative to local bounds. |
| 144 virtual gfx::Insets GetBackgroundInsets() const; |
| 145 |
| 142 // ActionableView: | 146 // ActionableView: |
| 143 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; | 147 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override; |
| 144 bool ShouldEnterPushedState(const ui::Event& event) override; | 148 bool ShouldEnterPushedState(const ui::Event& event) override; |
| 145 bool PerformAction(const ui::Event& event) override; | 149 bool PerformAction(const ui::Event& event) override; |
| 146 void HandlePerformActionResult(bool action_performed, | 150 void HandlePerformActionResult(bool action_performed, |
| 147 const ui::Event& event) override; | 151 const ui::Event& event) override; |
| 148 gfx::Rect GetFocusBounds() override; | 152 gfx::Rect GetFocusBounds() override; |
| 149 | 153 |
| 150 private: | 154 private: |
| 151 class TrayWidgetObserver; | 155 class TrayWidgetObserver; |
| 152 | 156 |
| 153 // ui::ImplicitAnimationObserver: | 157 // ui::ImplicitAnimationObserver: |
| 154 void OnImplicitAnimationsCompleted() override; | 158 void OnImplicitAnimationsCompleted() override; |
| 155 bool RequiresNotificationWhenAnimatorDestroyed() const override; | 159 bool RequiresNotificationWhenAnimatorDestroyed() const override; |
| 156 | 160 |
| 157 // Applies transformations to the |layer()| to animate the view when | 161 // Applies transformations to the |layer()| to animate the view when |
| 158 // SetVisible(false) is called. | 162 // SetVisible(false) is called. |
| 159 void HideTransformation(); | 163 void HideTransformation(); |
| 160 | 164 |
| 165 // Helper function that calculates background bounds relative to local bounds |
| 166 // based on the background insets returned from GetBackgroundInsets(). |
| 167 gfx::Rect GetBackgroundBounds() const; |
| 168 |
| 161 // The shelf containing the system tray for this view. | 169 // The shelf containing the system tray for this view. |
| 162 WmShelf* wm_shelf_; | 170 WmShelf* wm_shelf_; |
| 163 | 171 |
| 164 // Convenience pointer to the contents view. | 172 // Convenience pointer to the contents view. |
| 165 TrayContainer* tray_container_; | 173 TrayContainer* tray_container_; |
| 166 | 174 |
| 167 // Shelf alignment. | 175 // Shelf alignment. |
| 168 // TODO(jamescook): Don't cache this, get it from WmShelf. | 176 // TODO(jamescook): Don't cache this, get it from WmShelf. |
| 169 ShelfAlignment shelf_alignment_; | 177 ShelfAlignment shelf_alignment_; |
| 170 | 178 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 181 | 189 |
| 182 std::unique_ptr<TrayWidgetObserver> widget_observer_; | 190 std::unique_ptr<TrayWidgetObserver> widget_observer_; |
| 183 std::unique_ptr<TrayEventFilter> tray_event_filter_; | 191 std::unique_ptr<TrayEventFilter> tray_event_filter_; |
| 184 | 192 |
| 185 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 193 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
| 186 }; | 194 }; |
| 187 | 195 |
| 188 } // namespace ash | 196 } // namespace ash |
| 189 | 197 |
| 190 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 198 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
| OLD | NEW |