#ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_ICON_LABEL_BUBBLE_VIEW_H_
#include <string>
#include "base/strings/string16.h"
#include "ui/gfx/size.h"
#include "ui/views/view.h"
namespace gfx {
class Canvas;
class FontList;
class ImageSkia;
}
namespace views {
class ImageView;
class Label;
class Painter;
}
class IconLabelBubbleView : public views::View {
public:
IconLabelBubbleView(const int background_images[],
const int hover_background_images[],
int contained_image,
const gfx::FontList& font_list,
SkColor text_color,
SkColor parent_background_color,
bool elide_in_middle);
virtual ~IconLabelBubbleView();
void SetLabel(const base::string16& label);
void SetImage(const gfx::ImageSkia& image);
void set_is_extension_icon(bool is_extension_icon) {
is_extension_icon_ = is_extension_icon;
}
protected:
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void Layout() OVERRIDE;
virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE;
gfx::Size GetSizeForLabelWidth(int width) const;
private:
static int GetBubbleOuterPadding(bool by_icon);
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
int GetPreLabelWidth() const;
scoped_ptr<views::Painter> background_painter_;
scoped_ptr<views::Painter> hover_background_painter_;
views::ImageView* image_;
views::Label* label_;
bool is_extension_icon_;
bool in_hover_;
DISALLOW_COPY_AND_ASSIGN(IconLabelBubbleView);
};
#endif