Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / ash / shelf / overflow_bubble.h
blobad682e47683a45e3bd89040edcabbbbf2edba5e9
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.
5 #ifndef ASH_SHELF_OVERFLOW_BUBBLE_H_
6 #define ASH_SHELF_OVERFLOW_BUBBLE_H_
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"
13 namespace ui {
14 class LocatedEvent;
17 namespace views {
18 class View;
21 namespace ash {
22 class OverflowBubbleView;
23 class ShelfLayoutManager;
24 class ShelfView;
26 // OverflowBubble displays the overflown launcher items in a bubble.
27 class OverflowBubble : public ui::EventHandler,
28 public views::WidgetObserver {
29 public:
30 OverflowBubble();
31 ~OverflowBubble() override;
33 // Shows an bubble pointing to |anchor| with |shelf_view| as its content.
34 void Show(views::View* anchor, ShelfView* shelf_view);
36 void Hide();
38 // This method as name indicates will hide bubble and schedule paint
39 // for overflow button.
40 void HideBubbleAndRefreshButton();
42 bool IsShowing() const { return !!bubble_; }
43 ShelfView* shelf_view() { return shelf_view_; }
44 OverflowBubbleView* bubble_view() { return bubble_; }
46 private:
47 void ProcessPressedEvent(ui::LocatedEvent* event);
49 // Overridden from ui::EventHandler:
50 void OnMouseEvent(ui::MouseEvent* event) override;
51 void OnTouchEvent(ui::TouchEvent* event) override;
53 // Overridden from views::WidgetObserver:
54 void OnWidgetDestroying(views::Widget* widget) override;
56 OverflowBubbleView* bubble_; // Owned by views hierarchy.
57 views::View* anchor_; // Owned by ShelfView.
58 ShelfView* shelf_view_; // Owned by |bubble_|.
60 DISALLOW_COPY_AND_ASSIGN(OverflowBubble);
63 } // namespace ash
65 #endif // ASH_SHELF_OVERFLOW_BUBBLE_H_