summaryrefslogtreecommitdiffstats
path: root/views/controls/native/native_view_host_win.cc
diff options
context:
space:
mode:
Diffstat (limited to 'views/controls/native/native_view_host_win.cc')
-rw-r--r--views/controls/native/native_view_host_win.cc20
1 files changed, 19 insertions, 1 deletions
diff --git a/views/controls/native/native_view_host_win.cc b/views/controls/native/native_view_host_win.cc
index 4a8f357..75045ab 100644
--- a/views/controls/native/native_view_host_win.cc
+++ b/views/controls/native/native_view_host_win.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "views/controls/native/native_view_host.h"
#include "views/focus/focus_manager.h"
+#include "views/widget/root_view.h"
#include "views/widget/widget.h"
namespace views {
@@ -25,7 +26,6 @@ NativeViewHostWin::~NativeViewHostWin() {
////////////////////////////////////////////////////////////////////////////////
// NativeViewHostWin, NativeViewHostWrapper implementation:
-
void NativeViewHostWin::NativeViewAttached() {
DCHECK(host_->native_view())
<< "Impossible detatched tab case; See crbug.com/6316";
@@ -37,10 +37,28 @@ void NativeViewHostWin::NativeViewAttached() {
// Need to set the HWND's parent before changing its size to avoid flashing.
SetParent(host_->native_view(), host_->GetWidget()->GetNativeView());
host_->Layout();
+ // Notify children that parent changed, so they could adjust the focus
+ std::vector<RootView*> root_views;
+ Widget::FindAllRootViews(host_->native_view(), &root_views);
+ for (std::vector<RootView*>::iterator it = root_views.begin();
+ it < root_views.end();
+ ++it) {
+ (*it)->NotifyNativeViewHierarchyChanged(true,
+ host_->GetWidget()->GetNativeView());
+ }
}
void NativeViewHostWin::NativeViewDetaching(bool destroyed) {
installed_clip_ = false;
+ // Notify children that parent is removed
+ std::vector<RootView*> root_views;
+ Widget::FindAllRootViews(host_->native_view(), &root_views);
+ for (std::vector<RootView*>::iterator it = root_views.begin();
+ it < root_views.end();
+ ++it) {
+ (*it)->NotifyNativeViewHierarchyChanged(false,
+ host_->GetWidget()->GetNativeView());
+ }
}
void NativeViewHostWin::AddedToWidget() {