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

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

Issue 2176813002: mash: Migrate ShelfTooltipManager to wm common types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment. Created 4 years, 4 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 | « ash/mus/bridge/wm_window_mus.cc ('k') | 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_
6 #define ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_
7
8 #include "ash/ash_export.h"
9 #include "ash/shelf/shelf_layout_manager_observer.h"
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/timer/timer.h"
13 #include "ui/aura/window_observer.h"
14 #include "ui/events/event_handler.h"
15 #include "ui/views/pointer_watcher.h"
16
17 namespace views {
18 class BubbleDialogDelegateView;
19 class View;
20 }
21
22 namespace ash {
23 class ShelfLayoutManager;
24 class ShelfView;
25
26 namespace test {
27 class ShelfTooltipManagerTest;
28 class ShelfViewTest;
29 }
30
31 // ShelfTooltipManager manages the tooltip bubble that appears for shelf items.
32 class ASH_EXPORT ShelfTooltipManager : public ui::EventHandler,
33 public aura::WindowObserver,
34 public views::PointerWatcher,
35 public ShelfLayoutManagerObserver {
36 public:
37 explicit ShelfTooltipManager(ShelfView* shelf_view);
38 ~ShelfTooltipManager() override;
39
40 // Initializes the tooltip manager once the shelf is shown.
41 void Init();
42
43 // Closes the tooltip.
44 void Close();
45
46 // Returns true if the tooltip is currently visible.
47 bool IsVisible() const;
48
49 // Returns the view to which the tooltip bubble is anchored. May be null.
50 views::View* GetCurrentAnchorView() const;
51
52 // Show the tooltip bubble for the specified view.
53 void ShowTooltip(views::View* view);
54 void ShowTooltipWithDelay(views::View* view);
55
56 // Set the timer delay in ms for testing.
57 void set_timer_delay_for_test(int timer_delay) { timer_delay_ = timer_delay; }
58
59 protected:
60 // ui::EventHandler overrides:
61 void OnEvent(ui::Event* event) override;
62
63 // aura::WindowObserver overrides:
64 void OnWindowDestroying(aura::Window* window) override;
65
66 // views::PointerWatcher overrides:
67 void OnMousePressed(const ui::MouseEvent& event,
68 const gfx::Point& location_in_screen,
69 views::Widget* target) override;
70 void OnTouchPressed(const ui::TouchEvent& event,
71 const gfx::Point& location_in_screen,
72 views::Widget* target) override;
73
74 // ShelfLayoutManagerObserver overrides:
75 void WillDeleteShelfLayoutManager() override;
76 void WillChangeVisibilityState(ShelfVisibilityState new_state) override;
77 void OnAutoHideStateChanged(ShelfAutoHideState new_state) override;
78
79 private:
80 class ShelfTooltipBubble;
81 friend class test::ShelfViewTest;
82 friend class test::ShelfTooltipManagerTest;
83
84 // A helper function to check for shelf visibility and view validity.
85 bool ShouldShowTooltipForView(views::View* view);
86
87 int timer_delay_;
88 base::OneShotTimer timer_;
89
90 ShelfView* shelf_view_;
91 aura::Window* root_window_;
92 ShelfLayoutManager* shelf_layout_manager_;
93 views::BubbleDialogDelegateView* bubble_;
94
95 base::WeakPtrFactory<ShelfTooltipManager> weak_factory_;
96
97 DISALLOW_COPY_AND_ASSIGN(ShelfTooltipManager);
98 };
99
100 } // namespace ash
101
102 #endif // ASH_SHELF_SHELF_TOOLTIP_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_window_mus.cc ('k') | ash/shelf/shelf_tooltip_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698