| Index: ui/views/controls/native/native_view_host_win.cc
|
| diff --git a/ui/views/controls/native/native_view_host_win.cc b/ui/views/controls/native/native_view_host_win.cc
|
| index 70aca91dd44f2dcd44981acec98bf72a529dfe3a..969fd1438271085f84ecf0d08e9a85cebee90eb5 100644
|
| --- a/ui/views/controls/native/native_view_host_win.cc
|
| +++ b/ui/views/controls/native/native_view_host_win.cc
|
| @@ -7,6 +7,8 @@
|
| #include <oleacc.h>
|
|
|
| #include "base/logging.h"
|
| +#include "ui/base/win/hidden_window.h"
|
| +#include "ui/base/win/window_impl.h"
|
| #include "ui/gfx/canvas.h"
|
| #include "ui/views/controls/native/native_view_host.h"
|
| #include "ui/views/focus/focus_manager.h"
|
| @@ -43,8 +45,12 @@ void NativeViewHostWin::NativeViewAttached() {
|
| }
|
|
|
| void NativeViewHostWin::NativeViewDetaching(bool destroyed) {
|
| - if (!destroyed && installed_clip_)
|
| - UninstallClip();
|
| + if (!destroyed) {
|
| + if (installed_clip_)
|
| + UninstallClip();
|
| + ClearFocus();
|
| + SetParent(host_->native_view(), ui::GetHiddenWindow());
|
| + }
|
| installed_clip_ = false;
|
| }
|
|
|
| @@ -142,6 +148,20 @@ gfx::NativeViewAccessible NativeViewHostWin::GetNativeViewAccessible() {
|
| }
|
| }
|
|
|
| +void NativeViewHostWin::ClearFocus() {
|
| + FocusManager* focus_manager = host_->GetFocusManager();
|
| + if (!focus_manager || !focus_manager->GetFocusedView())
|
| + return;
|
| +
|
| + Widget::Widgets widgets;
|
| + Widget::GetAllChildWidgets(host_->native_view(), &widgets);
|
| + for (Widget::Widgets::iterator i = widgets.begin(); i != widgets.end(); ++i) {
|
| + focus_manager->ViewRemoved((*i)->GetRootView());
|
| + if (!focus_manager->GetFocusedView())
|
| + return;
|
| + }
|
| +}
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // NativeViewHostWrapper, public:
|
|
|
|
|