diff options
author | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-14 15:26:26 +0000 |
---|---|---|
committer | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-14 15:26:26 +0000 |
commit | f28de83c4785e9e5f7467ab6660ddb0e7ac78fce (patch) | |
tree | 63321b6d679a58952466eb1d34fd9905d14f6119 /ash | |
parent | c83c20e55de922825082f249450d91da5bb8f6b3 (diff) | |
download | chromium_src-f28de83c4785e9e5f7467ab6660ddb0e7ac78fce.zip chromium_src-f28de83c4785e9e5f7467ab6660ddb0e7ac78fce.tar.gz chromium_src-f28de83c4785e9e5f7467ab6660ddb0e7ac78fce.tar.bz2 |
Set tooltip text to launcher buttons.
BUG=117292
TEST=manually
Review URL: http://codereview.chromium.org/9691037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126647 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/launcher/launcher_button.cc | 7 | ||||
-rw-r--r-- | ash/launcher/launcher_button.h | 2 | ||||
-rw-r--r-- | ash/launcher/launcher_button_host.h | 2 | ||||
-rw-r--r-- | ash/launcher/launcher_view.cc | 2 | ||||
-rw-r--r-- | ash/launcher/launcher_view.h | 2 | ||||
-rw-r--r-- | ash/launcher/view_model.cc | 4 | ||||
-rw-r--r-- | ash/launcher/view_model.h | 4 |
7 files changed, 16 insertions, 7 deletions
diff --git a/ash/launcher/launcher_button.cc b/ash/launcher/launcher_button.cc index c1a4835..b9f5000 100644 --- a/ash/launcher/launcher_button.cc +++ b/ash/launcher/launcher_button.cc @@ -187,6 +187,13 @@ void LauncherButton::Layout() { bar_->SetBounds(0, height() - kBarHeight, width(), kBarHeight); } +bool LauncherButton::GetTooltipText( + const gfx::Point& p, string16* tooltip) const { + DCHECK(tooltip); + tooltip->assign(host_->GetAccessibleName(this)); + return true; +} + void LauncherButton::Init() { icon_view_ = CreateIconView(); // TODO: refactor the layers so each button doesn't require 2. diff --git a/ash/launcher/launcher_button.h b/ash/launcher/launcher_button.h index 40a51bd..a3d1310 100644 --- a/ash/launcher/launcher_button.h +++ b/ash/launcher/launcher_button.h @@ -70,6 +70,8 @@ class LauncherButton : public views::CustomButton { virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; virtual void Layout() OVERRIDE; + virtual bool GetTooltipText(const gfx::Point& p, + string16* tooltip) const OVERRIDE; // Override for custom initialization. virtual void Init(); diff --git a/ash/launcher/launcher_button_host.h b/ash/launcher/launcher_button_host.h index 7e4c21a..4fbef03 100644 --- a/ash/launcher/launcher_button_host.h +++ b/ash/launcher/launcher_button_host.h @@ -37,7 +37,7 @@ class ASH_EXPORT LauncherButtonHost { virtual void MouseExitedButton(views::View* view) = 0; // Invoked to get the accessible name of the item. - virtual string16 GetAccessibleName(views::View* view) = 0; + virtual string16 GetAccessibleName(const views::View* view) = 0; protected: virtual ~LauncherButtonHost() {} diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc index be26a98..1dd9ca7 100644 --- a/ash/launcher/launcher_view.cc +++ b/ash/launcher/launcher_view.cc @@ -656,7 +656,7 @@ void LauncherView::MouseExitedButton(views::View* view) { MaybeResetWindowCycler(view); } -string16 LauncherView::GetAccessibleName(views::View* view) { +string16 LauncherView::GetAccessibleName(const views::View* view) { if (!delegate_) return string16(); int view_index = view_model_->GetIndexOfView(view); diff --git a/ash/launcher/launcher_view.h b/ash/launcher/launcher_view.h index 09f215a..c568383 100644 --- a/ash/launcher/launcher_view.h +++ b/ash/launcher/launcher_view.h @@ -131,7 +131,7 @@ class ASH_EXPORT LauncherView : public views::View, virtual void MouseReleasedOnButton(views::View* view, bool canceled) OVERRIDE; virtual void MouseExitedButton(views::View* view) OVERRIDE; - virtual string16 GetAccessibleName(views::View* view) OVERRIDE; + virtual string16 GetAccessibleName(const views::View* view) OVERRIDE; // Overriden from views::ButtonListener: virtual void ButtonPressed(views::Button* sender, diff --git a/ash/launcher/view_model.cc b/ash/launcher/view_model.cc index 7450133..28b0213 100644 --- a/ash/launcher/view_model.cc +++ b/ash/launcher/view_model.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -44,7 +44,7 @@ void ViewModel::Clear() { delete entries[i].view; } -int ViewModel::GetIndexOfView(views::View* view) const { +int ViewModel::GetIndexOfView(const views::View* view) const { for (size_t i = 0; i < entries_.size(); ++i) { if (entries_[i].view == view) return static_cast<int>(i); diff --git a/ash/launcher/view_model.h b/ash/launcher/view_model.h index ab4d897..bff50b8 100644 --- a/ash/launcher/view_model.h +++ b/ash/launcher/view_model.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -61,7 +61,7 @@ class ASH_EXPORT ViewModel { // Returns the index of the specified view, or -1 if the view isn't in the // model. - int GetIndexOfView(views::View* view) const; + int GetIndexOfView(const views::View* view) const; private: struct Entry { |