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

Side by Side Diff: ash/launcher/launcher_tooltip_manager.h

Issue 10701051: Polish launcher tooltip visibility (2nd try). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ash/launcher/launcher.cc ('k') | ash/launcher/launcher_tooltip_manager.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 (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 #pragma once 7 #pragma once
8 8
9 #include "ash/ash_export.h" 9 #include "ash/ash_export.h"
10 #include "ash/wm/shelf_layout_manager.h"
10 #include "ash/wm/shelf_types.h" 11 #include "ash/wm/shelf_types.h"
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/string16.h" 13 #include "base/string16.h"
13 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
14 #include "ui/views/bubble/bubble_border.h" 15 #include "ui/views/bubble/bubble_border.h"
15 #include "ui/views/bubble/bubble_delegate.h" 16 #include "ui/views/bubble/bubble_delegate.h"
16 17
17 namespace base { 18 namespace base {
18 class Timer; 19 class Timer;
19 } 20 }
20 21
21 namespace views { 22 namespace views {
22 class BubbleDelegateView; 23 class BubbleDelegateView;
23 class Label; 24 class Label;
24 } 25 }
25 26
26 namespace ash { 27 namespace ash {
27 namespace test { 28 namespace test {
29 class LauncherTooltipManagerTest;
28 class LauncherViewTest; 30 class LauncherViewTest;
29 } 31 }
30 32
31 namespace internal { 33 namespace internal {
32 34
33 // LauncherTooltipManager manages the tooltip balloon poping up on launcher 35 // LauncherTooltipManager manages the tooltip balloon poping up on launcher
34 // items. 36 // items.
35 class ASH_EXPORT LauncherTooltipManager { 37 class ASH_EXPORT LauncherTooltipManager : public ShelfLayoutManager::Observer {
36 public: 38 public:
37 LauncherTooltipManager(ShelfAlignment alignment); 39 LauncherTooltipManager(ShelfAlignment alignment,
38 ~LauncherTooltipManager(); 40 ShelfLayoutManager* shelf_layout_manager);
41 virtual ~LauncherTooltipManager();
39 42
40 // Called when the bubble is closed. 43 // Called when the bubble is closed.
41 void OnBubbleClosed(views::BubbleDelegateView* view); 44 void OnBubbleClosed(views::BubbleDelegateView* view);
42 45
43 // Shows the tooltip after a delay. It also has the appearing animation. 46 // Shows the tooltip after a delay. It also has the appearing animation.
44 void ShowDelayed(views::View* anchor, const string16& text); 47 void ShowDelayed(views::View* anchor, const string16& text);
45 48
46 // Shows the tooltip immediately. It omits the appearing animation. 49 // Shows the tooltip immediately. It omits the appearing animation.
47 void ShowImmediately(views::View* anchor, const string16& text); 50 void ShowImmediately(views::View* anchor, const string16& text);
48 51
49 // Closes the tooltip. 52 // Closes the tooltip.
50 void Close(); 53 void Close();
51 54
52 // Changes the arrow location of the tooltip in case that the launcher 55 // Changes the arrow location of the tooltip in case that the launcher
53 // arrangement has changed. 56 // arrangement has changed.
54 void SetArrowLocation(ShelfAlignment alignment); 57 void SetArrowLocation(ShelfAlignment alignment);
55 58
56 // Resets the timer for the delayed showing |view_|. If the timer isn't 59 // Resets the timer for the delayed showing |view_|. If the timer isn't
57 // running, it starts a new timer. 60 // running, it starts a new timer.
58 void ResetTimer(); 61 void ResetTimer();
59 62
60 // Stops the timer for the delayed showing |view_|. 63 // Stops the timer for the delayed showing |view_|.
61 void StopTimer(); 64 void StopTimer();
62 65
63 // Returns true if the tooltip is currently visible. 66 // Returns true if the tooltip is currently visible.
64 bool IsVisible(); 67 bool IsVisible();
65 68
69 protected:
70 // ShelfLayoutManager::Observer overrides:
71 virtual void WillDeleteShelf() OVERRIDE;
72 virtual void WillChangeVisibilityState(
73 ShelfLayoutManager::VisibilityState new_state) OVERRIDE;
74 virtual void OnAutoHideStateChanged(
75 ShelfLayoutManager::AutoHideState new_state) OVERRIDE;
76
66 private: 77 private:
67 class LauncherTooltipBubble; 78 class LauncherTooltipBubble;
68 friend class test::LauncherViewTest; 79 friend class test::LauncherViewTest;
80 friend class test::LauncherTooltipManagerTest;
69 81
70 void ShowInternal(); 82 void ShowInternal();
71 void CreateBubble(views::View* anchor, const string16& text); 83 void CreateBubble(views::View* anchor, const string16& text);
72 84
73 LauncherTooltipBubble* view_; 85 LauncherTooltipBubble* view_;
74 views::View* anchor_; 86 views::View* anchor_;
75 string16 text_; 87 string16 text_;
76 ShelfAlignment alignment_; 88 ShelfAlignment alignment_;
77 scoped_ptr<base::Timer> timer_; 89 scoped_ptr<base::Timer> timer_;
78 90
91 ShelfLayoutManager* shelf_layout_manager_;
92
79 DISALLOW_COPY_AND_ASSIGN(LauncherTooltipManager); 93 DISALLOW_COPY_AND_ASSIGN(LauncherTooltipManager);
80 }; 94 };
81 95
82 } // namespace internal 96 } // namespace internal
83 } // namespace ash 97 } // namespace ash
84 98
85 #endif // ASH_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_ 99 #endif // ASH_LAUNCHER_LAUNCHER_TOOLTIP_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/launcher/launcher.cc ('k') | ash/launcher/launcher_tooltip_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698