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

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
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 d7b679fcefe2ebf703cd312a88d8b84a229a803c..5894878bec291904479f6cc3dd4b8e4786f065d6 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"
@@ -817,6 +819,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);
+ content_->SetBounds(bounds);
sky 2016/06/08 04:25:02 This makes me nervous. Setting the bounds of the c
sadrul 2016/06/08 14:57:42 Done.
}
void NativeWidgetMus::GetWindowPlacement(

Powered by Google App Engine
This is Rietveld 408576698