OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/accessibility/ax_widget_obj_wrapper.h" | 5 #include "ui/views/accessibility/ax_widget_obj_wrapper.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/accessibility/ax_node_data.h" | 8 #include "ui/accessibility/ax_node_data.h" |
9 #include "ui/views/accessibility/ax_aura_obj_cache.h" | 9 #include "ui/views/accessibility/ax_aura_obj_cache.h" |
10 #include "ui/views/accessibility/ax_aura_obj_wrapper.h" | 10 #include "ui/views/accessibility/ax_aura_obj_wrapper.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 } | 25 } |
26 widget_ = NULL; | 26 widget_ = NULL; |
27 } | 27 } |
28 | 28 |
29 AXAuraObjWrapper* AXWidgetObjWrapper::GetParent() { | 29 AXAuraObjWrapper* AXWidgetObjWrapper::GetParent() { |
30 return AXAuraObjCache::GetInstance()->GetOrCreate(widget_->GetNativeView()); | 30 return AXAuraObjCache::GetInstance()->GetOrCreate(widget_->GetNativeView()); |
31 } | 31 } |
32 | 32 |
33 void AXWidgetObjWrapper::GetChildren( | 33 void AXWidgetObjWrapper::GetChildren( |
34 std::vector<AXAuraObjWrapper*>* out_children) { | 34 std::vector<AXAuraObjWrapper*>* out_children) { |
35 if (!widget_->IsVisible() || !widget_->GetRootView()->visible()) | 35 if (!widget_->IsVisible() || !widget_->GetRootView() || |
36 !widget_->GetRootView()->visible()) { | |
sadrul
2017/02/02 17:15:31
It'd be better to move this into a separate CL wit
yiyix
2017/02/06 21:36:17
I will submit a separate cl for this change. Remov
| |
36 return; | 37 return; |
37 | 38 } |
38 out_children->push_back( | 39 out_children->push_back( |
39 AXAuraObjCache::GetInstance()->GetOrCreate(widget_->GetRootView())); | 40 AXAuraObjCache::GetInstance()->GetOrCreate(widget_->GetRootView())); |
40 } | 41 } |
41 | 42 |
42 void AXWidgetObjWrapper::Serialize(ui::AXNodeData* out_node_data) { | 43 void AXWidgetObjWrapper::Serialize(ui::AXNodeData* out_node_data) { |
43 out_node_data->id = GetID(); | 44 out_node_data->id = GetID(); |
44 out_node_data->role = widget_->widget_delegate()->GetAccessibleWindowRole(); | 45 out_node_data->role = widget_->widget_delegate()->GetAccessibleWindowRole(); |
45 out_node_data->AddStringAttribute( | 46 out_node_data->AddStringAttribute( |
46 ui::AX_ATTR_NAME, | 47 ui::AX_ATTR_NAME, |
47 base::UTF16ToUTF8( | 48 base::UTF16ToUTF8( |
(...skipping 18 matching lines...) Expand all Loading... | |
66 // If a widget changes visibility it may affect what's focused, in particular | 67 // If a widget changes visibility it may affect what's focused, in particular |
67 // when a widget that contains the focused view gets hidden. | 68 // when a widget that contains the focused view gets hidden. |
68 AXAuraObjCache::GetInstance()->OnFocusedViewChanged(); | 69 AXAuraObjCache::GetInstance()->OnFocusedViewChanged(); |
69 } | 70 } |
70 | 71 |
71 void AXWidgetObjWrapper::OnWillRemoveView(Widget* widget, View* view) { | 72 void AXWidgetObjWrapper::OnWillRemoveView(Widget* widget, View* view) { |
72 AXAuraObjCache::GetInstance()->RemoveViewSubtree(view); | 73 AXAuraObjCache::GetInstance()->RemoveViewSubtree(view); |
73 } | 74 } |
74 | 75 |
75 } // namespace views | 76 } // namespace views |
OLD | NEW |