summaryrefslogtreecommitdiffstats
path: root/views/widget/root_view.cc
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-19 23:08:41 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-19 23:08:41 +0000
commit42c35a5997f5b11522ee308c19d334146ac6895a (patch)
treecb46a30551e8eb5112a6c6ba4d9a9284e2dedcfe /views/widget/root_view.cc
parenta109d02492863aeb537dea09bfb445eb6f5d94c5 (diff)
downloadchromium_src-42c35a5997f5b11522ee308c19d334146ac6895a.zip
chromium_src-42c35a5997f5b11522ee308c19d334146ac6895a.tar.gz
chromium_src-42c35a5997f5b11522ee308c19d334146ac6895a.tar.bz2
Reverting 18872.
Broke the Windows build. BUG=None TEST=None TBR=ben Review URL: http://codereview.chromium.org/140023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18873 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget/root_view.cc')
-rw-r--r--views/widget/root_view.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc
index 751786a..367c720 100644
--- a/views/widget/root_view.cc
+++ b/views/widget/root_view.cc
@@ -46,7 +46,7 @@ class PaintTask : public Task {
// The target root view.
RootView* root_view_;
- DISALLOW_COPY_AND_ASSIGN(PaintTask);
+ DISALLOW_EVIL_CONSTRUCTORS(PaintTask);
};
const char RootView::kViewClassName[] = "views/RootView";
@@ -262,11 +262,23 @@ void RootView::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
default_keyboard_handler_ = NULL;
}
- FocusManager* focus_manager = widget_->GetFocusManager();
- // An unparanted RootView does not have a FocusManager.
- if (focus_manager)
+ // For a given widget hierarchy, focus is tracked by a FocusManager attached
+ // to our nearest enclosing Window. <-- Important Assumption!
+ // We may not have access to our window if this function is called as a
+ // result of teardown during the deletion of the RootView and its hierarchy,
+ // so we don't bother notifying the FocusManager in that case because it
+ // will have already been destroyed (the Widget that contains us is
+ // NCDESTROY'ed which in turn destroys the focus manager _before_ the
+ // RootView is deleted.)
+#if defined(OS_WIN)
+ Window* window = GetWindow();
+ if (window) {
+ FocusManager* focus_manager =
+ FocusManager::GetFocusManager(window->GetNativeWindow());
focus_manager->ViewRemoved(parent, child);
+ }
ViewStorage::GetSharedInstance()->ViewRemoved(parent, child);
+#endif
}
}
@@ -509,6 +521,7 @@ void RootView::OnWidgetDestroyed() {
// TODO(port): Port RootViewDropTarget and this goes away.
NOTIMPLEMENTED();
#endif
+ widget_ = NULL;
}
void RootView::ProcessMouseDragCanceled() {