| 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_COMMON_SHELF_OVERFLOW_BUBBLE_H_ | |
| 6 #define ASH_COMMON_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 PointerEvent; | |
| 14 } | |
| 15 | |
| 16 namespace ash { | |
| 17 class OverflowBubbleView; | |
| 18 class OverflowButton; | |
| 19 class ShelfView; | |
| 20 class WmShelf; | |
| 21 | |
| 22 // OverflowBubble shows shelf items that won't fit on the main shelf in a | |
| 23 // separate bubble. | |
| 24 class OverflowBubble : public views::PointerWatcher, | |
| 25 public views::WidgetObserver { | |
| 26 public: | |
| 27 // |wm_shelf| is the shelf that spawns the bubble. | |
| 28 explicit OverflowBubble(WmShelf* wm_shelf); | |
| 29 ~OverflowBubble() override; | |
| 30 | |
| 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 | |
| 33 // only contains the overflow items. | |
| 34 void Show(OverflowButton* overflow_button, ShelfView* shelf_view); | |
| 35 | |
| 36 void Hide(); | |
| 37 | |
| 38 bool IsShowing() const { return !!bubble_; } | |
| 39 ShelfView* shelf_view() { return shelf_view_; } | |
| 40 OverflowBubbleView* bubble_view() { return bubble_; } | |
| 41 | |
| 42 private: | |
| 43 void ProcessPressedEvent(const gfx::Point& event_location_in_screen); | |
| 44 | |
| 45 // views::PointerWatcher: | |
| 46 void OnPointerEventObserved(const ui::PointerEvent& event, | |
| 47 const gfx::Point& location_in_screen, | |
| 48 views::Widget* target) override; | |
| 49 | |
| 50 // Overridden from views::WidgetObserver: | |
| 51 void OnWidgetDestroying(views::Widget* widget) override; | |
| 52 | |
| 53 WmShelf* wm_shelf_; | |
| 54 OverflowBubbleView* bubble_; // Owned by views hierarchy. | |
| 55 OverflowButton* overflow_button_; // Owned by ShelfView. | |
| 56 | |
| 57 // ShelfView containing the overflow items. Owned by |bubble_|. | |
| 58 ShelfView* shelf_view_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(OverflowBubble); | |
| 61 }; | |
| 62 | |
| 63 } // namespace ash | |
| 64 | |
| 65 #endif // ASH_COMMON_SHELF_OVERFLOW_BUBBLE_H_ | |
| OLD | NEW |