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/basictypes.h" 9 #include "base/compiler_specific.h" 10 #include "ui/events/event_handler.h" 11 #include "ui/views/widget/widget_observer.h" 12 13 namespace ui { 14 class LocatedEvent; 15 } 16 17 namespace views { 18 class View; 19 } 20 21 namespace ash { 22 23 namespace internal { 24 25 class OverflowBubbleView; 26 class ShelfLayoutManager; 27 class ShelfView; 28 29 // OverflowBubble displays the overflown launcher items in a bubble. 30 class OverflowBubble : public ui::EventHandler, 31 public views::WidgetObserver { 32 public: 33 OverflowBubble(); 34 virtual ~OverflowBubble(); 35 36 // Shows an bubble pointing to |anchor| with |shelf_view| as its content. 37 void Show(views::View* anchor, ShelfView* shelf_view); 38 39 void Hide(); 40 41 // This method as name indicates will hide bubble and schedule paint 42 // for overflow button. 43 void HideBubbleAndRefreshButton(); 44 45 bool IsShowing() const { return !!bubble_; } 46 ShelfView* shelf_view() { return shelf_view_; } 47 OverflowBubbleView* bubble_view() { return bubble_; } 48 49 private: 50 void ProcessPressedEvent(ui::LocatedEvent* event); 51 52 // Overridden from ui::EventHandler: 53 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; 54 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; 55 56 // Overridden from views::WidgetObserver: 57 virtual 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 internal 67 } // namespace ash 68 69 #endif // ASH_SHELF_OVERFLOW_BUBBLE_H_ 70