summaryrefslogtreecommitdiffstats
path: root/views/controls/menu/submenu_view.cc
diff options
context:
space:
mode:
authorjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 00:39:07 +0000
committerjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 00:39:07 +0000
commitbb837f9287259862c94155cc59cfc9e1bdfe1258 (patch)
treef23a7dabe56a4b4c9288ea022f65c090a4fc536b /views/controls/menu/submenu_view.cc
parentd19e63d5bd3a61fc46bae0c527731c79abb94957 (diff)
downloadchromium_src-bb837f9287259862c94155cc59cfc9e1bdfe1258.zip
chromium_src-bb837f9287259862c94155cc59cfc9e1bdfe1258.tar.gz
chromium_src-bb837f9287259862c94155cc59cfc9e1bdfe1258.tar.bz2
Revert 76825 - Refactor Views accessibility.
BUG=none TEST=none Review URL: http://codereview.chromium.org/6581010 TBR=dmazzoni@chromium.org Review URL: http://codereview.chromium.org/6612035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76844 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/menu/submenu_view.cc')
-rw-r--r--views/controls/menu/submenu_view.cc50
1 files changed, 20 insertions, 30 deletions
diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc
index fb78762..7c1f69e 100644
--- a/views/controls/menu/submenu_view.cc
+++ b/views/controls/menu/submenu_view.cc
@@ -4,14 +4,12 @@
#include "views/controls/menu/submenu_view.h"
-#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/gfx/canvas.h"
#include "views/controls/menu/menu_config.h"
#include "views/controls/menu/menu_controller.h"
#include "views/controls/menu/menu_host.h"
#include "views/controls/menu/menu_scroll_view_container.h"
#include "views/widget/root_view.h"
-#include "views/widget/widget.h"
// Height of the drop indicator. This should be an even number.
static const int kDropIndicatorHeight = 2;
@@ -127,10 +125,8 @@ void SubmenuView::OnBoundsChanged() {
SchedulePaint();
}
-void SubmenuView::GetAccessibleState(ui::AccessibleViewState* state) {
- // Inherit most of the state from the parent menu item, except the role.
- GetMenuItem()->GetAccessibleState(state);
- state->role = ui::AccessibilityTypes::ROLE_MENUPOPUP;
+AccessibilityTypes::Role SubmenuView::GetAccessibleRole() {
+ return AccessibilityTypes::ROLE_MENUPOPUP;
}
void SubmenuView::PaintChildren(gfx::Canvas* canvas) {
@@ -237,14 +233,10 @@ void SubmenuView::ShowAt(gfx::NativeWindow parent,
if (host_) {
host_->ShowMenuHost(do_capture);
- GetScrollViewContainer()->GetWidget()->NotifyAccessibilityEvent(
- GetScrollViewContainer(),
- ui::AccessibilityTypes::EVENT_MENUSTART,
- true);
- GetWidget()->NotifyAccessibilityEvent(
- this,
- ui::AccessibilityTypes::EVENT_MENUPOPUPSTART,
- true);
+ GetScrollViewContainer()->NotifyAccessibilityEvent(
+ AccessibilityTypes::EVENT_MENUSTART);
+
+ NotifyAccessibilityEvent(AccessibilityTypes::EVENT_MENUPOPUPSTART);
return;
}
@@ -255,14 +247,10 @@ void SubmenuView::ShowAt(gfx::NativeWindow parent,
ScrollRectToVisible(gfx::Rect(gfx::Point(), gfx::Size(1, 1)));
host_->Init(parent, bounds, scroll_view_container_, do_capture);
- GetScrollViewContainer()->GetWidget()->NotifyAccessibilityEvent(
- GetScrollViewContainer(),
- ui::AccessibilityTypes::EVENT_MENUSTART,
- true);
- GetWidget()->NotifyAccessibilityEvent(
- this,
- ui::AccessibilityTypes::EVENT_MENUPOPUPSTART,
- true);
+ GetScrollViewContainer()->NotifyAccessibilityEvent(
+ AccessibilityTypes::EVENT_MENUSTART);
+
+ NotifyAccessibilityEvent(AccessibilityTypes::EVENT_MENUPOPUPSTART);
}
void SubmenuView::Reposition(const gfx::Rect& bounds) {
@@ -272,14 +260,10 @@ void SubmenuView::Reposition(const gfx::Rect& bounds) {
void SubmenuView::Close() {
if (host_) {
- GetWidget()->NotifyAccessibilityEvent(
- this,
- ui::AccessibilityTypes::EVENT_MENUPOPUPEND,
- true);
- GetScrollViewContainer()->GetWidget()->NotifyAccessibilityEvent(
- GetScrollViewContainer(),
- ui::AccessibilityTypes::EVENT_MENUEND,
- true);
+ NotifyAccessibilityEvent(AccessibilityTypes::EVENT_MENUPOPUPEND);
+
+ GetScrollViewContainer()->NotifyAccessibilityEvent(
+ AccessibilityTypes::EVENT_MENUEND);
host_->DestroyMenuHost();
host_ = NULL;
@@ -324,6 +308,12 @@ MenuScrollViewContainer* SubmenuView::GetScrollViewContainer() {
scroll_view_container_ = new MenuScrollViewContainer(this);
// Otherwise MenuHost would delete us.
scroll_view_container_->set_parent_owned(false);
+
+ // Use the parent menu item accessible name for the menu view.
+ string16 accessible_name;
+ GetMenuItem()->GetAccessibleName(&accessible_name);
+ scroll_view_container_->SetAccessibleName(accessible_name);
+ SetAccessibleName(accessible_name);
}
return scroll_view_container_;
}