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

Side by Side Diff: ui/views/accessibility/ax_widget_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: Reset serializer on enable. 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
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_widget_obj_wrapper.h"
6
7 #include "ui/accessibility/ax_node_data.h"
8 #include "ui/views/accessibility/ax_aura_obj_cache.h"
9 #include "ui/views/accessibility/ax_aura_obj_wrapper.h"
10 #include "ui/views/widget/widget.h"
11
12 namespace views {
13
14 AXWidgetObjWrapper::AXWidgetObjWrapper(Widget* widget) : widget_(widget) {
15 widget->AddObserver(this);
16 widget->AddRemovalsObserver(this);
17 }
18
19 AXWidgetObjWrapper::~AXWidgetObjWrapper() {
20 widget_->RemoveObserver(this);
21 widget_->RemoveRemovalsObserver(this);
22 widget_ = NULL;
23 }
24
25 AXAuraObjWrapper* AXWidgetObjWrapper::GetParent() {
26 return AXAuraObjCache::GetInstance()->GetOrCreate(widget_->GetNativeView());
27 }
28
29 void AXWidgetObjWrapper::GetChildren(
30 std::vector<AXAuraObjWrapper*>* out_children) {
31 out_children->push_back(
32 AXAuraObjCache::GetInstance()->GetOrCreate(widget_->GetRootView()));
33 }
34
35 void AXWidgetObjWrapper::Serialize(ui::AXNodeData* out_node_data) {
36 out_node_data->id = GetID();
37 out_node_data->role = ui::AX_ROLE_CLIENT;
38 out_node_data->location = widget_->GetWindowBoundsInScreen();
39 // TODO(dtseng): Set better states.
40 out_node_data->state = 0;
41 }
42
43 int32 AXWidgetObjWrapper::GetID() {
44 return AXAuraObjCache::GetInstance()->GetID(widget_);
45 }
46
47 void AXWidgetObjWrapper::OnWidgetDestroying(Widget* widget) {
48 AXAuraObjCache::GetInstance()->Remove(widget);
49 }
50
51 void AXWidgetObjWrapper::OnWillRemoveView(Widget* widget, View* view) {
aboxhall 2014/04/28 19:50:38 We don't need to do anything with widget here?
David Tseng 2014/04/29 01:35:03 No. Widget destruction is observed via the other m
52 AXAuraObjCache::GetInstance()->Remove(view);
53 }
54
55 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698