diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-16 17:21:23 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-16 17:21:23 +0000 |
commit | 2f2b57b7e32777e656d4dbbbc04cd914d5b94472 (patch) | |
tree | 9e925e8063d39c06c4edb068d2f3a371ff395589 /views/controls | |
parent | 4e8655deaccc49465a6c18055887d1e0e2501a55 (diff) | |
download | chromium_src-2f2b57b7e32777e656d4dbbbc04cd914d5b94472.zip chromium_src-2f2b57b7e32777e656d4dbbbc04cd914d5b94472.tar.gz chromium_src-2f2b57b7e32777e656d4dbbbc04cd914d5b94472.tar.bz2 |
Re-land:
Move private NativeWidget methods to new internal interface
NativeWidgetPrivate.
This should make it harder to abuse accidentally.
BUG=72040
TEST=none
Review URL: http://codereview.chromium.org/7170019
Review URL: http://codereview.chromium.org/7189012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89357 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
6 files changed, 13 insertions, 19 deletions
diff --git a/views/controls/combobox/native_combobox_views_unittest.cc b/views/controls/combobox/native_combobox_views_unittest.cc index cb18b31..eec8c54 100644 --- a/views/controls/combobox/native_combobox_views_unittest.cc +++ b/views/controls/combobox/native_combobox_views_unittest.cc @@ -9,7 +9,7 @@ #include "views/controls/combobox/native_combobox_views.h" #include "views/ime/mock_input_method.h" #include "views/test/views_test_base.h" -#include "views/widget/native_widget.h" +#include "views/widget/native_widget_private.h" #include "views/widget/widget.h" namespace { @@ -114,7 +114,7 @@ class NativeComboboxViewsTest : public ViewsTestBase { ASSERT_TRUE(combobox_view_); input_method_ = new MockInputMethod(); - widget_->native_widget()->ReplaceInputMethod(input_method_); + widget_->native_widget_private()->ReplaceInputMethod(input_method_); // Assumes the Widget is always focused. input_method_->OnFocus(); diff --git a/views/controls/menu/menu_host.cc b/views/controls/menu/menu_host.cc index 82fd186..57f7707 100644 --- a/views/controls/menu/menu_host.cc +++ b/views/controls/menu/menu_host.cc @@ -9,7 +9,7 @@ #include "views/controls/menu/menu_item_view.h" #include "views/controls/menu/native_menu_host.h" #include "views/controls/menu/submenu_view.h" -#include "views/widget/native_widget.h" +#include "views/widget/native_widget_private.h" #include "views/widget/widget.h" namespace views { @@ -72,8 +72,8 @@ void MenuHost::SetMenuHostBounds(const gfx::Rect& bounds) { } void MenuHost::ReleaseMenuHostCapture() { - if (native_widget()->HasMouseCapture()) - native_widget()->ReleaseMouseCapture(); + if (native_widget_private()->HasMouseCapture()) + native_widget_private()->ReleaseMouseCapture(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/views/controls/native/native_view_host.cc b/views/controls/native/native_view_host.cc index 1b9d74e..1a304a6 100644 --- a/views/controls/native/native_view_host.cc +++ b/views/controls/native/native_view_host.cc @@ -8,7 +8,6 @@ #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/widget.h" namespace views { @@ -190,12 +189,9 @@ 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* widget = views::Widget::GetWidgetForNativeView(native_view); + if (widget && widget->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 b7fa074..52f9373 100644 --- a/views/controls/native/native_view_host_win.cc +++ b/views/controls/native/native_view_host_win.cc @@ -37,8 +37,8 @@ void NativeViewHostWin::NativeViewAttached() { // borders), when we change the parent below. ShowWindow(host_->native_view(), SW_HIDE); - NativeWidget::ReparentNativeView(host_->native_view(), - host_->GetWidget()->GetNativeView()); + Widget::ReparentNativeView(host_->native_view(), + host_->GetWidget()->GetNativeView()); host_->Layout(); } diff --git a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc index 360ad6e..ac3ff19 100644 --- a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc +++ b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc @@ -77,8 +77,7 @@ View* NativeTabbedPaneGtk::RemoveTabAtIndex(int index) { GtkWidget* page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(native_view()), index); - Widget* widget = - NativeWidget::GetNativeWidgetForNativeView(page)->GetWidget(); + Widget* widget = Widget::GetWidgetForNativeView(page); // detach the content view from widget so that we can delete widget // without destroying the content view. @@ -197,8 +196,7 @@ Widget* NativeTabbedPaneGtk::GetWidgetAt(int index) { DCHECK(index <= GetTabCount()); GtkWidget* page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(native_view()), index); - Widget* widget = - NativeWidget::GetNativeWidgetForNativeView(page)->GetWidget(); + Widget* widget = Widget::GetWidgetForNativeView(page); DCHECK(widget); return widget; } diff --git a/views/controls/textfield/native_textfield_views_unittest.cc b/views/controls/textfield/native_textfield_views_unittest.cc index 0c9fd05..190aaae 100644 --- a/views/controls/textfield/native_textfield_views_unittest.cc +++ b/views/controls/textfield/native_textfield_views_unittest.cc @@ -27,7 +27,7 @@ #include "views/test/test_views_delegate.h" #include "views/test/views_test_base.h" #include "views/views_delegate.h" -#include "views/widget/native_widget.h" +#include "views/widget/native_widget_private.h" #include "views/widget/widget.h" namespace { @@ -181,7 +181,7 @@ class NativeTextfieldViewsTest : public ViewsTestBase, model_->ClearEditHistory(); input_method_ = new MockInputMethod(); - widget_->native_widget()->ReplaceInputMethod(input_method_); + widget_->native_widget_private()->ReplaceInputMethod(input_method_); // Assumes the Widget is always focused. input_method_->OnFocus(); |