OLD | NEW |
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/base/cursor/cursor.h" | 8 #include "ui/base/cursor/cursor.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/views/accessibility/native_view_accessibility.h" | 10 #include "ui/views/accessibility/native_view_accessibility.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 void NativeViewHost::Attach(gfx::NativeView native_view) { | 33 void NativeViewHost::Attach(gfx::NativeView native_view) { |
34 DCHECK(native_view); | 34 DCHECK(native_view); |
35 DCHECK(!native_view_); | 35 DCHECK(!native_view_); |
36 native_view_ = native_view; | 36 native_view_ = native_view; |
37 // If set_focus_view() has not been invoked, this view is the one that should | 37 // If set_focus_view() has not been invoked, this view is the one that should |
38 // be seen as focused when the native view receives focus. | 38 // be seen as focused when the native view receives focus. |
39 if (!focus_view_) | 39 if (!focus_view_) |
40 focus_view_ = this; | 40 focus_view_ = this; |
41 native_wrapper_->NativeViewWillAttach(); | 41 native_wrapper_->AttachNativeView(); |
42 Widget::ReparentNativeView(native_view_, GetWidget()->GetNativeView()); | |
43 Layout(); | 42 Layout(); |
44 | 43 |
45 Widget* widget = Widget::GetWidgetForNativeView(native_view); | 44 Widget* widget = Widget::GetWidgetForNativeView(native_view); |
46 if (widget) | 45 if (widget) |
47 widget->SetNativeWindowProperty(kWidgetNativeViewHostKey, this); | 46 widget->SetNativeWindowProperty(kWidgetNativeViewHostKey, this); |
48 } | 47 } |
49 | 48 |
50 void NativeViewHost::Detach() { | 49 void NativeViewHost::Detach() { |
51 Detach(false); | 50 Detach(false); |
52 } | 51 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 Widget::Widgets widgets; | 214 Widget::Widgets widgets; |
216 Widget::GetAllChildWidgets(native_view(), &widgets); | 215 Widget::GetAllChildWidgets(native_view(), &widgets); |
217 for (Widget::Widgets::iterator i = widgets.begin(); i != widgets.end(); ++i) { | 216 for (Widget::Widgets::iterator i = widgets.begin(); i != widgets.end(); ++i) { |
218 focus_manager->ViewRemoved((*i)->GetRootView()); | 217 focus_manager->ViewRemoved((*i)->GetRootView()); |
219 if (!focus_manager->GetFocusedView()) | 218 if (!focus_manager->GetFocusedView()) |
220 return; | 219 return; |
221 } | 220 } |
222 } | 221 } |
223 | 222 |
224 } // namespace views | 223 } // namespace views |
OLD | NEW |