OLD | NEW |
---|---|
(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 "chrome/browser/ui/views/accessibility/ax_root_obj_wrapper.h" | |
6 | |
7 #include "ash/shell.h" | |
8 #include "ui/accessibility/ax_node_data.h" | |
9 #include "ui/accessibility/ax_view_state.h" | |
10 #include "ui/aura/window.h" | |
11 #include "ui/views/accessibility/ax_aura_obj_cache.h" | |
12 | |
13 AXRootObjWrapper::AXRootObjWrapper(int32 id) : id_(id) { | |
14 } | |
15 | |
16 AXRootObjWrapper::~AXRootObjWrapper() {} | |
17 | |
18 bool AXRootObjWrapper::HasChild(views::AXAuraObjWrapper* child) { | |
19 std::vector<views::AXAuraObjWrapper*> out_children; | |
aboxhall
2014/04/28 19:50:38
Why is this called out_children? It's never sent o
David Tseng
2014/04/29 01:35:03
I don't have a strong opinion here, but as you not
aboxhall
2014/04/29 02:19:23
I find it confusing, as I would expect out_foo to
| |
20 GetChildren(&out_children); | |
21 return std::find(out_children.begin(), out_children.end(), child) != | |
22 out_children.end(); | |
23 } | |
24 | |
25 views::AXAuraObjWrapper* AXRootObjWrapper::GetParent() { | |
26 return NULL; | |
27 } | |
28 | |
29 void AXRootObjWrapper::GetChildren( | |
30 std::vector<views::AXAuraObjWrapper*>* out_children) { | |
31 aura::Window::Windows children = | |
32 ash::Shell::GetInstance()->GetAllRootWindows(); | |
33 for (size_t i = 0; i < children.size(); ++i) { | |
34 out_children->push_back( | |
35 views::AXAuraObjCache::GetInstance()->GetOrCreate(children[i])); | |
36 } | |
37 } | |
38 | |
39 void AXRootObjWrapper::Serialize(ui::AXNodeData* out_node_data) { | |
40 out_node_data->id = id_; | |
41 out_node_data->role = ui::AX_ROLE_DESKTOP; | |
42 out_node_data->state = 0; | |
aboxhall
2014/04/28 19:50:38
Is |state| not guaranteed to be initialized to 0?
David Tseng
2014/04/29 01:35:03
AXNodeData sets state to -1.
However, the root sh
| |
43 } | |
44 | |
45 int32 AXRootObjWrapper::GetID() { | |
46 return id_; | |
47 } | |
OLD | NEW |