Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1038)

Side by Side Diff: ash/shelf/overflow_bubble.h

Issue 1934123004: mash: Fix shelf overflow bubble not closing on click outside its bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2openoverflow
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/pointer_watcher_delegate_aura.cc ('k') | ash/shelf/overflow_bubble.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 gfx::Point& event_location_in_screen);
48 47
49 // Overridden from ui::EventHandler: 48 // views::PointerWatcher:
50 void OnMouseEvent(ui::MouseEvent* event) override; 49 void OnMousePressed(const ui::MouseEvent& event,
51 void OnTouchEvent(ui::TouchEvent* event) override; 50 const gfx::Point& location_in_screen) override;
51 void OnTouchPressed(const ui::TouchEvent& event,
52 const gfx::Point& location_in_screen) override;
52 53
53 // Overridden from views::WidgetObserver: 54 // Overridden from views::WidgetObserver:
54 void OnWidgetDestroying(views::Widget* widget) override; 55 void OnWidgetDestroying(views::Widget* widget) override;
55 56
56 OverflowBubbleView* bubble_; // Owned by views hierarchy. 57 OverflowBubbleView* bubble_; // Owned by views hierarchy.
57 views::View* anchor_; // Owned by ShelfView. 58 views::View* anchor_; // Owned by ShelfView.
58 ShelfView* shelf_view_; // Owned by |bubble_|. 59 ShelfView* shelf_view_; // Owned by |bubble_|.
59 60
60 DISALLOW_COPY_AND_ASSIGN(OverflowBubble); 61 DISALLOW_COPY_AND_ASSIGN(OverflowBubble);
61 }; 62 };
62 63
63 } // namespace ash 64 } // namespace ash
64 65
65 #endif // ASH_SHELF_OVERFLOW_BUBBLE_H_ 66 #endif // ASH_SHELF_OVERFLOW_BUBBLE_H_
OLDNEW
« no previous file with comments | « ash/pointer_watcher_delegate_aura.cc ('k') | ash/shelf/overflow_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698