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

Unified Diff: ui/views/mus/native_widget_mus.cc

Issue 2010083002: views/mus: Run some more tests from views_unittests in mus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/mus/BUILD.gn ('k') | ui/views/mus/unittests_manifest.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/native_widget_mus.cc
diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc
index 954d454c380994d238d5f88d72c2bf7443762cf6..8c882176eaea533f57f34cf8d633eca373f21dc4 100644
--- a/ui/views/mus/native_widget_mus.cc
+++ b/ui/views/mus/native_widget_mus.cc
@@ -27,6 +27,8 @@
#include "ui/aura/window_property.h"
#include "ui/base/hit_test.h"
#include "ui/base/view_prop.h"
+#include "ui/display/display.h"
+#include "ui/display/screen.h"
#include "ui/events/event.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/path.h"
@@ -839,6 +841,12 @@ void NativeWidgetMus::CenterWindow(const gfx::Size& size) {
// TODO(beng): clear user-placed property and set preferred size property.
window_->SetSharedProperty<gfx::Size>(
mus::mojom::WindowManager::kPreferredSize_Property, size);
+
+ gfx::Rect bounds = display::Screen::GetScreen()
+ ->GetDisplayNearestWindow(content_)
+ .work_area();
+ bounds.ClampToCenteredSize(size);
+ window_->SetBounds(bounds);
}
void NativeWidgetMus::GetWindowPlacement(
« no previous file with comments | « ui/views/mus/BUILD.gn ('k') | ui/views/mus/unittests_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698