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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/views/accessibility/ax_window_obj_wrapper.h"
6
7 #include "ui/accessibility/ax_node_data.h"
8 #include "ui/aura/window.h"
9 #include "ui/views/accessibility/ax_obj_cache.h"
10 #include "ui/views/widget/widget.h"
11
12 namespace views {
13
14 AXNodeSourceObjWrapper* AXWindowObjWrapper::GetParent() {
15 if (!window_->parent())
16 return NULL;
17
18 return AXObjCache::GetInstance()->GetOrCreate(window_->parent());
19 }
20
21 void AXWindowObjWrapper::GetChildren(
22 std::vector<AXNodeSourceObjWrapper*>* out_children) {
23 aura::Window::Windows children = window_->children();
24 for (size_t i = 0; i < children.size(); ++i) {
25 out_children->push_back(
26 AXObjCache::GetInstance()->GetOrCreate(children[i]));
27 }
28
29 // Also consider any associated widgets as children.
30 Widget* widget = Widget::GetWidgetForNativeView(window_);
31 if (widget)
32 out_children->push_back(AXObjCache::GetInstance()->GetOrCreate(widget));
33 }
34
35 void AXWindowObjWrapper::Serialize(ui::AXNodeData* out_node_data) {
36 out_node_data->id = AXObjCache::GetInstance()->GetID(window_);
37 out_node_data->role = ui::AX_ROLE_WINDOW;
38 out_node_data->location = window_->bounds();
39
40 // 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.
41 out_node_data->AddStringAttribute(
42 ui::AX_ATTR_NAME, window_->name());
43 }
44
45 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698