diff options
Diffstat (limited to 'views/controls')
-rw-r--r-- | views/controls/native/native_view_host.cc | 12 | ||||
-rw-r--r-- | views/controls/native/native_view_host_win.cc | 29 | ||||
-rw-r--r-- | views/controls/tabbed_pane/native_tabbed_pane_gtk.cc | 6 |
3 files changed, 22 insertions, 25 deletions
diff --git a/views/controls/native/native_view_host.cc b/views/controls/native/native_view_host.cc index 162b1f6..9b6dff2 100644 --- a/views/controls/native/native_view_host.cc +++ b/views/controls/native/native_view_host.cc @@ -8,7 +8,7 @@ #include "ui/gfx/canvas.h" #include "views/controls/native/native_view_host_wrapper.h" #include "views/controls/native/native_view_host_views.h" -#include "views/widget/native_widget.h" +#include "views/widget/root_view.h" #include "views/widget/widget.h" namespace views { @@ -188,12 +188,12 @@ bool NativeViewHost::ContainsNativeView(gfx::NativeView native_view) const { if (!native_view_) return false; - views::NativeWidget* native_widget = - views::NativeWidget::GetNativeWidgetForNativeView(native_view_); - if (native_widget && - native_widget->GetWidget()->ContainsNativeView(native_view)) { + views::Widget* native_widget = + views::Widget::GetWidgetFromNativeView(native_view_); + views::RootView* root_view = + native_widget ? native_widget->GetRootView() : NULL; + if (root_view && root_view->ContainsNativeView(native_view)) return true; - } return View::ContainsNativeView(native_view); } diff --git a/views/controls/native/native_view_host_win.cc b/views/controls/native/native_view_host_win.cc index dbb8461..88feac7 100644 --- a/views/controls/native/native_view_host_win.cc +++ b/views/controls/native/native_view_host_win.cc @@ -8,7 +8,6 @@ #include "ui/gfx/canvas.h" #include "views/controls/native/native_view_host.h" #include "views/focus/focus_manager.h" -#include "views/widget/native_widget.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" @@ -38,13 +37,13 @@ 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 can adjust focus. - NativeWidget::NativeWidgets widgets; - NativeWidget::GetAllNativeWidgets(host_->native_view(), &widgets); - for (NativeWidget::NativeWidgets::iterator it = widgets.begin(); - it != widgets.end(); ++it) { - (*it)->GetWidget()->GetRootView()->NotifyNativeViewHierarchyChanged( - true, + // 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()); } } @@ -53,13 +52,13 @@ void NativeViewHostWin::NativeViewDetaching(bool destroyed) { if (!destroyed && installed_clip_) UninstallClip(); installed_clip_ = false; - // Notify children that parent is removed. - NativeWidget::NativeWidgets widgets; - NativeWidget::GetAllNativeWidgets(host_->native_view(), &widgets); - for (NativeWidget::NativeWidgets::iterator it = widgets.begin(); - it != widgets.end(); ++it) { - (*it)->GetWidget()->GetRootView()->NotifyNativeViewHierarchyChanged( - 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()); } } diff --git a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc index 50b62c6..02d5fe6 100644 --- a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc +++ b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc @@ -64,8 +64,7 @@ View* NativeTabbedPaneGtk::RemoveTabAtIndex(int index) { GtkWidget* page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(native_view()), index); - WidgetGtk* widget = - static_cast<WidgetGtk*>(NativeWidget::GetNativeWidgetForNativeView(page)); + WidgetGtk* widget = WidgetGtk::GetViewForNative(page); // detach the content view from widget so that we can delete widget // without destroying the content view. @@ -195,8 +194,7 @@ WidgetGtk* NativeTabbedPaneGtk::GetWidgetAt(int index) { DCHECK(index <= GetTabCount()); GtkWidget* page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(native_view()), index); - WidgetGtk* widget = - static_cast<WidgetGtk*>(NativeWidget::GetNativeWidgetForNativeView(page)); + WidgetGtk* widget = WidgetGtk::GetViewForNative(page); DCHECK(widget); return widget; } |