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 "ui/accessibility/ax_node_data.h" | 7 #include "ui/accessibility/ax_node_data.h" |
8 #include "ui/views/accessibility/ax_aura_obj_cache.h" | 8 #include "ui/views/accessibility/ax_aura_obj_cache.h" |
9 #include "ui/views/accessibility/ax_aura_obj_wrapper.h" | 9 #include "ui/views/accessibility/ax_aura_obj_wrapper.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 | 13 |
14 AXWidgetObjWrapper::AXWidgetObjWrapper(Widget* widget) : widget_(widget) { | 14 AXWidgetObjWrapper::AXWidgetObjWrapper(Widget* widget) : widget_(widget) { |
15 widget->AddObserver(this); | 15 widget->AddObserver(this); |
16 widget->AddRemovalsObserver(this); | 16 widget->AddRemovalsObserver(this); |
17 } | 17 } |
18 | 18 |
19 AXWidgetObjWrapper::~AXWidgetObjWrapper() { | 19 AXWidgetObjWrapper::~AXWidgetObjWrapper() { |
20 widget_->RemoveObserver(this); | 20 if (!AXAuraObjCache::GetInstance()->is_destroying()) { |
21 widget_->RemoveRemovalsObserver(this); | 21 widget_->RemoveObserver(this); |
| 22 widget_->RemoveRemovalsObserver(this); |
| 23 } |
22 widget_ = NULL; | 24 widget_ = NULL; |
23 } | 25 } |
24 | 26 |
25 AXAuraObjWrapper* AXWidgetObjWrapper::GetParent() { | 27 AXAuraObjWrapper* AXWidgetObjWrapper::GetParent() { |
26 return AXAuraObjCache::GetInstance()->GetOrCreate(widget_->GetNativeView()); | 28 return AXAuraObjCache::GetInstance()->GetOrCreate(widget_->GetNativeView()); |
27 } | 29 } |
28 | 30 |
29 void AXWidgetObjWrapper::GetChildren( | 31 void AXWidgetObjWrapper::GetChildren( |
30 std::vector<AXAuraObjWrapper*>* out_children) { | 32 std::vector<AXAuraObjWrapper*>* out_children) { |
31 out_children->push_back( | 33 out_children->push_back( |
(...skipping 14 matching lines...) Expand all Loading... |
46 | 48 |
47 void AXWidgetObjWrapper::OnWidgetDestroying(Widget* widget) { | 49 void AXWidgetObjWrapper::OnWidgetDestroying(Widget* widget) { |
48 AXAuraObjCache::GetInstance()->Remove(widget); | 50 AXAuraObjCache::GetInstance()->Remove(widget); |
49 } | 51 } |
50 | 52 |
51 void AXWidgetObjWrapper::OnWillRemoveView(Widget* widget, View* view) { | 53 void AXWidgetObjWrapper::OnWillRemoveView(Widget* widget, View* view) { |
52 AXAuraObjCache::GetInstance()->Remove(view); | 54 AXAuraObjCache::GetInstance()->Remove(view); |
53 } | 55 } |
54 | 56 |
55 } // namespace views | 57 } // namespace views |
OLD | NEW |