diff options
-rw-r--r-- | chrome/browser/views/clear_browsing_data.cc | 1 | ||||
-rw-r--r-- | views/accessibility/accessibility_types.h | 2 | ||||
-rw-r--r-- | views/accessibility/view_accessibility.cc | 4 | ||||
-rw-r--r-- | views/controls/combobox/combobox.cc | 21 | ||||
-rw-r--r-- | views/controls/combobox/combobox.h | 10 | ||||
-rw-r--r-- | views/controls/link.cc | 15 | ||||
-rw-r--r-- | views/controls/link.h | 8 |
7 files changed, 58 insertions, 3 deletions
diff --git a/chrome/browser/views/clear_browsing_data.cc b/chrome/browser/views/clear_browsing_data.cc index b87bfdd..0535447 100644 --- a/chrome/browser/views/clear_browsing_data.cc +++ b/chrome/browser/views/clear_browsing_data.cc @@ -123,6 +123,7 @@ void ClearBrowsingDataView::Init() { time_period_combobox_->SetSelectedItem(profile_->GetPrefs()->GetInteger( prefs::kDeleteTimePeriod)); time_period_combobox_->set_listener(this); + time_period_combobox_->SetAccessibleName(time_period_label_->GetText()); AddChildView(time_period_combobox_); // Create the throbber and related views. The throbber and status link are diff --git a/views/accessibility/accessibility_types.h b/views/accessibility/accessibility_types.h index e3bdfae..cc92d0c 100644 --- a/views/accessibility/accessibility_types.h +++ b/views/accessibility/accessibility_types.h @@ -25,8 +25,10 @@ class AccessibilityTypes { ROLE_BUTTONMENU, ROLE_CHECKBUTTON, ROLE_CLIENT, + ROLE_COMBOBOX, ROLE_GRAPHIC, ROLE_GROUPING, + ROLE_LINK, ROLE_PAGETAB, ROLE_PAGETABLIST, ROLE_PUSHBUTTON, diff --git a/views/accessibility/view_accessibility.cc b/views/accessibility/view_accessibility.cc index f6c83eb..f8bf516 100644 --- a/views/accessibility/view_accessibility.cc +++ b/views/accessibility/view_accessibility.cc @@ -676,10 +676,14 @@ long ViewAccessibility::MSAARole(AccessibilityTypes::Role role) { return ROLE_SYSTEM_BUTTONMENU; case AccessibilityTypes::ROLE_CHECKBUTTON: return ROLE_SYSTEM_CHECKBUTTON; + case AccessibilityTypes::ROLE_COMBOBOX: + return ROLE_SYSTEM_COMBOBOX; case AccessibilityTypes::ROLE_GRAPHIC: return ROLE_SYSTEM_GRAPHIC; case AccessibilityTypes::ROLE_GROUPING: return ROLE_SYSTEM_GROUPING; + case AccessibilityTypes::ROLE_LINK: + return ROLE_SYSTEM_LINK; case AccessibilityTypes::ROLE_PAGETAB: return ROLE_SYSTEM_PAGETAB; case AccessibilityTypes::ROLE_PAGETABLIST: diff --git a/views/controls/combobox/combobox.cc b/views/controls/combobox/combobox.cc index 290c141..2edfcd9 100644 --- a/views/controls/combobox/combobox.cc +++ b/views/controls/combobox/combobox.cc @@ -85,6 +85,27 @@ void Combobox::PaintFocusBorder(gfx::Canvas* canvas) { View::PaintFocusBorder(canvas); } +bool Combobox::GetAccessibleName(std::wstring* name) { + DCHECK(name); + + if (!accessible_name_.empty()) { + *name = accessible_name_; + return true; + } + return false; +} + +bool Combobox::GetAccessibleRole(AccessibilityTypes::Role* role) { + DCHECK(role); + + *role = AccessibilityTypes::ROLE_COMBOBOX; + return true; +} + +void Combobox::SetAccessibleName(const std::wstring& name) { + accessible_name_.assign(name); +} + void Combobox::Focus() { // Forward the focus to the wrapper. if (native_wrapper_) diff --git a/views/controls/combobox/combobox.h b/views/controls/combobox/combobox.h index 1380051..fdf5f8e 100644 --- a/views/controls/combobox/combobox.h +++ b/views/controls/combobox/combobox.h @@ -5,6 +5,8 @@ #ifndef VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_ #define VIEWS_CONTROLS_COMBOBOX_COMBOBOX_H_ +#include <string> + #include "views/view.h" class ComboboxModel; @@ -40,7 +42,7 @@ class Combobox : public View { void ModelChanged(); // Gets/Sets the selected item. - int selected_item() const { return selected_item_; }; + int selected_item() const { return selected_item_; } void SetSelectedItem(int index); // Called when the combo box's selection is changed by the user. @@ -55,6 +57,9 @@ class Combobox : public View { virtual void SetEnabled(bool enabled); virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); virtual void PaintFocusBorder(gfx::Canvas* canvas); + virtual bool GetAccessibleName(std::wstring* name); + virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual void SetAccessibleName(const std::wstring& name); protected: virtual void Focus(); @@ -75,6 +80,9 @@ class Combobox : public View { // The current selection. int selected_item_; + // The accessible name of this control. + std::wstring accessible_name_; + DISALLOW_COPY_AND_ASSIGN(Combobox); }; diff --git a/views/controls/link.cc b/views/controls/link.cc index e83c0cd..80172e2 100644 --- a/views/controls/link.cc +++ b/views/controls/link.cc @@ -51,7 +51,6 @@ void GetColors(const SkColor* background_color, // NULL means "use default" *normal_color = kNormalColor; } } - } namespace views { @@ -145,6 +144,20 @@ bool Link::SkipDefaultKeyEventProcessing(const KeyEvent& e) { (e.GetKeyCode() == base::VKEY_RETURN); } +bool Link::GetAccessibleRole(AccessibilityTypes::Role* role) { + DCHECK(role); + + *role = AccessibilityTypes::ROLE_LINK; + return true; +} + +bool Link::GetAccessibleName(std::wstring* name) { + DCHECK(name); + + *name = GetText(); + return !name->empty(); +} + void Link::SetFont(const gfx::Font& font) { Label::SetFont(font); ValidateStyle(); diff --git a/views/controls/link.h b/views/controls/link.h index 8c281e3..4ef7af3 100644 --- a/views/controls/link.h +++ b/views/controls/link.h @@ -5,6 +5,8 @@ #ifndef VIEWS_CONTROLS_LINK_H_ #define VIEWS_CONTROLS_LINK_H_ +#include <string> + #include "views/controls/label.h" namespace views { @@ -33,7 +35,7 @@ class LinkController { class Link : public Label { public: Link(); - Link(const std::wstring& title); + explicit Link(const std::wstring& title); virtual ~Link(); void SetController(LinkController* controller); @@ -47,6 +49,10 @@ class Link : public Label { virtual bool OnKeyPressed(const KeyEvent& e); virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); + // Accessibility accessors, overridden from View: + virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual bool GetAccessibleName(std::wstring* name); + virtual void SetFont(const gfx::Font& font); // Set whether the link is enabled. |