summaryrefslogtreecommitdiffstats
path: root/ui/base/accessibility
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-14 06:56:33 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-14 06:56:33 +0000
commit79e549faf26611d5ac05bc4f7fefd4a71a23fcb2 (patch)
treee7c50ebe8d193233ce2b06bbf5751bb9e82115b7 /ui/base/accessibility
parent36096983abafe5aa7a1df56904db3c0c8fa9ee2e (diff)
downloadchromium_src-79e549faf26611d5ac05bc4f7fefd4a71a23fcb2.zip
chromium_src-79e549faf26611d5ac05bc4f7fefd4a71a23fcb2.tar.gz
chromium_src-79e549faf26611d5ac05bc4f7fefd4a71a23fcb2.tar.bz2
Re-land: Refactor Views accessibility.
BUG=74988 TEST=none Review URL: http://codereview.chromium.org/6581010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/accessibility')
-rw-r--r--ui/base/accessibility/accessibility_types.h108
-rw-r--r--ui/base/accessibility/accessible_view_state.h66
2 files changed, 174 insertions, 0 deletions
diff --git a/ui/base/accessibility/accessibility_types.h b/ui/base/accessibility/accessibility_types.h
new file mode 100644
index 0000000..62f3255
--- /dev/null
+++ b/ui/base/accessibility/accessibility_types.h
@@ -0,0 +1,108 @@
+// Copyright (c) 2010 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.
+
+#ifndef UI_BASE_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_
+#define UI_BASE_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_
+#pragma once
+
+#include "base/basictypes.h"
+
+namespace ui {
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// AccessibilityTypes
+//
+// Provides enumerations used to preserve platform-independence in
+// accessibility functions.
+//
+////////////////////////////////////////////////////////////////////////////////
+class AccessibilityTypes {
+ public:
+
+ // This defines states of the supported accessibility roles in our
+ // Views (e.g. used in View::GetAccessibleState). Any interface using roles
+ // must provide a conversion to its own roles (see e.g.
+ // ViewAccessibility::get_accState and ViewAccessibility::MSAAState).
+ typedef uint32 State;
+ enum StateFlag {
+ STATE_CHECKED = 1 << 0,
+ STATE_COLLAPSED = 1 << 1,
+ STATE_DEFAULT = 1 << 2,
+ STATE_EXPANDED = 1 << 3,
+ STATE_HASPOPUP = 1 << 4,
+ STATE_HOTTRACKED = 1 << 5,
+ STATE_INVISIBLE = 1 << 6,
+ STATE_LINKED = 1 << 7,
+ STATE_OFFSCREEN = 1 << 8,
+ STATE_PRESSED = 1 << 9,
+ STATE_PROTECTED = 1 << 10,
+ STATE_READONLY = 1 << 11,
+ STATE_SELECTED = 1 << 12,
+ STATE_FOCUSED = 1 << 13,
+ STATE_UNAVAILABLE = 1 << 14
+ };
+
+ // This defines an enumeration of the supported accessibility roles in our
+ // Views (e.g. used in View::GetAccessibleRole). Any interface using roles
+ // must provide a conversion to its own roles (see e.g.
+ // ViewAccessibility::get_accRole and ViewAccessibility::MSAARole).
+ enum Role {
+ ROLE_ALERT,
+ ROLE_APPLICATION,
+ ROLE_BUTTONDROPDOWN,
+ ROLE_BUTTONMENU,
+ ROLE_CHECKBUTTON,
+ ROLE_CLIENT,
+ ROLE_COMBOBOX,
+ ROLE_DIALOG,
+ ROLE_GRAPHIC,
+ ROLE_GROUPING,
+ ROLE_LINK,
+ ROLE_MENUBAR,
+ ROLE_MENUITEM,
+ ROLE_MENUPOPUP,
+ ROLE_OUTLINE,
+ ROLE_OUTLINEITEM,
+ ROLE_PAGETAB,
+ ROLE_PAGETABLIST,
+ ROLE_PANE,
+ ROLE_PROGRESSBAR,
+ ROLE_PUSHBUTTON,
+ ROLE_RADIOBUTTON,
+ ROLE_SCROLLBAR,
+ ROLE_SEPARATOR,
+ ROLE_STATICTEXT,
+ ROLE_TEXT,
+ ROLE_TITLEBAR,
+ ROLE_TOOLBAR,
+ ROLE_WINDOW
+ };
+
+ // This defines an enumeration of the supported accessibility events in our
+ // Views (e.g. used in View::NotifyAccessibilityEvent). Any interface using
+ // events must provide a conversion to its own events (see e.g.
+ // ViewAccessibility::MSAAEvent).
+ enum Event {
+ EVENT_ALERT,
+ EVENT_FOCUS,
+ EVENT_MENUSTART,
+ EVENT_MENUEND,
+ EVENT_MENUPOPUPSTART,
+ EVENT_MENUPOPUPEND,
+ EVENT_NAME_CHANGED,
+ EVENT_TEXT_CHANGED,
+ EVENT_SELECTION_CHANGED,
+ EVENT_VALUE_CHANGED
+ };
+
+ private:
+ // Do not instantiate this class.
+ AccessibilityTypes() {}
+ ~AccessibilityTypes() {}
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_
diff --git a/ui/base/accessibility/accessible_view_state.h b/ui/base/accessibility/accessible_view_state.h
new file mode 100644
index 0000000..2f36a4b
--- /dev/null
+++ b/ui/base/accessibility/accessible_view_state.h
@@ -0,0 +1,66 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ACCESSIBILITY_ACCESSIBLE_VIEW_STATE_H_
+#define UI_BASE_ACCESSIBILITY_ACCESSIBLE_VIEW_STATE_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "base/string16.h"
+#include "ui/base/accessibility/accessibility_types.h"
+
+namespace ui {
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// AccessibleViewState
+//
+// A cross-platform struct for storing the core accessibility information
+// that should be provided about any UI view to assistive technology (AT).
+//
+////////////////////////////////////////////////////////////////////////////////
+struct AccessibleViewState {
+ public:
+ AccessibleViewState()
+ : role(AccessibilityTypes::ROLE_CLIENT),
+ state(0),
+ selection_start(-1),
+ selection_end(-1),
+ index(-1),
+ count(-1) { }
+
+ // The view's role, like button or list box.
+ AccessibilityTypes::Role role;
+
+ // The view's state, a bitmask containing fields such as checked
+ // (for a checkbox) and protected (for a password text box).
+ AccessibilityTypes::State state;
+
+ // The view's name / label.
+ string16 name;
+
+ // The view's value, for example the text content.
+ string16 value;
+
+ // The name of the default action if the user clicks on this view.
+ string16 default_action;
+
+ // The keyboard shortcut to activate this view, if any.
+ string16 keyboard_shortcut;
+
+ // The selection start and end. Only applies to views with text content,
+ // such as a text box or combo box; start and end should be -1 otherwise.
+ int selection_start;
+ int selection_end;
+
+ // The selected item's index and the count of the number of items.
+ // Only applies to views with multiple choices like a listbox; both
+ // index and count should be -1 otherwise.
+ int index;
+ int count;
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ACCESSIBILITY_ACCESSIBLE_VIEW_STATE_H_