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_SHELF_TOOLTIP_MANAGER_H_ | 5 #ifndef ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ |
6 #define ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ | 6 #define ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/shelf/wm_shelf_observer.h" | 9 #include "ash/shelf/shelf_observer.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
13 #include "ui/events/event_handler.h" | 13 #include "ui/events/event_handler.h" |
14 #include "ui/views/pointer_watcher.h" | 14 #include "ui/views/pointer_watcher.h" |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 class BubbleDialogDelegateView; | 17 class BubbleDialogDelegateView; |
18 class View; | 18 class View; |
19 } | 19 } |
20 | 20 |
21 namespace ash { | 21 namespace ash { |
22 class ShelfView; | 22 class ShelfView; |
23 | 23 |
24 namespace test { | 24 namespace test { |
25 class ShelfTooltipManagerTest; | 25 class ShelfTooltipManagerTest; |
26 class ShelfViewTest; | 26 class ShelfViewTest; |
27 } | 27 } |
28 | 28 |
29 // ShelfTooltipManager manages the tooltip bubble that appears for shelf items. | 29 // ShelfTooltipManager manages the tooltip bubble that appears for shelf items. |
30 class ASH_EXPORT ShelfTooltipManager : public ui::EventHandler, | 30 class ASH_EXPORT ShelfTooltipManager : public ui::EventHandler, |
31 public views::PointerWatcher, | 31 public views::PointerWatcher, |
32 public WmShelfObserver { | 32 public ShelfObserver { |
33 public: | 33 public: |
34 explicit ShelfTooltipManager(ShelfView* shelf_view); | 34 explicit ShelfTooltipManager(ShelfView* shelf_view); |
35 ~ShelfTooltipManager() override; | 35 ~ShelfTooltipManager() override; |
36 | 36 |
37 // Initializes the tooltip manager once the shelf is shown. | 37 // Initializes the tooltip manager once the shelf is shown. |
38 void Init(); | 38 void Init(); |
39 | 39 |
40 // Closes the tooltip. | 40 // Closes the tooltip. |
41 void Close(); | 41 void Close(); |
42 | 42 |
(...skipping 12 matching lines...) Expand all Loading... |
55 | 55 |
56 protected: | 56 protected: |
57 // ui::EventHandler overrides: | 57 // ui::EventHandler overrides: |
58 void OnMouseEvent(ui::MouseEvent* event) override; | 58 void OnMouseEvent(ui::MouseEvent* event) override; |
59 | 59 |
60 // views::PointerWatcher overrides: | 60 // views::PointerWatcher overrides: |
61 void OnPointerEventObserved(const ui::PointerEvent& event, | 61 void OnPointerEventObserved(const ui::PointerEvent& event, |
62 const gfx::Point& location_in_screen, | 62 const gfx::Point& location_in_screen, |
63 views::Widget* target) override; | 63 views::Widget* target) override; |
64 | 64 |
65 // WmShelfObserver overrides: | 65 // ShelfObserver overrides: |
66 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; | 66 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; |
67 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; | 67 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; |
68 | 68 |
69 private: | 69 private: |
70 class ShelfTooltipBubble; | 70 class ShelfTooltipBubble; |
71 friend class test::ShelfViewTest; | 71 friend class test::ShelfViewTest; |
72 friend class test::ShelfTooltipManagerTest; | 72 friend class test::ShelfTooltipManagerTest; |
73 | 73 |
74 // A helper function to check for shelf visibility and view validity. | 74 // A helper function to check for shelf visibility and view validity. |
75 bool ShouldShowTooltipForView(views::View* view); | 75 bool ShouldShowTooltipForView(views::View* view); |
76 | 76 |
77 int timer_delay_; | 77 int timer_delay_; |
78 base::OneShotTimer timer_; | 78 base::OneShotTimer timer_; |
79 | 79 |
80 ShelfView* shelf_view_; | 80 ShelfView* shelf_view_; |
81 views::BubbleDialogDelegateView* bubble_; | 81 views::BubbleDialogDelegateView* bubble_; |
82 | 82 |
83 base::WeakPtrFactory<ShelfTooltipManager> weak_factory_; | 83 base::WeakPtrFactory<ShelfTooltipManager> weak_factory_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipManager); | 85 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipManager); |
86 }; | 86 }; |
87 | 87 |
88 } // namespace ash | 88 } // namespace ash |
89 | 89 |
90 #endif // ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ | 90 #endif // ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ |
OLD | NEW |