summaryrefslogtreecommitdiffstats
path: root/views/accessibility
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/accessibility
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/accessibility')
-rw-r--r--views/accessibility/accessibility_types.h104
-rw-r--r--views/accessibility/view_accessibility.cc (renamed from views/accessibility/native_view_accessibility_win.cc)143
-rw-r--r--views/accessibility/view_accessibility.h (renamed from views/accessibility/native_view_accessibility_win.h)33
3 files changed, 174 insertions, 106 deletions
diff --git a/views/accessibility/accessibility_types.h b/views/accessibility/accessibility_types.h
new file mode 100644
index 0000000..e55996e
--- /dev/null
+++ b/views/accessibility/accessibility_types.h
@@ -0,0 +1,104 @@
+// 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 VIEWS_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_
+#define VIEWS_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_
+#pragma once
+
+#include "base/basictypes.h"
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// AccessibilityTypes
+//
+// Provides enumerations used to preserve platform-independence in accessibility
+// functions used in various Views, both in Browser\Views and Views.
+//
+////////////////////////////////////////////////////////////////////////////////
+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() {}
+};
+
+#endif // VIEWS_ACCESSIBILITY_ACCESSIBILITY_TYPES_H_
diff --git a/views/accessibility/native_view_accessibility_win.cc b/views/accessibility/view_accessibility.cc
index 07a459e..ae9f889 100644
--- a/views/accessibility/native_view_accessibility_win.cc
+++ b/views/accessibility/view_accessibility.cc
@@ -1,36 +1,28 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
-#include "views/accessibility/native_view_accessibility_win.h"
+#include "views/accessibility/view_accessibility.h"
-#include "ui/base/accessibility/accessible_view_state.h"
#include "ui/base/view_prop.h"
#include "views/controls/button/native_button.h"
#include "views/widget/widget.h"
#include "views/widget/widget_win.h"
-using ui::AccessibilityTypes;
-
-namespace views {
-
const char kViewsNativeHostPropForAccessibility[] =
"Views_NativeViewHostHWNDForAccessibility";
// static
-scoped_refptr<NativeViewAccessibilityWin> NativeViewAccessibilityWin::Create(
- views::View* view) {
- CComObject<NativeViewAccessibilityWin>* instance = NULL;
- HRESULT hr = CComObject<NativeViewAccessibilityWin>::CreateInstance(
- &instance);
+scoped_refptr<ViewAccessibility> ViewAccessibility::Create(views::View* view) {
+ CComObject<ViewAccessibility>* instance = NULL;
+ HRESULT hr = CComObject<ViewAccessibility>::CreateInstance(&instance);
DCHECK(SUCCEEDED(hr));
instance->set_view(view);
- return scoped_refptr<NativeViewAccessibilityWin>(instance);
+ return scoped_refptr<ViewAccessibility>(instance);
}
// static
-IAccessible* NativeViewAccessibilityWin::GetAccessibleForView(
- views::View* view) {
+IAccessible* ViewAccessibility::GetAccessibleForView(views::View* view) {
IAccessible* accessible = NULL;
// First, check to see if the view is a native view.
@@ -51,18 +43,18 @@ IAccessible* NativeViewAccessibilityWin::GetAccessibleForView(
}
}
- // Finally, use our NativeViewAccessibilityWin implementation.
- return view->GetNativeViewAccessibilityWin();
+ // Finally, use our ViewAccessibility implementation.
+ return view->GetViewAccessibility();
}
-NativeViewAccessibilityWin::NativeViewAccessibilityWin() : view_(NULL) {
+ViewAccessibility::ViewAccessibility() : view_(NULL) {
}
-NativeViewAccessibilityWin::~NativeViewAccessibilityWin() {
+ViewAccessibility::~ViewAccessibility() {
}
// TODO(ctguil): Handle case where child View is not contained by parent.
-STDMETHODIMP NativeViewAccessibilityWin::accHitTest(
+STDMETHODIMP ViewAccessibility::accHitTest(
LONG x_left, LONG y_top, VARIANT* child) {
if (!child)
return E_INVALIDARG;
@@ -92,7 +84,7 @@ STDMETHODIMP NativeViewAccessibilityWin::accHitTest(
return S_OK;
}
-HRESULT NativeViewAccessibilityWin::accDoDefaultAction(VARIANT var_id) {
+HRESULT ViewAccessibility::accDoDefaultAction(VARIANT var_id) {
if (!IsValidId(var_id))
return E_INVALIDARG;
@@ -108,7 +100,7 @@ HRESULT NativeViewAccessibilityWin::accDoDefaultAction(VARIANT var_id) {
return DISP_E_MEMBERNOTFOUND;
}
-STDMETHODIMP NativeViewAccessibilityWin::accLocation(
+STDMETHODIMP ViewAccessibility::accLocation(
LONG* x_left, LONG* y_top, LONG* width, LONG* height, VARIANT var_id) {
if (!IsValidId(var_id) || !x_left || !y_top || !width || !height)
return E_INVALIDARG;
@@ -120,8 +112,8 @@ STDMETHODIMP NativeViewAccessibilityWin::accLocation(
*width = view_->width();
*height = view_->height();
gfx::Point topleft(view_->bounds().origin());
- views::View::ConvertPointToScreen(
- view_->parent() ? view_->parent() : view_, &topleft);
+ views::View::ConvertPointToScreen(view_->parent() ? view_->parent() : view_,
+ &topleft);
*x_left = topleft.x();
*y_top = topleft.y();
} else {
@@ -130,8 +122,8 @@ STDMETHODIMP NativeViewAccessibilityWin::accLocation(
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::accNavigate(
- LONG nav_dir, VARIANT start, VARIANT* end) {
+STDMETHODIMP ViewAccessibility::accNavigate(LONG nav_dir, VARIANT start,
+ VARIANT* end) {
if (start.vt != VT_I4 || !end)
return E_INVALIDARG;
@@ -231,7 +223,7 @@ STDMETHODIMP NativeViewAccessibilityWin::accNavigate(
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accChild(VARIANT var_child,
+STDMETHODIMP ViewAccessibility::get_accChild(VARIANT var_child,
IDispatch** disp_child) {
if (var_child.vt != VT_I4 || !disp_child)
return E_INVALIDARG;
@@ -274,7 +266,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accChild(VARIANT var_child,
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accChildCount(LONG* child_count) {
+STDMETHODIMP ViewAccessibility::get_accChildCount(LONG* child_count) {
if (!child_count || !view_)
return E_INVALIDARG;
@@ -285,7 +277,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accChildCount(LONG* child_count) {
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accDefaultAction(
+STDMETHODIMP ViewAccessibility::get_accDefaultAction(
VARIANT var_id, BSTR* def_action) {
if (!IsValidId(var_id) || !def_action)
return E_INVALIDARG;
@@ -293,9 +285,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accDefaultAction(
if (!view_)
return E_FAIL;
- ui::AccessibleViewState state;
- view_->GetAccessibleState(&state);
- string16 temp_action = state.default_action;
+ string16 temp_action = view_->GetAccessibleDefaultAction();
if (!temp_action.empty()) {
*def_action = SysAllocString(temp_action.c_str());
@@ -306,8 +296,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accDefaultAction(
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accDescription(
- VARIANT var_id, BSTR* desc) {
+STDMETHODIMP ViewAccessibility::get_accDescription(VARIANT var_id, BSTR* desc) {
if (!IsValidId(var_id) || !desc)
return E_INVALIDARG;
@@ -326,7 +315,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accDescription(
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accFocus(VARIANT* focus_child) {
+STDMETHODIMP ViewAccessibility::get_accFocus(VARIANT* focus_child) {
if (!focus_child)
return E_INVALIDARG;
@@ -353,7 +342,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accFocus(VARIANT* focus_child) {
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accKeyboardShortcut(
+STDMETHODIMP ViewAccessibility::get_accKeyboardShortcut(
VARIANT var_id, BSTR* acc_key) {
if (!IsValidId(var_id) || !acc_key)
return E_INVALIDARG;
@@ -361,9 +350,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accKeyboardShortcut(
if (!view_)
return E_FAIL;
- ui::AccessibleViewState state;
- view_->GetAccessibleState(&state);
- string16 temp_key = state.keyboard_shortcut;
+ string16 temp_key = view_->GetAccessibleKeyboardShortcut();
if (!temp_key.empty()) {
*acc_key = SysAllocString(temp_key.c_str());
@@ -374,18 +361,17 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accKeyboardShortcut(
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accName(
- VARIANT var_id, BSTR* name) {
+STDMETHODIMP ViewAccessibility::get_accName(VARIANT var_id, BSTR* name) {
if (!IsValidId(var_id) || !name)
return E_INVALIDARG;
if (!view_)
return E_FAIL;
+ string16 temp_name;
+
// Retrieve the current view's name.
- ui::AccessibleViewState state;
- view_->GetAccessibleState(&state);
- string16 temp_name = state.name;
+ view_->GetAccessibleName(&temp_name);
if (!temp_name.empty()) {
// Return name retrieved.
*name = SysAllocString(temp_name.c_str());
@@ -397,8 +383,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accName(
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accParent(
- IDispatch** disp_parent) {
+STDMETHODIMP ViewAccessibility::get_accParent(IDispatch** disp_parent) {
if (!disp_parent)
return E_INVALIDARG;
@@ -415,9 +400,9 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accParent(
return S_FALSE;
}
- // For a View that has no parent (e.g. root), point the accessible parent
- // to the default implementation, to interface with Windows' hierarchy
- // and to support calls from e.g. WindowFromAccessibleObject.
+ // For a View that has no parent (e.g. root), point the accessible parent to
+ // the default implementation, to interface with Windows' hierarchy and to
+ // support calls from e.g. WindowFromAccessibleObject.
HRESULT hr =
::AccessibleObjectFromWindow(view_->GetWidget()->GetNativeView(),
OBJID_WINDOW, IID_IAccessible,
@@ -436,23 +421,19 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accParent(
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accRole(
- VARIANT var_id, VARIANT* role) {
+STDMETHODIMP ViewAccessibility::get_accRole(VARIANT var_id, VARIANT* role) {
if (!IsValidId(var_id) || !role)
return E_INVALIDARG;
if (!view_)
return E_FAIL;
- ui::AccessibleViewState state;
- view_->GetAccessibleState(&state);
role->vt = VT_I4;
- role->lVal = MSAARole(state.role);
+ role->lVal = MSAARole(view_->GetAccessibleRole());
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accState(
- VARIANT var_id, VARIANT* state) {
+STDMETHODIMP ViewAccessibility::get_accState(VARIANT var_id, VARIANT* state) {
if (!IsValidId(var_id) || !state)
return E_INVALIDARG;
@@ -471,8 +452,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accState(
return S_OK;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accValue(
- VARIANT var_id, BSTR* value) {
+STDMETHODIMP ViewAccessibility::get_accValue(VARIANT var_id, BSTR* value) {
if (!IsValidId(var_id) || !value)
return E_INVALIDARG;
@@ -480,9 +460,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accValue(
return E_FAIL;
// Retrieve the current view's value.
- ui::AccessibleViewState state;
- view_->GetAccessibleState(&state);
- string16 temp_value = state.value;
+ string16 temp_value = view_->GetAccessibleValue();
if (!temp_value.empty()) {
// Return value retrieved.
@@ -498,7 +476,7 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accValue(
// Helper functions.
-bool NativeViewAccessibilityWin::IsNavDirNext(int nav_dir) const {
+bool ViewAccessibility::IsNavDirNext(int nav_dir) const {
if (nav_dir == NAVDIR_RIGHT || nav_dir == NAVDIR_DOWN ||
nav_dir == NAVDIR_NEXT) {
return true;
@@ -506,8 +484,8 @@ bool NativeViewAccessibilityWin::IsNavDirNext(int nav_dir) const {
return false;
}
-bool NativeViewAccessibilityWin::IsValidNav(
- int nav_dir, int start_id, int lower_bound, int upper_bound) const {
+bool ViewAccessibility::IsValidNav(int nav_dir, int start_id, int lower_bound,
+ int upper_bound) const {
if (IsNavDirNext(nav_dir)) {
if ((start_id + 1) > upper_bound) {
return false;
@@ -520,14 +498,13 @@ bool NativeViewAccessibilityWin::IsValidNav(
return true;
}
-bool NativeViewAccessibilityWin::IsValidId(const VARIANT& child) const {
+bool ViewAccessibility::IsValidId(const VARIANT& child) const {
// View accessibility returns an IAccessible for each view so we only support
// the CHILDID_SELF id.
return (VT_I4 == child.vt) && (CHILDID_SELF == child.lVal);
}
-void NativeViewAccessibilityWin::SetState(
- VARIANT* msaa_state, views::View* view) {
+void ViewAccessibility::SetState(VARIANT* msaa_state, views::View* view) {
// Ensure the output param is initialized to zero.
msaa_state->lVal = 0;
@@ -547,32 +524,28 @@ void NativeViewAccessibilityWin::SetState(
msaa_state->lVal |= STATE_SYSTEM_FOCUSED;
// Add on any view-specific states.
- ui::AccessibleViewState view_state;
- view->GetAccessibleState(&view_state);
- msaa_state->lVal |= MSAAState(view_state.state);
+ msaa_state->lVal |= MSAAState(view->GetAccessibleState());
}
// IAccessible functions not supported.
-STDMETHODIMP NativeViewAccessibilityWin::get_accSelection(VARIANT* selected) {
+STDMETHODIMP ViewAccessibility::get_accSelection(VARIANT* selected) {
if (selected)
selected->vt = VT_EMPTY;
return E_NOTIMPL;
}
-STDMETHODIMP NativeViewAccessibilityWin::accSelect(
- LONG flagsSelect, VARIANT var_id) {
+STDMETHODIMP ViewAccessibility::accSelect(LONG flagsSelect, VARIANT var_id) {
return E_NOTIMPL;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accHelp(
- VARIANT var_id, BSTR* help) {
+STDMETHODIMP ViewAccessibility::get_accHelp(VARIANT var_id, BSTR* help) {
if (help)
*help = NULL;
return E_NOTIMPL;
}
-STDMETHODIMP NativeViewAccessibilityWin::get_accHelpTopic(
+STDMETHODIMP ViewAccessibility::get_accHelpTopic(
BSTR* help_file, VARIANT var_id, LONG* topic_id) {
if (help_file) {
*help_file = NULL;
@@ -583,19 +556,17 @@ STDMETHODIMP NativeViewAccessibilityWin::get_accHelpTopic(
return E_NOTIMPL;
}
-STDMETHODIMP NativeViewAccessibilityWin::put_accName(
- VARIANT var_id, BSTR put_name) {
+STDMETHODIMP ViewAccessibility::put_accName(VARIANT var_id, BSTR put_name) {
// Deprecated.
return E_NOTIMPL;
}
-STDMETHODIMP NativeViewAccessibilityWin::put_accValue(
- VARIANT var_id, BSTR put_val) {
+STDMETHODIMP ViewAccessibility::put_accValue(VARIANT var_id, BSTR put_val) {
// Deprecated.
return E_NOTIMPL;
}
-int32 NativeViewAccessibilityWin::MSAAEvent(AccessibilityTypes::Event event) {
+int32 ViewAccessibility::MSAAEvent(AccessibilityTypes::Event event) {
switch (event) {
case AccessibilityTypes::EVENT_ALERT:
return EVENT_SYSTEM_ALERT;
@@ -624,7 +595,7 @@ int32 NativeViewAccessibilityWin::MSAAEvent(AccessibilityTypes::Event event) {
}
}
-int32 NativeViewAccessibilityWin::MSAARole(AccessibilityTypes::Role role) {
+int32 ViewAccessibility::MSAARole(AccessibilityTypes::Role role) {
switch (role) {
case AccessibilityTypes::ROLE_ALERT:
return ROLE_SYSTEM_ALERT;
@@ -689,7 +660,7 @@ return ROLE_SYSTEM_ALERT;
}
}
-int32 NativeViewAccessibilityWin::MSAAState(AccessibilityTypes::State state) {
+int32 ViewAccessibility::MSAAState(AccessibilityTypes::State state) {
int32 msaa_state = 0;
if (state & AccessibilityTypes::STATE_CHECKED)
msaa_state |= STATE_SYSTEM_CHECKED;
@@ -725,7 +696,7 @@ int32 NativeViewAccessibilityWin::MSAAState(AccessibilityTypes::State state) {
}
// static
-HRESULT NativeViewAccessibilityWin::GetNativeIAccessibleInterface(
+HRESULT ViewAccessibility::GetNativeIAccessibleInterface(
views::NativeViewHost* native_host, IAccessible** accessible) {
if (!native_host || !accessible)
return E_INVALIDARG;
@@ -741,7 +712,7 @@ HRESULT NativeViewAccessibilityWin::GetNativeIAccessibleInterface(
}
// static
-HRESULT NativeViewAccessibilityWin::GetNativeIAccessibleInterface(
+HRESULT ViewAccessibility::GetNativeIAccessibleInterface(
HWND native_view_window , IAccessible** accessible) {
if (IsWindow(native_view_window)) {
LRESULT ret = SendMessage(native_view_window, WM_GETOBJECT, 0,
@@ -752,5 +723,3 @@ HRESULT NativeViewAccessibilityWin::GetNativeIAccessibleInterface(
return E_FAIL;
}
-
-} // namespace views
diff --git a/views/accessibility/native_view_accessibility_win.h b/views/accessibility/view_accessibility.h
index 2e947e1..9e2d7b8 100644
--- a/views/accessibility/native_view_accessibility_win.h
+++ b/views/accessibility/view_accessibility.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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 VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_
-#define VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_
+#ifndef VIEWS_ACCESSIBILITY_VIEW_ACCESSIBILITY_H_
+#define VIEWS_ACCESSIBILITY_VIEW_ACCESSIBILITY_H_
#pragma once
#include <atlbase.h>
@@ -12,37 +12,34 @@
#include <oleacc.h>
#include "base/scoped_ptr.h"
-#include "ui/base/accessibility/accessible_view_state.h"
#include "views/controls/native/native_view_host.h"
#include "views/view.h"
-namespace views {
-
////////////////////////////////////////////////////////////////////////////////
//
-// NativeViewAccessibilityWin
+// ViewAccessibility
//
// Class implementing the MSAA IAccessible COM interface for a generic View,
// providing accessibility to be used by screen readers and other assistive
// technology (AT).
//
////////////////////////////////////////////////////////////////////////////////
-class ATL_NO_VTABLE NativeViewAccessibilityWin
+class ATL_NO_VTABLE ViewAccessibility
: public CComObjectRootEx<CComMultiThreadModel>,
public IDispatchImpl<IAccessible, &IID_IAccessible, &LIBID_Accessibility> {
public:
- BEGIN_COM_MAP(NativeViewAccessibilityWin)
+ BEGIN_COM_MAP(ViewAccessibility)
COM_INTERFACE_ENTRY2(IDispatch, IAccessible)
COM_INTERFACE_ENTRY(IAccessible)
END_COM_MAP()
// Create method for view accessibility.
- static scoped_refptr<NativeViewAccessibilityWin> Create(views::View* view);
+ static scoped_refptr<ViewAccessibility> Create(views::View* view);
// Returns the IAccessible interface for a view.
static IAccessible* GetAccessibleForView(views::View* view);
- virtual ~NativeViewAccessibilityWin();
+ virtual ~ViewAccessibility();
void set_view(views::View* view) { view_ = view; }
@@ -115,18 +112,18 @@ class ATL_NO_VTABLE NativeViewAccessibilityWin
// Returns a conversion from the event (as defined in accessibility_types.h)
// to an MSAA event.
- static int32 MSAAEvent(ui::AccessibilityTypes::Event event);
+ static int32 MSAAEvent(AccessibilityTypes::Event event);
// Returns a conversion from the Role (as defined in accessibility_types.h)
// to an MSAA role.
- static int32 MSAARole(ui::AccessibilityTypes::Role role);
+ static int32 MSAARole(AccessibilityTypes::Role role);
// Returns a conversion from the State (as defined in accessibility_types.h)
// to MSAA states set.
- static int32 MSAAState(ui::AccessibilityTypes::State state);
+ static int32 MSAAState(AccessibilityTypes::State state);
private:
- NativeViewAccessibilityWin();
+ ViewAccessibility();
// Determines navigation direction for accNavigate, based on left, up and
// previous being mapped all to previous and right, down, next being mapped
@@ -160,11 +157,9 @@ class ATL_NO_VTABLE NativeViewAccessibilityWin
// Member View needed for view-specific calls.
views::View* view_;
- DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibilityWin);
+ DISALLOW_COPY_AND_ASSIGN(ViewAccessibility);
};
extern const char kViewsNativeHostPropForAccessibility[];
-} // namespace views
-
-#endif // VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_
+#endif // VIEWS_ACCESSIBILITY_VIEW_ACCESSIBILITY_H_