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_H_ | 5 #ifndef ASH_SHELF_OVERFLOW_BUBBLE_H_ |
6 #define ASH_SHELF_OVERFLOW_BUBBLE_H_ | 6 #define ASH_SHELF_OVERFLOW_BUBBLE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/views/pointer_watcher.h" | 9 #include "ui/views/pointer_watcher.h" |
10 #include "ui/views/widget/widget_observer.h" | 10 #include "ui/views/widget/widget_observer.h" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 class PointerEvent; | 13 class PointerEvent; |
14 } | 14 } |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 class OverflowBubbleView; | 17 class OverflowBubbleView; |
18 class OverflowButton; | 18 class OverflowButton; |
| 19 class Shelf; |
19 class ShelfView; | 20 class ShelfView; |
20 class WmShelf; | |
21 | 21 |
22 // OverflowBubble shows shelf items that won't fit on the main shelf in a | 22 // OverflowBubble shows shelf items that won't fit on the main shelf in a |
23 // separate bubble. | 23 // separate bubble. |
24 class OverflowBubble : public views::PointerWatcher, | 24 class OverflowBubble : public views::PointerWatcher, |
25 public views::WidgetObserver { | 25 public views::WidgetObserver { |
26 public: | 26 public: |
27 // |wm_shelf| is the shelf that spawns the bubble. | 27 // |shelf| is the shelf that spawns the bubble. |
28 explicit OverflowBubble(WmShelf* wm_shelf); | 28 explicit OverflowBubble(Shelf* shelf); |
29 ~OverflowBubble() override; | 29 ~OverflowBubble() override; |
30 | 30 |
31 // Shows an bubble pointing to |overflow_button| with |shelf_view| as its | 31 // Shows an bubble pointing to |overflow_button| with |shelf_view| as its |
32 // content. This |shelf_view| is different than the main shelf's view and | 32 // content. This |shelf_view| is different than the main shelf's view and |
33 // only contains the overflow items. | 33 // only contains the overflow items. |
34 void Show(OverflowButton* overflow_button, ShelfView* shelf_view); | 34 void Show(OverflowButton* overflow_button, ShelfView* shelf_view); |
35 | 35 |
36 void Hide(); | 36 void Hide(); |
37 | 37 |
38 bool IsShowing() const { return !!bubble_; } | 38 bool IsShowing() const { return !!bubble_; } |
39 ShelfView* shelf_view() { return shelf_view_; } | 39 ShelfView* shelf_view() { return shelf_view_; } |
40 OverflowBubbleView* bubble_view() { return bubble_; } | 40 OverflowBubbleView* bubble_view() { return bubble_; } |
41 | 41 |
42 private: | 42 private: |
43 void ProcessPressedEvent(const gfx::Point& event_location_in_screen); | 43 void ProcessPressedEvent(const gfx::Point& event_location_in_screen); |
44 | 44 |
45 // views::PointerWatcher: | 45 // views::PointerWatcher: |
46 void OnPointerEventObserved(const ui::PointerEvent& event, | 46 void OnPointerEventObserved(const ui::PointerEvent& event, |
47 const gfx::Point& location_in_screen, | 47 const gfx::Point& location_in_screen, |
48 views::Widget* target) override; | 48 views::Widget* target) override; |
49 | 49 |
50 // Overridden from views::WidgetObserver: | 50 // Overridden from views::WidgetObserver: |
51 void OnWidgetDestroying(views::Widget* widget) override; | 51 void OnWidgetDestroying(views::Widget* widget) override; |
52 | 52 |
53 WmShelf* wm_shelf_; | 53 Shelf* shelf_; |
54 OverflowBubbleView* bubble_; // Owned by views hierarchy. | 54 OverflowBubbleView* bubble_; // Owned by views hierarchy. |
55 OverflowButton* overflow_button_; // Owned by ShelfView. | 55 OverflowButton* overflow_button_; // Owned by ShelfView. |
56 | 56 |
57 // ShelfView containing the overflow items. Owned by |bubble_|. | 57 // ShelfView containing the overflow items. Owned by |bubble_|. |
58 ShelfView* shelf_view_; | 58 ShelfView* shelf_view_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(OverflowBubble); | 60 DISALLOW_COPY_AND_ASSIGN(OverflowBubble); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace ash | 63 } // namespace ash |
64 | 64 |
65 #endif // ASH_SHELF_OVERFLOW_BUBBLE_H_ | 65 #endif // ASH_SHELF_OVERFLOW_BUBBLE_H_ |
OLD | NEW |