| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_ | 5 #ifndef ASH_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_ |
| 6 #define ASH_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_ | 6 #define ASH_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/shelf_types.h" | 9 #include "ash/shelf_types.h" |
| 10 #include "ash/wm/session_state_observer.h" | 10 #include "ash/wm/session_state_observer.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace internal { | 34 namespace internal { |
| 35 class LauncherView; | 35 class LauncherView; |
| 36 | 36 |
| 37 // LauncherTooltipManager manages the tooltip balloon poping up on launcher | 37 // LauncherTooltipManager manages the tooltip balloon poping up on launcher |
| 38 // items. | 38 // items. |
| 39 class ASH_EXPORT LauncherTooltipManager : public ui::EventHandler, | 39 class ASH_EXPORT LauncherTooltipManager : public ui::EventHandler, |
| 40 public ShelfLayoutManager::Observer, | 40 public ShelfLayoutManager::Observer, |
| 41 public SessionStateObserver { | 41 public SessionStateObserver { |
| 42 public: | 42 public: |
| 43 LauncherTooltipManager(ShelfAlignment alignment, | 43 LauncherTooltipManager(ShelfLayoutManager* shelf_layout_manager, |
| 44 ShelfLayoutManager* shelf_layout_manager, | |
| 45 LauncherView* launcher_view); | 44 LauncherView* launcher_view); |
| 46 virtual ~LauncherTooltipManager(); | 45 virtual ~LauncherTooltipManager(); |
| 47 | 46 |
| 47 ShelfLayoutManager* shelf_layout_manager() { |
| 48 return shelf_layout_manager_; |
| 49 } |
| 50 |
| 48 // Called when the bubble is closed. | 51 // Called when the bubble is closed. |
| 49 void OnBubbleClosed(views::BubbleDelegateView* view); | 52 void OnBubbleClosed(views::BubbleDelegateView* view); |
| 50 | 53 |
| 51 // Shows the tooltip after a delay. It also has the appearing animation. | 54 // Shows the tooltip after a delay. It also has the appearing animation. |
| 52 void ShowDelayed(views::View* anchor, const string16& text); | 55 void ShowDelayed(views::View* anchor, const string16& text); |
| 53 | 56 |
| 54 // Shows the tooltip immediately. It omits the appearing animation. | 57 // Shows the tooltip immediately. It omits the appearing animation. |
| 55 void ShowImmediately(views::View* anchor, const string16& text); | 58 void ShowImmediately(views::View* anchor, const string16& text); |
| 56 | 59 |
| 57 // Closes the tooltip. | 60 // Closes the tooltip. |
| 58 void Close(); | 61 void Close(); |
| 59 | 62 |
| 60 // Changes the arrow location of the tooltip in case that the launcher | 63 // Changes the arrow location of the tooltip in case that the launcher |
| 61 // arrangement has changed. | 64 // arrangement has changed. |
| 62 void SetArrowLocation(ShelfAlignment alignment); | 65 void UpdateArrowLocation(); |
| 63 | 66 |
| 64 // Resets the timer for the delayed showing |view_|. If the timer isn't | 67 // Resets the timer for the delayed showing |view_|. If the timer isn't |
| 65 // running, it starts a new timer. | 68 // running, it starts a new timer. |
| 66 void ResetTimer(); | 69 void ResetTimer(); |
| 67 | 70 |
| 68 // Stops the timer for the delayed showing |view_|. | 71 // Stops the timer for the delayed showing |view_|. |
| 69 void StopTimer(); | 72 void StopTimer(); |
| 70 | 73 |
| 71 // Returns true if the tooltip is currently visible. | 74 // Returns true if the tooltip is currently visible. |
| 72 bool IsVisible(); | 75 bool IsVisible(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 94 | 97 |
| 95 void CancelHidingAnimation(); | 98 void CancelHidingAnimation(); |
| 96 void CloseSoon(); | 99 void CloseSoon(); |
| 97 void ShowInternal(); | 100 void ShowInternal(); |
| 98 void CreateBubble(views::View* anchor, const string16& text); | 101 void CreateBubble(views::View* anchor, const string16& text); |
| 99 | 102 |
| 100 LauncherTooltipBubble* view_; | 103 LauncherTooltipBubble* view_; |
| 101 views::Widget* widget_; | 104 views::Widget* widget_; |
| 102 views::View* anchor_; | 105 views::View* anchor_; |
| 103 string16 text_; | 106 string16 text_; |
| 104 ShelfAlignment alignment_; | |
| 105 scoped_ptr<base::Timer> timer_; | 107 scoped_ptr<base::Timer> timer_; |
| 106 | 108 |
| 107 ShelfLayoutManager* shelf_layout_manager_; | 109 ShelfLayoutManager* shelf_layout_manager_; |
| 108 LauncherView* launcher_view_; | 110 LauncherView* launcher_view_; |
| 109 | 111 |
| 110 DISALLOW_COPY_AND_ASSIGN(LauncherTooltipManager); | 112 DISALLOW_COPY_AND_ASSIGN(LauncherTooltipManager); |
| 111 }; | 113 }; |
| 112 | 114 |
| 113 } // namespace internal | 115 } // namespace internal |
| 114 } // namespace ash | 116 } // namespace ash |
| 115 | 117 |
| 116 #endif // ASH_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_ | 118 #endif // ASH_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_ |
| OLD | NEW |