Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: ui/views/accessibility/native_view_accessibility.cc

Issue 420653003: MacViews: Accessibility bridge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..631610add93ff53ea6734bd7b39048ea7ca75bdf 100644
--- a/ui/views/accessibility/native_view_accessibility.cc
+++ b/ui/views/accessibility/native_view_accessibility.cc
@@ -4,23 +4,32 @@
#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() {
+ ax_node_->Destroy();
}
gfx::NativeViewAccessible NativeViewAccessibility::GetNativeObject() {
- return NULL;
+ return ax_node_->GetNativeViewAccessible();
}
void NativeViewAccessibility::Destroy() {
@@ -37,4 +46,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 >= view_->child_count())
dmazzoni 2014/07/30 05:53:12 Just to be safe, return null if index < 0 also, s
Andre 2014/07/30 18:50:16 Done.
+ 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

Powered by Google App Engine
This is Rietveld 408576698