Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / views / corewm / tooltip_aura.h
blobd1ef44811280cf8913f10686dd8a904a4b3b65f7
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.
5 #ifndef UI_VIEWS_COREWM_TOOLTIP_AURA_H_
6 #define UI_VIEWS_COREWM_TOOLTIP_AURA_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/gfx/screen_type_delegate.h"
10 #include "ui/views/corewm/tooltip.h"
11 #include "ui/views/widget/widget_observer.h"
13 namespace gfx {
14 class FontList;
15 class Size;
16 } // namespace gfx
18 namespace views {
20 class Widget;
22 namespace corewm {
24 // Implementation of Tooltip that shows the tooltip using a Widget and Label.
25 class VIEWS_EXPORT TooltipAura : public Tooltip, public WidgetObserver {
26 public:
27 TooltipAura();
28 ~TooltipAura() override;
30 private:
31 class TooltipView;
33 // Adjusts the bounds given by the arguments to fit inside the desktop
34 // and applies the adjusted bounds to the label_.
35 void SetTooltipBounds(const gfx::Point& mouse_pos,
36 const gfx::Size& tooltip_size);
38 // Destroys |widget_|.
39 void DestroyWidget();
41 // Tooltip:
42 int GetMaxWidth(const gfx::Point& location,
43 aura::Window* context) const override;
44 void SetText(aura::Window* window,
45 const base::string16& tooltip_text,
46 const gfx::Point& location) override;
47 void Show() override;
48 void Hide() override;
49 bool IsVisible() override;
51 // WidgetObserver:
52 void OnWidgetDestroying(Widget* widget) override;
54 // The view showing the tooltip.
55 scoped_ptr<TooltipView> tooltip_view_;
57 // The widget containing the tooltip. May be NULL.
58 Widget* widget_;
60 // The window we're showing the tooltip for. Never NULL and valid while
61 // showing.
62 aura::Window* tooltip_window_;
64 DISALLOW_COPY_AND_ASSIGN(TooltipAura);
67 } // namespace corewm
68 } // namespace views
70 #endif // UI_VIEWS_COREWM_TOOLTIP_AURA_H_