summaryrefslogtreecommitdiffstats
path: root/views/controls/native
diff options
context:
space:
mode:
authorgeorgey@chromium.org <georgey@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-07 00:55:16 +0000
committergeorgey@chromium.org <georgey@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-07 00:55:16 +0000
commitbda9556c63579835dd14055a048f4e2094e7b3f5 (patch)
treef215d883f2ded85f48bc14d27edd4048f12c364b /views/controls/native
parentc83c9e683a9376cea1ef675bfe92f7dbb98d45f5 (diff)
downloadchromium_src-bda9556c63579835dd14055a048f4e2094e7b3f5.zip
chromium_src-bda9556c63579835dd14055a048f4e2094e7b3f5.tar.gz
chromium_src-bda9556c63579835dd14055a048f4e2094e7b3f5.tar.bz2
Addded notification when ancestor gets changed. So windows that lack focus manager, because of being
created on inactive tab, could do the necessary work when focus manager is actually attached. This is relevant for Windows only, but some support functions (FindAllRootViews) could be useful for other architectures as well. BUG=22481 TEST=in the bug Review URL: http://codereview.chromium.org/492025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/native')
-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() {