OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SHELF_OVERFLOW_BUBBLE_VIEW_H_ | 5 #ifndef ASH_SHELF_OVERFLOW_BUBBLE_VIEW_H_ |
6 #define ASH_SHELF_OVERFLOW_BUBBLE_VIEW_H_ | 6 #define ASH_SHELF_OVERFLOW_BUBBLE_VIEW_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/shelf/shelf_background_animator.h" |
| 10 #include "ash/shelf/shelf_background_animator_observer.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "ui/views/bubble/bubble_dialog_delegate.h" | 12 #include "ui/views/bubble/bubble_dialog_delegate.h" |
11 | 13 |
12 namespace views { | 14 namespace views { |
13 class View; | 15 class View; |
14 } | 16 } |
15 | 17 |
16 namespace ash { | 18 namespace ash { |
17 class WmShelf; | 19 class WmShelf; |
18 | 20 |
19 namespace test { | 21 namespace test { |
20 class OverflowBubbleViewTestAPI; | 22 class OverflowBubbleViewTestAPI; |
21 } | 23 } |
22 | 24 |
23 // OverflowBubbleView hosts a ShelfView to display overflown items. | 25 // OverflowBubbleView hosts a ShelfView to display overflown items. |
24 // Exports to access this class from OverflowBubbleViewTestAPI. | 26 // Exports to access this class from OverflowBubbleViewTestAPI. |
25 class ASH_EXPORT OverflowBubbleView : public views::BubbleDialogDelegateView { | 27 class ASH_EXPORT OverflowBubbleView : public views::BubbleDialogDelegateView, |
| 28 public ShelfBackgroundAnimatorObserver { |
26 public: | 29 public: |
27 explicit OverflowBubbleView(WmShelf* wm_shelf); | 30 explicit OverflowBubbleView(WmShelf* wm_shelf); |
28 ~OverflowBubbleView() override; | 31 ~OverflowBubbleView() override; |
29 | 32 |
30 // |anchor| is the overflow button on the main shelf. |shelf_view| is the | 33 // |anchor| is the overflow button on the main shelf. |shelf_view| is the |
31 // ShelfView containing the overflow items. | 34 // ShelfView containing the overflow items. |
32 void InitOverflowBubble(views::View* anchor, views::View* shelf_view); | 35 void InitOverflowBubble(views::View* anchor, views::View* shelf_view); |
33 | 36 |
34 // views::BubbleDialogDelegateView overrides: | 37 // views::BubbleDialogDelegateView overrides: |
35 int GetDialogButtons() const override; | 38 int GetDialogButtons() const override; |
36 void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, | 39 void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, |
37 views::Widget* bubble_widget) const override; | 40 views::Widget* bubble_widget) const override; |
38 gfx::Rect GetBubbleBounds() override; | 41 gfx::Rect GetBubbleBounds() override; |
39 | 42 |
40 private: | 43 private: |
41 friend class test::OverflowBubbleViewTestAPI; | 44 friend class test::OverflowBubbleViewTestAPI; |
42 | 45 |
43 void ScrollByXOffset(int x_offset); | 46 void ScrollByXOffset(int x_offset); |
44 void ScrollByYOffset(int y_offset); | 47 void ScrollByYOffset(int y_offset); |
45 | 48 |
46 // views::View overrides: | 49 // views::View overrides: |
47 gfx::Size GetPreferredSize() const override; | 50 gfx::Size GetPreferredSize() const override; |
48 void Layout() override; | 51 void Layout() override; |
49 void ChildPreferredSizeChanged(views::View* child) override; | 52 void ChildPreferredSizeChanged(views::View* child) override; |
50 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; | 53 bool OnMouseWheel(const ui::MouseWheelEvent& event) override; |
51 | 54 |
52 // ui::EventHandler overrides: | 55 // ui::EventHandler overrides: |
53 void OnScrollEvent(ui::ScrollEvent* event) override; | 56 void OnScrollEvent(ui::ScrollEvent* event) override; |
54 | 57 |
| 58 // ShelfBackgroundAnimatorObserver: |
| 59 void UpdateShelfBackground(SkColor color) override; |
| 60 |
55 WmShelf* wm_shelf_; | 61 WmShelf* wm_shelf_; |
56 views::View* shelf_view_; // Owned by views hierarchy. | 62 views::View* shelf_view_; // Owned by views hierarchy. |
57 gfx::Vector2d scroll_offset_; | 63 gfx::Vector2d scroll_offset_; |
58 | 64 |
| 65 ShelfBackgroundAnimator background_animator_; |
| 66 |
59 DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView); | 67 DISALLOW_COPY_AND_ASSIGN(OverflowBubbleView); |
60 }; | 68 }; |
61 | 69 |
62 } // namespace ash | 70 } // namespace ash |
63 | 71 |
64 #endif // ASH_SHELF_OVERFLOW_BUBBLE_VIEW_H_ | 72 #endif // ASH_SHELF_OVERFLOW_BUBBLE_VIEW_H_ |
OLD | NEW |