Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Side by Side Diff: ui/views/controls/native/native_view_host.cc

Issue 10910034: Attempt 2 at: Fixes crash that occured because NativeViewHostAura::Detach was not (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: da fix Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/native/native_view_host.h" 5 #include "ui/views/controls/native/native_view_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "ui/views/controls/native/native_view_host_wrapper.h" 9 #include "ui/views/controls/native/native_view_host_wrapper.h"
10 #include "ui/views/widget/widget.h" 10 #include "ui/views/widget/widget.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 } 174 }
175 175
176 return View::GetNativeViewAccessible(); 176 return View::GetNativeViewAccessible();
177 } 177 }
178 178
179 //////////////////////////////////////////////////////////////////////////////// 179 ////////////////////////////////////////////////////////////////////////////////
180 // NativeViewHost, private: 180 // NativeViewHost, private:
181 181
182 void NativeViewHost::Detach(bool destroyed) { 182 void NativeViewHost::Detach(bool destroyed) {
183 if (native_view_) { 183 if (native_view_) {
184 if (!destroyed)
185 ClearFocus();
184 native_wrapper_->NativeViewDetaching(destroyed); 186 native_wrapper_->NativeViewDetaching(destroyed);
185 native_view_ = NULL; 187 native_view_ = NULL;
186 } 188 }
187 } 189 }
188 190
191 void NativeViewHost::ClearFocus() {
192 FocusManager* focus_manager = GetFocusManager();
193 if (!focus_manager || !focus_manager->GetFocusedView())
194 return;
195
196 Widget::Widgets widgets;
197 Widget::GetAllChildWidgets(native_view(), &widgets);
198 for (Widget::Widgets::iterator i = widgets.begin(); i != widgets.end(); ++i) {
199 focus_manager->ViewRemoved((*i)->GetRootView());
200 if (!focus_manager->GetFocusedView())
201 return;
202 }
203 }
204
205
189 } // namespace views 206 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/native/native_view_host.h ('k') | ui/views/controls/native/native_view_host_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698