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