| Index: ui/views/accessibility/native_view_accessibility.cc
|
| diff --git a/ui/views/accessibility/native_view_accessibility.cc b/ui/views/accessibility/native_view_accessibility.cc
|
| index 577ecfa41c22732485b5708f6786445d370e49a0..6ca7676e6344d0b6339a33f10cea69cf5f19da91 100644
|
| --- a/ui/views/accessibility/native_view_accessibility.cc
|
| +++ b/ui/views/accessibility/native_view_accessibility.cc
|
| @@ -4,23 +4,33 @@
|
|
|
| #include "ui/views/accessibility/native_view_accessibility.h"
|
|
|
| +#include "ui/accessibility/ax_view_state.h"
|
| +#include "ui/views/view.h"
|
| +#include "ui/views/widget/widget.h"
|
| +
|
| namespace views {
|
|
|
| #if !defined(OS_WIN)
|
| // static
|
| NativeViewAccessibility* NativeViewAccessibility::Create(View* view) {
|
| - return NULL;
|
| + DCHECK(view);
|
| + NativeViewAccessibility* instance = new NativeViewAccessibility();
|
| + instance->set_view(view);
|
| + return instance;
|
| }
|
| #endif
|
|
|
| -NativeViewAccessibility::NativeViewAccessibility() {
|
| +NativeViewAccessibility::NativeViewAccessibility()
|
| + : view_(NULL), ax_node_(ui::AXPlatformNode::Create(this)) {
|
| }
|
|
|
| NativeViewAccessibility::~NativeViewAccessibility() {
|
| + if (ax_node_)
|
| + ax_node_->Destroy();
|
| }
|
|
|
| gfx::NativeViewAccessible NativeViewAccessibility::GetNativeObject() {
|
| - return NULL;
|
| + return ax_node_ ? ax_node_->GetNativeViewAccessible() : NULL;
|
| }
|
|
|
| void NativeViewAccessibility::Destroy() {
|
| @@ -37,4 +47,43 @@ void NativeViewAccessibility::UnregisterWebView(View* web_view) {
|
| }
|
| #endif
|
|
|
| +// ui::AXPlatformNodeDelegate
|
| +
|
| +ui::AXNodeData* NativeViewAccessibility::GetData() {
|
| + ui::AXViewState state;
|
| + view_->GetAccessibleState(&state);
|
| + data_.role = state.role;
|
| + data_.location = view_->GetBoundsInScreen();
|
| + return &data_;
|
| +}
|
| +
|
| +int NativeViewAccessibility::GetChildCount() {
|
| + return view_->child_count();
|
| +}
|
| +
|
| +gfx::NativeViewAccessible NativeViewAccessibility::ChildAtIndex(int index) {
|
| + if (index < 0 || index >= view_->child_count())
|
| + return NULL;
|
| + return view_->child_at(index)->GetNativeViewAccessible();
|
| +}
|
| +
|
| +gfx::NativeViewAccessible NativeViewAccessibility::GetParent() {
|
| + if (view_->parent())
|
| + return view_->parent()->GetNativeViewAccessible();
|
| +
|
| +#if defined(OS_MACOSX)
|
| + if (view_->GetWidget())
|
| + return view_->GetWidget()->GetNativeView();
|
| +#endif
|
| +
|
| + return NULL;
|
| +}
|
| +
|
| +gfx::Vector2d NativeViewAccessibility::GetGlobalCoordinateOffset() {
|
| + return gfx::Vector2d(0, 0); // location is already in screen coordinates.
|
| +}
|
| +
|
| +void NativeViewAccessibility::NotifyAccessibilityEvent(ui::AXEvent event_type) {
|
| +}
|
| +
|
| } // namespace views
|
|
|