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

Side by Side Diff: ui/views/accessibility/native_view_accessibility.cc

Issue 1287463002: Call RemoveObserver from OnWidgetDestroying (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test Created 5 years, 4 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
« no previous file with comments | « no previous file | ui/views/accessibility/native_view_accessibility_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/native_view_accessibility.h" 5 #include "ui/views/accessibility/native_view_accessibility.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/accessibility/ax_view_state.h" 8 #include "ui/accessibility/ax_view_state.h"
9 #include "ui/events/event_utils.h" 9 #include "ui/events/event_utils.h"
10 #include "ui/views/controls/native/native_view_host.h" 10 #include "ui/views/controls/native/native_view_host.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 ui::AXViewState state; 196 ui::AXViewState state;
197 view_->GetAccessibleState(&state); 197 view_->GetAccessibleState(&state);
198 if (state.set_value_callback.is_null()) 198 if (state.set_value_callback.is_null())
199 return false; 199 return false;
200 200
201 state.set_value_callback.Run(new_value); 201 state.set_value_callback.Run(new_value);
202 return true; 202 return true;
203 } 203 }
204 204
205 void NativeViewAccessibility::OnWidgetDestroying(Widget* widget) { 205 void NativeViewAccessibility::OnWidgetDestroying(Widget* widget) {
206 if (parent_widget_ == widget) 206 if (parent_widget_ == widget) {
207 parent_widget_->RemoveObserver(this);
207 parent_widget_ = nullptr; 208 parent_widget_ = nullptr;
209 }
208 } 210 }
209 211
210 void NativeViewAccessibility::SetParentWidget(Widget* parent_widget) { 212 void NativeViewAccessibility::SetParentWidget(Widget* parent_widget) {
211 if (parent_widget_) 213 if (parent_widget_)
212 parent_widget_->RemoveObserver(this); 214 parent_widget_->RemoveObserver(this);
213 parent_widget_ = parent_widget; 215 parent_widget_ = parent_widget;
214 parent_widget_->AddObserver(this); 216 parent_widget_->AddObserver(this);
215 } 217 }
216 218
217 void NativeViewAccessibility::PopulateChildWidgetVector( 219 void NativeViewAccessibility::PopulateChildWidgetVector(
(...skipping 25 matching lines...) Expand all
243 child_widget_platform_node->GetDelegate()); 245 child_widget_platform_node->GetDelegate());
244 if (child_widget_view_accessibility->parent_widget() != widget) 246 if (child_widget_view_accessibility->parent_widget() != widget)
245 child_widget_view_accessibility->SetParentWidget(widget); 247 child_widget_view_accessibility->SetParentWidget(widget);
246 } 248 }
247 249
248 result_child_widgets->push_back(child_widget); 250 result_child_widgets->push_back(child_widget);
249 } 251 }
250 } 252 }
251 253
252 } // namespace views 254 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/accessibility/native_view_accessibility_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698