| 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 } | |
| 437 } | 430 } |
| 438 } | 431 } |
| 439 | 432 |
| 440 void Widget::NotifyNativeViewHierarchyWillChange() { | 433 void Widget::NotifyNativeViewHierarchyWillChange() { |
| 441 FocusManager* focus_manager = GetFocusManager(); | 434 FocusManager* focus_manager = GetFocusManager(); |
| 442 // We are being removed from a window hierarchy. Treat this as | 435 // We are being removed from a window hierarchy. Treat this as |
| 443 // the root_view_ being removed. | 436 // the root_view_ being removed. |
| 444 if (focus_manager) | 437 if (focus_manager) |
| 445 focus_manager->ViewRemoved(root_view_.get()); | 438 focus_manager->ViewRemoved(root_view_.get()); |
| 446 } | 439 } |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 | 1444 |
| 1452 //////////////////////////////////////////////////////////////////////////////// | 1445 //////////////////////////////////////////////////////////////////////////////// |
| 1453 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1446 // internal::NativeWidgetPrivate, NativeWidget implementation: |
| 1454 | 1447 |
| 1455 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1448 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
| 1456 return this; | 1449 return this; |
| 1457 } | 1450 } |
| 1458 | 1451 |
| 1459 } // namespace internal | 1452 } // namespace internal |
| 1460 } // namespace views | 1453 } // namespace views |
| OLD | NEW |