| 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/shelf_layout_manager_observer.h" | 9 #include "ash/shelf/shelf_layout_manager_observer.h" |
| 10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 class ShelfTooltipManagerTest; | 33 class ShelfTooltipManagerTest; |
| 34 class ShelfViewTest; | 34 class ShelfViewTest; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // ShelfTooltipManager manages the tooltip balloon poping up on shelf items. | 37 // ShelfTooltipManager manages the tooltip balloon poping up on shelf items. |
| 38 class ASH_EXPORT ShelfTooltipManager : public ui::EventHandler, | 38 class ASH_EXPORT ShelfTooltipManager : public ui::EventHandler, |
| 39 public ShelfLayoutManagerObserver { | 39 public ShelfLayoutManagerObserver { |
| 40 public: | 40 public: |
| 41 ShelfTooltipManager(ShelfLayoutManager* shelf_layout_manager, | 41 ShelfTooltipManager(ShelfLayoutManager* shelf_layout_manager, |
| 42 ShelfView* shelf_view); | 42 ShelfView* shelf_view); |
| 43 virtual ~ShelfTooltipManager(); | 43 ~ShelfTooltipManager() override; |
| 44 | 44 |
| 45 ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; } | 45 ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; } |
| 46 | 46 |
| 47 // Called when the bubble is closed. | 47 // Called when the bubble is closed. |
| 48 void OnBubbleClosed(views::BubbleDelegateView* view); | 48 void OnBubbleClosed(views::BubbleDelegateView* view); |
| 49 | 49 |
| 50 // Shows the tooltip after a delay. It also has the appearing animation. | 50 // Shows the tooltip after a delay. It also has the appearing animation. |
| 51 void ShowDelayed(views::View* anchor, const base::string16& text); | 51 void ShowDelayed(views::View* anchor, const base::string16& text); |
| 52 | 52 |
| 53 // Shows the tooltip immediately. It omits the appearing animation. | 53 // Shows the tooltip immediately. It omits the appearing animation. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 71 bool IsVisible(); | 71 bool IsVisible(); |
| 72 | 72 |
| 73 // Returns the view to which the tooltip bubble is anchored. May be NULL. | 73 // Returns the view to which the tooltip bubble is anchored. May be NULL. |
| 74 views::View* GetCurrentAnchorView() { return anchor_; } | 74 views::View* GetCurrentAnchorView() { return anchor_; } |
| 75 | 75 |
| 76 // Create an instant timer for test purposes. | 76 // Create an instant timer for test purposes. |
| 77 void CreateZeroDelayTimerForTest(); | 77 void CreateZeroDelayTimerForTest(); |
| 78 | 78 |
| 79 protected: | 79 protected: |
| 80 // ui::EventHandler overrides: | 80 // ui::EventHandler overrides: |
| 81 virtual void OnMouseEvent(ui::MouseEvent* event) override; | 81 void OnMouseEvent(ui::MouseEvent* event) override; |
| 82 virtual void OnTouchEvent(ui::TouchEvent* event) override; | 82 void OnTouchEvent(ui::TouchEvent* event) override; |
| 83 virtual void OnGestureEvent(ui::GestureEvent* event) override; | 83 void OnGestureEvent(ui::GestureEvent* event) override; |
| 84 virtual void OnCancelMode(ui::CancelModeEvent* event) override; | 84 void OnCancelMode(ui::CancelModeEvent* event) override; |
| 85 | 85 |
| 86 // ShelfLayoutManagerObserver overrides: | 86 // ShelfLayoutManagerObserver overrides: |
| 87 virtual void WillDeleteShelf() override; | 87 void WillDeleteShelf() override; |
| 88 virtual void WillChangeVisibilityState( | 88 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; |
| 89 ShelfVisibilityState new_state) override; | 89 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; |
| 90 virtual void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; | |
| 91 | 90 |
| 92 private: | 91 private: |
| 93 class ShelfTooltipBubble; | 92 class ShelfTooltipBubble; |
| 94 friend class test::ShelfViewTest; | 93 friend class test::ShelfViewTest; |
| 95 friend class test::ShelfTooltipManagerTest; | 94 friend class test::ShelfTooltipManagerTest; |
| 96 | 95 |
| 97 void CancelHidingAnimation(); | 96 void CancelHidingAnimation(); |
| 98 void CloseSoon(); | 97 void CloseSoon(); |
| 99 void ShowInternal(); | 98 void ShowInternal(); |
| 100 void CreateBubble(views::View* anchor, const base::string16& text); | 99 void CreateBubble(views::View* anchor, const base::string16& text); |
| 101 void CreateTimer(int delay_in_ms); | 100 void CreateTimer(int delay_in_ms); |
| 102 | 101 |
| 103 ShelfTooltipBubble* view_; | 102 ShelfTooltipBubble* view_; |
| 104 views::Widget* widget_; | 103 views::Widget* widget_; |
| 105 views::View* anchor_; | 104 views::View* anchor_; |
| 106 base::string16 text_; | 105 base::string16 text_; |
| 107 scoped_ptr<base::Timer> timer_; | 106 scoped_ptr<base::Timer> timer_; |
| 108 | 107 |
| 109 ShelfLayoutManager* shelf_layout_manager_; | 108 ShelfLayoutManager* shelf_layout_manager_; |
| 110 ShelfView* shelf_view_; | 109 ShelfView* shelf_view_; |
| 111 | 110 |
| 112 base::WeakPtrFactory<ShelfTooltipManager> weak_factory_; | 111 base::WeakPtrFactory<ShelfTooltipManager> weak_factory_; |
| 113 | 112 |
| 114 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipManager); | 113 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipManager); |
| 115 }; | 114 }; |
| 116 | 115 |
| 117 } // namespace ash | 116 } // namespace ash |
| 118 | 117 |
| 119 #endif // ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ | 118 #endif // ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ |
| OLD | NEW |