| Index: ui/views/controls/native/native_view_host.cc
|
| diff --git a/ui/views/controls/native/native_view_host.cc b/ui/views/controls/native/native_view_host.cc
|
| index 3accab5ed8427bcf536fa78ac7f6309cd471f2e4..e75d779e1cfb069ec30bca343b48b171cba3412e 100644
|
| --- a/ui/views/controls/native/native_view_host.cc
|
| +++ b/ui/views/controls/native/native_view_host.cc
|
| @@ -181,9 +181,26 @@ gfx::NativeViewAccessible NativeViewHost::GetNativeViewAccessible() {
|
|
|
| void NativeViewHost::Detach(bool destroyed) {
|
| if (native_view_) {
|
| + if (!destroyed)
|
| + ClearFocus();
|
| native_wrapper_->NativeViewDetaching(destroyed);
|
| native_view_ = NULL;
|
| }
|
| }
|
|
|
| +void NativeViewHost::ClearFocus() {
|
| + FocusManager* focus_manager = GetFocusManager();
|
| + if (!focus_manager || !focus_manager->GetFocusedView())
|
| + return;
|
| +
|
| + Widget::Widgets widgets;
|
| + Widget::GetAllChildWidgets(native_view(), &widgets);
|
| + for (Widget::Widgets::iterator i = widgets.begin(); i != widgets.end(); ++i) {
|
| + focus_manager->ViewRemoved((*i)->GetRootView());
|
| + if (!focus_manager->GetFocusedView())
|
| + return;
|
| + }
|
| +}
|
| +
|
| +
|
| } // namespace views
|
|
|