Commit a00da4ed authored by fqj's avatar fqj Committed by Commit bot

Support tooltip for HoverHighlightView

BUG=

Review URL: https://codereview.chromium.org/1466393002

Cr-Commit-Position: refs/heads/master@{#361308}
parent ad9c27b0
...@@ -50,6 +50,14 @@ HoverHighlightView::HoverHighlightView(ViewClickListener* listener) ...@@ -50,6 +50,14 @@ HoverHighlightView::HoverHighlightView(ViewClickListener* listener)
HoverHighlightView::~HoverHighlightView() { HoverHighlightView::~HoverHighlightView() {
} }
bool HoverHighlightView::GetTooltipText(const gfx::Point& p,
base::string16* tooltip) const {
if (tooltip_.empty())
return false;
*tooltip = tooltip_;
return true;
}
void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image, void HoverHighlightView::AddIconAndLabel(const gfx::ImageSkia& image,
const base::string16& text, const base::string16& text,
bool highlight) { bool highlight) {
......
...@@ -26,6 +26,10 @@ class HoverHighlightView : public ActionableView { ...@@ -26,6 +26,10 @@ class HoverHighlightView : public ActionableView {
explicit HoverHighlightView(ViewClickListener* listener); explicit HoverHighlightView(ViewClickListener* listener);
~HoverHighlightView() override; ~HoverHighlightView() override;
// views::View
bool GetTooltipText(const gfx::Point& p,
base::string16* tooltip) const override;
// Convenience function for adding an icon and a label. This also sets the // Convenience function for adding an icon and a label. This also sets the
// accessible name. // accessible name.
void AddIconAndLabel(const gfx::ImageSkia& image, void AddIconAndLabel(const gfx::ImageSkia& image,
...@@ -66,6 +70,8 @@ class HoverHighlightView : public ActionableView { ...@@ -66,6 +70,8 @@ class HoverHighlightView : public ActionableView {
bool hover() const { return hover_; } bool hover() const { return hover_; }
void set_tooltip(const base::string16& tooltip) { tooltip_ = tooltip; }
protected: protected:
// Overridden from views::View. // Overridden from views::View.
void GetAccessibleState(ui::AXViewState* state) override; void GetAccessibleState(ui::AXViewState* state) override;
...@@ -103,6 +109,7 @@ class HoverHighlightView : public ActionableView { ...@@ -103,6 +109,7 @@ class HoverHighlightView : public ActionableView {
bool expandable_; bool expandable_;
bool checkable_; bool checkable_;
bool checked_; bool checked_;
base::string16 tooltip_;
DISALLOW_COPY_AND_ASSIGN(HoverHighlightView); DISALLOW_COPY_AND_ASSIGN(HoverHighlightView);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment