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"
24 // Implementation of Tooltip that shows the tooltip using a Widget and Label.
25 class VIEWS_EXPORT TooltipAura
: public Tooltip
, public WidgetObserver
{
28 ~TooltipAura() override
;
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_|.
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
;
49 bool IsVisible() override
;
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.
60 // The window we're showing the tooltip for. Never NULL and valid while
62 aura::Window
* tooltip_window_
;
64 DISALLOW_COPY_AND_ASSIGN(TooltipAura
);
70 #endif // UI_VIEWS_COREWM_TOOLTIP_AURA_H_