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

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: Move files from c/b/u/views/accessibility to c/b/u/ash/accessibility Created 6 years, 7 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
« no previous file with comments | « ui/views/accessibility/ax_window_obj_wrapper.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/strings/utf_string_conversions.h"
8 #include "ui/accessibility/ax_node_data.h"
9 #include "ui/aura/window.h"
10 #include "ui/views/accessibility/ax_aura_obj_cache.h"
11 #include "ui/views/widget/widget.h"
12
13 namespace views {
14
15 AXWindowObjWrapper::AXWindowObjWrapper(
16 aura::Window* window) : window_(window) {
17 window->AddObserver(this);
18 }
19
20 AXWindowObjWrapper::~AXWindowObjWrapper() {
21 window_->RemoveObserver(this);
22 window_ = NULL;
23 }
24
25 AXAuraObjWrapper* AXWindowObjWrapper::GetParent() {
26 if (!window_->parent())
27 return NULL;
28
29 return AXAuraObjCache::GetInstance()->GetOrCreate(window_->parent());
30 }
31
32 void AXWindowObjWrapper::GetChildren(
33 std::vector<AXAuraObjWrapper*>* out_children) {
34 aura::Window::Windows children = window_->children();
35 for (size_t i = 0; i < children.size(); ++i) {
36 out_children->push_back(
37 AXAuraObjCache::GetInstance()->GetOrCreate(children[i]));
38 }
39
40 // Also consider any associated widgets as children.
41 Widget* widget = Widget::GetWidgetForNativeView(window_);
42 if (widget)
43 out_children->push_back(AXAuraObjCache::GetInstance()->GetOrCreate(widget));
44 }
45
46 void AXWindowObjWrapper::Serialize(ui::AXNodeData* out_node_data) {
47 out_node_data->id = GetID();
48 out_node_data->role = ui::AX_ROLE_WINDOW;
49 // TODO(dtseng): Set better states.
50 out_node_data->state = 0;
51 out_node_data->location = window_->bounds();
52 out_node_data->AddStringAttribute(
53 ui::AX_ATTR_NAME, base::UTF16ToUTF8(window_->title()));
54 }
55
56 int32 AXWindowObjWrapper::GetID() {
57 return AXAuraObjCache::GetInstance()->GetID(window_);
58 }
59
60 void AXWindowObjWrapper::OnWindowDestroying(aura::Window* window) {
61 AXAuraObjCache::GetInstance()->Remove(window);
62 }
63
64 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/accessibility/ax_window_obj_wrapper.h ('k') | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698