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

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: 2nd draft, based on 423513005 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..1a460c79f061f82563de14a669012b0fcbe9ed94 100644
--- a/ui/views/accessibility/native_view_accessibility.cc
+++ b/ui/views/accessibility/native_view_accessibility.cc
@@ -4,26 +4,34 @@
#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;
+ return new NativeViewAccessibility(view);
}
#endif
-NativeViewAccessibility::NativeViewAccessibility() {
+NativeViewAccessibility::NativeViewAccessibility(View* view) : view_(view) {
}
NativeViewAccessibility::~NativeViewAccessibility() {
}
gfx::NativeViewAccessible NativeViewAccessibility::GetNativeObject() {
- return NULL;
+ if (!ax_node_)
+ ax_node_.reset(ui::AXPlatformNode::Create(this));
+ return ax_node_->GetNativeViewAccessible();
}
void NativeViewAccessibility::Destroy() {
+ if (ax_node_)
+ ax_node_->Detach();
delete this;
}
@@ -37,4 +45,39 @@ 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) {
+ return view_->child_at(index)->GetNativeViewAccessible();
dmazzoni 2014/07/29 06:35:15 Sanity-check this and return NULL if it's out of b
Andre 2014/07/29 21:58:56 Done.
+}
+
+gfx::NativeViewAccessible NativeViewAccessibility::GetParent() {
+ if (view_->parent())
+ return view_->parent()->GetNativeViewAccessible();
+ else if (view_->GetWidget())
+ return view_->GetWidget()->GetNativeViewAccessible();
+ else
+ return NULL;
+}
+
+gfx::Vector2d NativeViewAccessibility::GetGlobalCoordinateOffset() {
+ return gfx::Vector2d(0, 0); // location is already in screen coordinates.
+}
+
+void NativeViewAccessibility::NotifyAccessibilityEvent(ui::AXEvent event_type) {
+ NOTIMPLEMENTED();
+}
+
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698