diff --git a/ash/popup_message_unittest.cc b/ash/popup_message_unittest.cc index 374e0aa5d794e9..369d863a058ab1 100644 --- a/ash/popup_message_unittest.cc +++ b/ash/popup_message_unittest.cc @@ -11,13 +11,13 @@ namespace ash { -typedef test::AshTestBase PopupMessageTest; +using PopupMessageTest = test::AshTestBase; // Verifies the layout of the popup, especially it does not crop the caption and // message text. See http://crbug.com/468494. TEST_F(PopupMessageTest, Layout) { - views::Widget* widget = - views::Widget::CreateWindowWithBounds(nullptr, gfx::Rect(0, 0, 100, 100)); + views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( + nullptr, CurrentContext(), gfx::Rect(0, 0, 100, 100)); PopupMessage message(base::ASCIIToUTF16("caption text"), base::ASCIIToUTF16( "Message text, which will be usually longer than " diff --git a/chrome/browser/ui/views/chrome_web_dialog_view.cc b/chrome/browser/ui/views/chrome_web_dialog_view.cc index 1b824c22928726..09507fa166c1df 100644 --- a/chrome/browser/ui/views/chrome_web_dialog_view.cc +++ b/chrome/browser/ui/views/chrome_web_dialog_view.cc @@ -14,15 +14,11 @@ namespace chrome { gfx::NativeWindow ShowWebDialog(gfx::NativeView parent, content::BrowserContext* context, ui::WebDialogDelegate* delegate) { - views::Widget* widget = NULL; views::WebDialogView* view = new views::WebDialogView(context, delegate, new ChromeWebContentsHandler); - if (parent) { - widget = views::Widget::CreateWindowWithParent(view, parent); - } else { - // We shouldn't be called with a NULL parent, but sometimes are. - widget = views::Widget::CreateWindow(view); - } + // NOTE: The |parent| may be null, which will result in the default window + // placement on Aura. + views::Widget* widget = views::Widget::CreateWindowWithParent(view, parent); // Observer is needed for ChromeVox extension to send messages between content // and background scripts. diff --git a/mash/quick_launch/quick_launch_application.cc b/mash/quick_launch/quick_launch_application.cc index 2b2764b80d4680..b46873785438a2 100644 --- a/mash/quick_launch/quick_launch_application.cc +++ b/mash/quick_launch/quick_launch_application.cc @@ -97,8 +97,8 @@ void QuickLaunchApplication::Initialize(mojo::Connector* connector, aura_init_.reset(new views::AuraInit(connector, "views_mus_resources.pak")); views::WindowManagerConnection::Create(connector); - views::Widget* window = views::Widget::CreateWindowWithBounds( - new QuickLaunchUI(connector), gfx::Rect(10, 640, 0, 0)); + views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( + new QuickLaunchUI(connector), nullptr, gfx::Rect(10, 640, 0, 0)); window->Show(); } diff --git a/mash/task_viewer/task_viewer.cc b/mash/task_viewer/task_viewer.cc index fb5cb1f2575ac9..feeb82cfb78567 100644 --- a/mash/task_viewer/task_viewer.cc +++ b/mash/task_viewer/task_viewer.cc @@ -287,8 +287,8 @@ void TaskViewer::Initialize(mojo::Connector* connector, TaskViewerContents* task_viewer = new TaskViewerContents( std::move(request), std::move(catalog)); - views::Widget* window = views::Widget::CreateWindowWithBounds( - task_viewer, gfx::Rect(10, 10, 500, 500)); + views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( + task_viewer, nullptr, gfx::Rect(10, 10, 500, 500)); window->Show(); } diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index 991bb721eb76a7..7aa845833525d3 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -180,22 +180,6 @@ Widget::~Widget() { } } -// static -Widget* Widget::CreateWindow(WidgetDelegate* delegate) { - return CreateWindowWithBounds(delegate, gfx::Rect()); -} - -// static -Widget* Widget::CreateWindowWithBounds(WidgetDelegate* delegate, - const gfx::Rect& bounds) { - Widget* widget = new Widget; - Widget::InitParams params; - params.bounds = bounds; - params.delegate = delegate; - widget->Init(params); - return widget; -} - // static Widget* Widget::CreateWindowWithParent(WidgetDelegate* delegate, gfx::NativeView parent) { diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h index 2d8be655bde6b7..bbc89db2e07e65 100644 --- a/ui/views/widget/widget.h +++ b/ui/views/widget/widget.h @@ -282,20 +282,6 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, Widget(); ~Widget() override; - // Creates a toplevel window with no context. These methods should only be - // used in cases where there is no contextual information because we're - // creating a toplevel window connected to no other event. - // - // If you have any parenting or context information, or can pass that - // information, prefer the WithParent or WithContext versions of these - // methods. - // - // The returned Widget is owned by its NativeWidget; see Widget class comment - // for details. - static Widget* CreateWindow(WidgetDelegate* delegate); - static Widget* CreateWindowWithBounds(WidgetDelegate* delegate, - const gfx::Rect& bounds); - // Creates a decorated window Widget with the specified properties. The // returned Widget is owned by its NativeWidget; see Widget class comment for // details.