OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/widget/widget.h" | 5 #include "ui/views/widget/widget.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 void Widget::ViewHierarchyChanged( | 420 void Widget::ViewHierarchyChanged( |
421 const View::ViewHierarchyChangedDetails& details) { | 421 const View::ViewHierarchyChangedDetails& details) { |
422 if (!details.is_add) { | 422 if (!details.is_add) { |
423 if (details.child == dragged_view_) | 423 if (details.child == dragged_view_) |
424 dragged_view_ = NULL; | 424 dragged_view_ = NULL; |
425 FocusManager* focus_manager = GetFocusManager(); | 425 FocusManager* focus_manager = GetFocusManager(); |
426 if (focus_manager) | 426 if (focus_manager) |
427 focus_manager->ViewRemoved(details.child); | 427 focus_manager->ViewRemoved(details.child); |
428 ViewStorage::GetInstance()->ViewRemoved(details.child); | 428 ViewStorage::GetInstance()->ViewRemoved(details.child); |
429 native_widget_->ViewRemoved(details.child); | 429 native_widget_->ViewRemoved(details.child); |
| 430 |
| 431 // Many observers do not remove themselves during destruction, so we must |
| 432 // not notify once we destroy our |root_view_|. |
| 433 if (root_view_.get()) { |
| 434 FOR_EACH_OBSERVER( |
| 435 WidgetObserver, observers_, OnViewRemoved(this, details.child)); |
| 436 } |
430 } | 437 } |
431 } | 438 } |
432 | 439 |
433 void Widget::NotifyNativeViewHierarchyWillChange() { | 440 void Widget::NotifyNativeViewHierarchyWillChange() { |
434 FocusManager* focus_manager = GetFocusManager(); | 441 FocusManager* focus_manager = GetFocusManager(); |
435 // We are being removed from a window hierarchy. Treat this as | 442 // We are being removed from a window hierarchy. Treat this as |
436 // the root_view_ being removed. | 443 // the root_view_ being removed. |
437 if (focus_manager) | 444 if (focus_manager) |
438 focus_manager->ViewRemoved(root_view_.get()); | 445 focus_manager->ViewRemoved(root_view_.get()); |
439 } | 446 } |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 | 1445 |
1439 //////////////////////////////////////////////////////////////////////////////// | 1446 //////////////////////////////////////////////////////////////////////////////// |
1440 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1447 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1441 | 1448 |
1442 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1449 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1443 return this; | 1450 return this; |
1444 } | 1451 } |
1445 | 1452 |
1446 } // namespace internal | 1453 } // namespace internal |
1447 } // namespace views | 1454 } // namespace views |
OLD | NEW |