summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 03:38:39 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-20 03:38:39 +0000
commitb15d32708bc051af37669714108e583e49b62a99 (patch)
tree34c8a0a2d12873990a9a9b75ef3999e41b1462c6 /ash
parent4cc334f4417a945e8d56cc63c462ad621f326aca (diff)
downloadchromium_src-b15d32708bc051af37669714108e583e49b62a99.zip
chromium_src-b15d32708bc051af37669714108e583e49b62a99.tar.gz
chromium_src-b15d32708bc051af37669714108e583e49b62a99.tar.bz2
Changes checkable HoverHighlightView to checkbox for a11y.
BUG=320054 R=stevenjb@chromium.org TEST=manually Review URL: https://codereview.chromium.org/76673002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@236127 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/system/tray/hover_highlight_view.cc16
-rw-r--r--ash/system/tray/hover_highlight_view.h3
2 files changed, 18 insertions, 1 deletions
diff --git a/ash/system/tray/hover_highlight_view.cc b/ash/system/tray/hover_highlight_view.cc
index a622dc9..f68ea12 100644
--- a/ash/system/tray/hover_highlight_view.cc
+++ b/ash/system/tray/hover_highlight_view.cc
@@ -8,6 +8,7 @@
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/view_click_listener.h"
#include "grit/ui_resources.h"
+#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/views/controls/image_view.h"
@@ -32,7 +33,9 @@ HoverHighlightView::HoverHighlightView(ViewClickListener* listener)
text_highlight_color_(0),
text_default_color_(0),
hover_(false),
- expandable_(false) {
+ expandable_(false),
+ checkable_(false),
+ checked_(false) {
set_notify_enter_exit_on_child(true);
}
@@ -89,6 +92,8 @@ views::Label* HoverHighlightView::AddLabel(const base::string16& text,
views::Label* HoverHighlightView::AddCheckableLabel(const base::string16& text,
gfx::Font::FontStyle style,
bool checked) {
+ checkable_ = true;
+ checked_ = checked;
if (checked) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
const gfx::ImageSkia* check =
@@ -130,6 +135,15 @@ bool HoverHighlightView::PerformAction(const ui::Event& event) {
return true;
}
+void HoverHighlightView::GetAccessibleState(ui::AccessibleViewState* state) {
+ ActionableView::GetAccessibleState(state);
+
+ if (checkable_) {
+ state->role = ui::AccessibilityTypes::ROLE_CHECKBUTTON;
+ state->state = checked_ ? ui::AccessibilityTypes::STATE_CHECKED : 0;
+ }
+}
+
gfx::Size HoverHighlightView::GetPreferredSize() {
gfx::Size size = ActionableView::GetPreferredSize();
if (!expandable_ || size.height() < kTrayPopupItemHeight)
diff --git a/ash/system/tray/hover_highlight_view.h b/ash/system/tray/hover_highlight_view.h
index 13630ca..e19c3ef 100644
--- a/ash/system/tray/hover_highlight_view.h
+++ b/ash/system/tray/hover_highlight_view.h
@@ -64,6 +64,7 @@ class HoverHighlightView : public ActionableView {
virtual bool PerformAction(const ui::Event& event) OVERRIDE;
// Overridden from views::View.
+ virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual int GetHeightForWidth(int width) OVERRIDE;
virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE;
@@ -80,6 +81,8 @@ class HoverHighlightView : public ActionableView {
SkColor text_default_color_;
bool hover_;
bool expandable_;
+ bool checkable_;
+ bool checked_;
DISALLOW_COPY_AND_ASSIGN(HoverHighlightView);
};