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_view_obj_wrapper.h" | 5 #include "ui/views/accessibility/ax_view_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/accessibility/ax_view_state.h" | 9 #include "ui/accessibility/ax_view_state.h" |
10 #include "ui/views/accessibility/ax_aura_obj_cache.h" | 10 #include "ui/views/accessibility/ax_aura_obj_cache.h" |
11 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
12 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 | 15 |
16 AXViewObjWrapper::AXViewObjWrapper(View* view) : view_(view) { | 16 AXViewObjWrapper::AXViewObjWrapper(View* view) : view_(view) { |
17 DCHECK(view->GetWidget()); | |
18 if (view->GetWidget()) | 17 if (view->GetWidget()) |
19 AXAuraObjCache::GetInstance()->GetOrCreate(view->GetWidget()); | 18 AXAuraObjCache::GetInstance()->GetOrCreate(view->GetWidget()); |
20 } | 19 } |
21 | 20 |
22 AXViewObjWrapper::~AXViewObjWrapper() {} | 21 AXViewObjWrapper::~AXViewObjWrapper() {} |
23 | 22 |
24 AXAuraObjWrapper* AXViewObjWrapper::GetParent() { | 23 AXAuraObjWrapper* AXViewObjWrapper::GetParent() { |
25 AXAuraObjCache* cache = AXAuraObjCache::GetInstance(); | 24 AXAuraObjCache* cache = AXAuraObjCache::GetInstance(); |
26 if (view_->parent()) | 25 if (view_->parent()) |
27 return cache->GetOrCreate(view_->parent()); | 26 return cache->GetOrCreate(view_->parent()); |
28 | 27 |
29 return cache->GetOrCreate(view_->GetWidget()); | 28 if (view_->GetWidget()) |
| 29 return cache->GetOrCreate(view_->GetWidget()); |
| 30 |
| 31 return NULL; |
30 } | 32 } |
31 | 33 |
32 void AXViewObjWrapper::GetChildren( | 34 void AXViewObjWrapper::GetChildren( |
33 std::vector<AXAuraObjWrapper*>* out_children) { | 35 std::vector<AXAuraObjWrapper*>* out_children) { |
34 // TODO(dtseng): Need to handle |Widget| child of |View|. | 36 // TODO(dtseng): Need to handle |Widget| child of |View|. |
35 for (int i = 0; i < view_->child_count(); ++i) { | 37 for (int i = 0; i < view_->child_count(); ++i) { |
36 AXAuraObjWrapper* child = | 38 AXAuraObjWrapper* child = |
37 AXAuraObjCache::GetInstance()->GetOrCreate(view_->child_at(i)); | 39 AXAuraObjCache::GetInstance()->GetOrCreate(view_->child_at(i)); |
38 out_children->push_back(child); | 40 out_children->push_back(child); |
39 } | 41 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 88 |
87 void AXViewObjWrapper::MakeVisible() { | 89 void AXViewObjWrapper::MakeVisible() { |
88 // TODO(dtseng): Implement. | 90 // TODO(dtseng): Implement. |
89 } | 91 } |
90 | 92 |
91 void AXViewObjWrapper::SetSelection(int32 start, int32 end) { | 93 void AXViewObjWrapper::SetSelection(int32 start, int32 end) { |
92 // TODO(dtseng): Implement. | 94 // TODO(dtseng): Implement. |
93 } | 95 } |
94 | 96 |
95 } // namespace views | 97 } // namespace views |
OLD | NEW |