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

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

Issue 1828133004: Refine ash shelf tooltip closing on non-mash ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid WillDeleteShelf in PrepareForShutdown; use aura::WindowObserver instead. Created 4 years, 8 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 | « no previous file | ash/shelf/shelf_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 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 "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/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "ui/aura/window_observer.h"
14 #include "ui/events/event_handler.h" 15 #include "ui/events/event_handler.h"
15 16
16 namespace views { 17 namespace views {
17 class BubbleDelegateView; 18 class BubbleDelegateView;
18 class View; 19 class View;
19 } 20 }
20 21
21 namespace ash { 22 namespace ash {
22 class ShelfLayoutManager; 23 class ShelfLayoutManager;
23 class ShelfView; 24 class ShelfView;
24 25
25 namespace test { 26 namespace test {
26 class ShelfTooltipManagerTest; 27 class ShelfTooltipManagerTest;
27 class ShelfViewTest; 28 class ShelfViewTest;
28 } 29 }
29 30
30 // ShelfTooltipManager manages the tooltip bubble that appears for shelf items. 31 // ShelfTooltipManager manages the tooltip bubble that appears for shelf items.
31 class ASH_EXPORT ShelfTooltipManager : public ui::EventHandler, 32 class ASH_EXPORT ShelfTooltipManager : public ui::EventHandler,
33 public aura::WindowObserver,
32 public ShelfLayoutManagerObserver { 34 public ShelfLayoutManagerObserver {
33 public: 35 public:
34 explicit ShelfTooltipManager(ShelfView* shelf_view); 36 explicit ShelfTooltipManager(ShelfView* shelf_view);
35 ~ShelfTooltipManager() override; 37 ~ShelfTooltipManager() override;
36 38
37 // Initializes the tooltip manager once the shelf is shown. 39 // Initializes the tooltip manager once the shelf is shown.
38 void Init(); 40 void Init();
39 41
40 // Closes the tooltip. 42 // Closes the tooltip.
41 void Close(); 43 void Close();
42 44
43 // Returns true if the tooltip is currently visible. 45 // Returns true if the tooltip is currently visible.
44 bool IsVisible() const; 46 bool IsVisible() const;
45 47
46 // Returns the view to which the tooltip bubble is anchored. May be null. 48 // Returns the view to which the tooltip bubble is anchored. May be null.
47 views::View* GetCurrentAnchorView() const; 49 views::View* GetCurrentAnchorView() const;
48 50
49 // Show the tooltip bubble for the specified view. 51 // Show the tooltip bubble for the specified view.
50 void ShowTooltip(views::View* view); 52 void ShowTooltip(views::View* view);
51 void ShowTooltipWithDelay(views::View* view); 53 void ShowTooltipWithDelay(views::View* view);
52 54
53 // Set the timer delay in ms for testing. 55 // Set the timer delay in ms for testing.
54 void set_timer_delay_for_test(int timer_delay) { timer_delay_ = timer_delay; } 56 void set_timer_delay_for_test(int timer_delay) { timer_delay_ = timer_delay; }
55 57
56 protected: 58 protected:
57 // ui::EventHandler overrides: 59 // ui::EventHandler overrides:
58 void OnEvent(ui::Event* event) override; 60 void OnEvent(ui::Event* event) override;
59 61
62 // aura::WindowObserver overrides:
63 void OnWindowDestroying(aura::Window* window) override;
64
60 // ShelfLayoutManagerObserver overrides: 65 // ShelfLayoutManagerObserver overrides:
61 void WillDeleteShelf() override; 66 void WillDeleteShelf() override;
62 void WillChangeVisibilityState(ShelfVisibilityState new_state) override; 67 void WillChangeVisibilityState(ShelfVisibilityState new_state) override;
63 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override; 68 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override;
64 69
65 private: 70 private:
66 class ShelfTooltipBubble; 71 class ShelfTooltipBubble;
67 friend class test::ShelfViewTest; 72 friend class test::ShelfViewTest;
68 friend class test::ShelfTooltipManagerTest; 73 friend class test::ShelfTooltipManagerTest;
69 74
70 int timer_delay_; 75 int timer_delay_;
71 base::OneShotTimer timer_; 76 base::OneShotTimer timer_;
72 77
73 ShelfView* shelf_view_; 78 ShelfView* shelf_view_;
79 aura::Window* root_window_;
74 ShelfLayoutManager* shelf_layout_manager_; 80 ShelfLayoutManager* shelf_layout_manager_;
75 views::BubbleDelegateView* bubble_; 81 views::BubbleDelegateView* bubble_;
76 82
77 base::WeakPtrFactory<ShelfTooltipManager> weak_factory_; 83 base::WeakPtrFactory<ShelfTooltipManager> weak_factory_;
78 84
79 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipManager); 85 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipManager);
80 }; 86 };
81 87
82 } // namespace ash 88 } // namespace ash
83 89
84 #endif // ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_ 90 #endif // ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | ash/shelf/shelf_tooltip_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698