summaryrefslogtreecommitdiffstats
path: root/ash/system
diff options
context:
space:
mode:
authorfqj <fqj@chromium.org>2015-11-24 02:39:17 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-24 10:40:01 +0000
commita00da4ed15a3bcd3d0ced74c917cc2c78452e701 (patch)
tree56cea5cfbe1aeab1a427604ce121aab05fb53bc5 /ash/system
parentad9c27b059c5d37dc278e0c7a4b8cdb202952491 (diff)
downloadchromium_src-a00da4ed15a3bcd3d0ced74c917cc2c78452e701.zip
chromium_src-a00da4ed15a3bcd3d0ced74c917cc2c78452e701.tar.gz
chromium_src-a00da4ed15a3bcd3d0ced74c917cc2c78452e701.tar.bz2
Support tooltip for HoverHighlightView
BUG= Review URL: https://codereview.chromium.org/1466393002 Cr-Commit-Position: refs/heads/master@{#361308}
Diffstat (limited to 'ash/system')
-rw-r--r--ash/system/tray/hover_highlight_view.cc8
-rw-r--r--ash/system/tray/hover_highlight_view.h7
2 files changed, 15 insertions, 0 deletions
diff --git a/ash/system/tray/hover_highlight_view.cc b/ash/system/tray/hover_highlight_view.cc
index 164cb41..ee43e71 100644
--- a/ash/system/tray/hover_highlight_view.cc
+++ b/ash/system/tray/hover_highlight_view.cc
@@ -50,6 +50,14 @@ HoverHighlightView::HoverHighlightView(ViewClickListener* listener)
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,
const base::string16& text,
bool highlight) {
diff --git a/ash/system/tray/hover_highlight_view.h b/ash/system/tray/hover_highlight_view.h
index 6b9d1a2..40819bd 100644
--- a/ash/system/tray/hover_highlight_view.h
+++ b/ash/system/tray/hover_highlight_view.h
@@ -26,6 +26,10 @@ class HoverHighlightView : public ActionableView {
explicit HoverHighlightView(ViewClickListener* listener);
~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
// accessible name.
void AddIconAndLabel(const gfx::ImageSkia& image,
@@ -66,6 +70,8 @@ class HoverHighlightView : public ActionableView {
bool hover() const { return hover_; }
+ void set_tooltip(const base::string16& tooltip) { tooltip_ = tooltip; }
+
protected:
// Overridden from views::View.
void GetAccessibleState(ui::AXViewState* state) override;
@@ -103,6 +109,7 @@ class HoverHighlightView : public ActionableView {
bool expandable_;
bool checkable_;
bool checked_;
+ base::string16 tooltip_;
DISALLOW_COPY_AND_ASSIGN(HoverHighlightView);
};