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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/base/events/event_handler.h" |
10 #include "ui/views/widget/widget_observer.h" | 11 #include "ui/views/widget/widget_observer.h" |
11 | 12 |
12 namespace views { | 13 namespace views { |
13 class View; | 14 class View; |
14 } | 15 } |
15 | 16 |
16 namespace ash { | 17 namespace ash { |
17 | 18 |
18 class LauncherDelegate; | 19 class LauncherDelegate; |
19 class LauncherModel; | 20 class LauncherModel; |
20 | 21 |
21 namespace internal { | 22 namespace internal { |
22 | 23 |
23 class LauncherView; | 24 class LauncherView; |
24 | 25 |
25 // OverflowBubble displays the overflown launcher items in a bubble. | 26 // OverflowBubble displays the overflown launcher items in a bubble. |
26 class OverflowBubble : public views::WidgetObserver { | 27 class OverflowBubble : public ui::EventHandler, |
| 28 public views::WidgetObserver { |
27 public: | 29 public: |
28 OverflowBubble(); | 30 OverflowBubble(); |
29 virtual ~OverflowBubble(); | 31 virtual ~OverflowBubble(); |
30 | 32 |
31 // Shows an bubble pointing to |anchor| with |launcher_view| as its content. | 33 // Shows an bubble pointing to |anchor| with |launcher_view| as its content. |
32 void Show(views::View* anchor, LauncherView* launcher_view); | 34 void Show(views::View* anchor, LauncherView* launcher_view); |
33 | 35 |
34 void Hide(); | 36 void Hide(); |
35 | 37 |
36 bool IsShowing() const { return !!bubble_; } | 38 bool IsShowing() const { return !!bubble_; } |
37 LauncherView* launcher_view() { return launcher_view_; } | 39 LauncherView* launcher_view() { return launcher_view_; } |
38 | 40 |
39 private: | 41 private: |
| 42 // Overridden from ui::EventHandler: |
| 43 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
| 44 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; |
| 45 |
40 // Overridden from views::WidgetObserver: | 46 // Overridden from views::WidgetObserver: |
41 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | 47 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; |
42 | 48 |
43 views::View* bubble_; // Owned by views hierarchy. | 49 views::View* bubble_; // Owned by views hierarchy. |
| 50 views::View* anchor_; // Owned by LauncherView. |
44 LauncherView* launcher_view_; // Owned by |bubble_|. | 51 LauncherView* launcher_view_; // Owned by |bubble_|. |
45 | 52 |
46 DISALLOW_COPY_AND_ASSIGN(OverflowBubble); | 53 DISALLOW_COPY_AND_ASSIGN(OverflowBubble); |
47 }; | 54 }; |
48 | 55 |
49 } // namespace internal | 56 } // namespace internal |
50 } // namespace ash | 57 } // namespace ash |
51 | 58 |
52 #endif // ASH_SHELF_OVERFLOW_BUBBLE_H_ | 59 #endif // ASH_SHELF_OVERFLOW_BUBBLE_H_ |
OLD | NEW |