| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_SHELF_OVERFLOW_BUBBLE_H_ | |
| 6 #define ASH_SHELF_OVERFLOW_BUBBLE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "ui/views/pointer_watcher.h" | |
| 10 #include "ui/views/widget/widget_observer.h" | |
| 11 | |
| 12 namespace ui { | |
| 13 class LocatedEvent; | |
| 14 } | |
| 15 | |
| 16 namespace views { | |
| 17 class View; | |
| 18 } | |
| 19 | |
| 20 namespace ash { | |
| 21 class OverflowBubbleView; | |
| 22 class ShelfLayoutManager; | |
| 23 class ShelfView; | |
| 24 | |
| 25 // OverflowBubble displays the overflown launcher items in a bubble. | |
| 26 class OverflowBubble : public views::PointerWatcher, | |
| 27 public views::WidgetObserver { | |
| 28 public: | |
| 29 OverflowBubble(); | |
| 30 ~OverflowBubble() override; | |
| 31 | |
| 32 // Shows an bubble pointing to |anchor| with |shelf_view| as its content. | |
| 33 void Show(views::View* anchor, ShelfView* shelf_view); | |
| 34 | |
| 35 void Hide(); | |
| 36 | |
| 37 // This method as name indicates will hide bubble and schedule paint | |
| 38 // for overflow button. | |
| 39 void HideBubbleAndRefreshButton(); | |
| 40 | |
| 41 bool IsShowing() const { return !!bubble_; } | |
| 42 ShelfView* shelf_view() { return shelf_view_; } | |
| 43 OverflowBubbleView* bubble_view() { return bubble_; } | |
| 44 | |
| 45 private: | |
| 46 void ProcessPressedEvent(const gfx::Point& event_location_in_screen); | |
| 47 | |
| 48 // views::PointerWatcher: | |
| 49 void OnMousePressed(const ui::MouseEvent& event, | |
| 50 const gfx::Point& location_in_screen, | |
| 51 views::Widget* target) override; | |
| 52 void OnTouchPressed(const ui::TouchEvent& event, | |
| 53 const gfx::Point& location_in_screen, | |
| 54 views::Widget* target) override; | |
| 55 | |
| 56 // Overridden from views::WidgetObserver: | |
| 57 void OnWidgetDestroying(views::Widget* widget) override; | |
| 58 | |
| 59 OverflowBubbleView* bubble_; // Owned by views hierarchy. | |
| 60 views::View* anchor_; // Owned by ShelfView. | |
| 61 ShelfView* shelf_view_; // Owned by |bubble_|. | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(OverflowBubble); | |
| 64 }; | |
| 65 | |
| 66 } // namespace ash | |
| 67 | |
| 68 #endif // ASH_SHELF_OVERFLOW_BUBBLE_H_ | |
| OLD | NEW |