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

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

Issue 246433012: Extend AXTreeSourceViews to handle aura::Window and views::Widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/ax_window_obj_wrapper.cc
diff --git a/ui/views/accessibility/ax_window_obj_wrapper.cc b/ui/views/accessibility/ax_window_obj_wrapper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ef363fc183f823739b8c90e17521f2eb101bddc5
--- /dev/null
+++ b/ui/views/accessibility/ax_window_obj_wrapper.cc
@@ -0,0 +1,45 @@
+// Copyright 2014 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 "ui/views/accessibility/ax_window_obj_wrapper.h"
+
+#include "ui/accessibility/ax_node_data.h"
+#include "ui/aura/window.h"
+#include "ui/views/accessibility/ax_obj_cache.h"
+#include "ui/views/widget/widget.h"
+
+namespace views {
+
+AXNodeSourceObjWrapper* AXWindowObjWrapper::GetParent() {
+ if (!window_->parent())
+ return NULL;
+
+ return AXObjCache::GetInstance()->GetOrCreate(window_->parent());
+}
+
+void AXWindowObjWrapper::GetChildren(
+ std::vector<AXNodeSourceObjWrapper*>* out_children) {
+ aura::Window::Windows children = window_->children();
+ for (size_t i = 0; i < children.size(); ++i) {
+ out_children->push_back(
+ AXObjCache::GetInstance()->GetOrCreate(children[i]));
+ }
+
+ // Also consider any associated widgets as children.
+ Widget* widget = Widget::GetWidgetForNativeView(window_);
+ if (widget)
+ out_children->push_back(AXObjCache::GetInstance()->GetOrCreate(widget));
+}
+
+void AXWindowObjWrapper::Serialize(ui::AXNodeData* out_node_data) {
+ out_node_data->id = AXObjCache::GetInstance()->GetID(window_);
+ out_node_data->role = ui::AX_ROLE_WINDOW;
+ out_node_data->location = window_->bounds();
+
+ // TODO(dtseng): Window also has title.
dmazzoni 2014/04/23 05:06:44 Hmmm, I think one of the two is just an internal n
David Tseng 2014/04/23 18:20:01 Done.
+ out_node_data->AddStringAttribute(
+ ui::AX_ATTR_NAME, window_->name());
+}
+
+} // namespace views

Powered by Google App Engine
This is Rietveld 408576698