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

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

Issue 1615023004: Start of display management for mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix crash and add back getting constants Created 4 years, 11 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/window_manager_connection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/window_manager_connection.cc
diff --git a/ui/views/mus/window_manager_connection.cc b/ui/views/mus/window_manager_connection.cc
index b13c09e931576b0dedf92d707bd40d17f7d42136..defc7e419227c81dfc744de85ba1cd103f3f1abe 100644
--- a/ui/views/mus/window_manager_connection.cc
+++ b/ui/views/mus/window_manager_connection.cc
@@ -15,55 +15,12 @@
#include "mojo/converters/network/network_type_converters.h"
#include "mojo/shell/public/cpp/application_connection.h"
#include "mojo/shell/public/cpp/application_impl.h"
-#include "ui/gfx/display.h"
-#include "ui/gfx/geometry/point_conversions.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/mojo/init/ui_init.h"
#include "ui/views/mus/native_widget_mus.h"
+#include "ui/views/mus/screen_mus.h"
#include "ui/views/mus/window_manager_frame_values.h"
#include "ui/views/views_delegate.h"
-namespace mojo {
-
-gfx::Display::Rotation GFXRotationFromMojomRotation(
- mus::mojom::Rotation input) {
- switch (input) {
- case mus::mojom::Rotation::VALUE_0:
- return gfx::Display::ROTATE_0;
- case mus::mojom::Rotation::VALUE_90:
- return gfx::Display::ROTATE_90;
- case mus::mojom::Rotation::VALUE_180:
- return gfx::Display::ROTATE_180;
- case mus::mojom::Rotation::VALUE_270:
- return gfx::Display::ROTATE_270;
- }
- return gfx::Display::ROTATE_0;
-}
-
-template <>
-struct TypeConverter<gfx::Display, mus::mojom::DisplayPtr> {
- static gfx::Display Convert(const mus::mojom::DisplayPtr& input) {
- gfx::Display result;
- result.set_id(input->id);
- result.SetScaleAndBounds(input->device_pixel_ratio,
- input->bounds.To<gfx::Rect>());
- gfx::Rect work_area(
- gfx::ScaleToFlooredPoint(
- gfx::Point(input->work_area->x, input->work_area->y),
- 1.0f / input->device_pixel_ratio),
- gfx::ScaleToFlooredSize(
- gfx::Size(input->work_area->width, input->work_area->height),
- 1.0f / input->device_pixel_ratio));
- result.set_work_area(work_area);
- result.set_rotation(GFXRotationFromMojomRotation(input->rotation));
- return result;
- }
-};
-
-} // namespace mojo
-
namespace views {
-
namespace {
using WindowManagerConnectionPtr =
@@ -73,14 +30,11 @@ using WindowManagerConnectionPtr =
base::LazyInstance<WindowManagerConnectionPtr>::Leaky lazy_tls_ptr =
LAZY_INSTANCE_INITIALIZER;
-std::vector<gfx::Display> GetDisplaysFromWindowManager(
- mus::mojom::WindowManagerPtr* window_manager) {
+void GetWindowManagerFrameValues(mus::mojom::WindowManagerPtr* window_manager) {
+ // TODO(sky): maybe this should be associated with Display?
WindowManagerFrameValues frame_values;
- std::vector<gfx::Display> displays;
(*window_manager)
- ->GetConfig([&displays,
- &frame_values](mus::mojom::WindowManagerConfigPtr results) {
- displays = results->displays.To<std::vector<gfx::Display>>();
+ ->GetConfig([&frame_values](mus::mojom::WindowManagerConfigPtr results) {
frame_values.normal_insets =
results->normal_client_area_insets.To<gfx::Insets>();
frame_values.maximized_insets =
@@ -90,7 +44,6 @@ std::vector<gfx::Display> GetDisplaysFromWindowManager(
});
CHECK(window_manager->WaitForIncomingResponse());
WindowManagerFrameValues::SetInstance(frame_values);
- return displays;
}
} // namespace
@@ -133,8 +86,10 @@ WindowManagerConnection::WindowManagerConnection(mojo::ApplicationImpl* app)
: app_(app), window_tree_connection_(nullptr) {
app->ConnectToService("mojo:mus", &window_manager_);
- ui_init_.reset(new ui::mojo::UIInit(
- GetDisplaysFromWindowManager(&window_manager_)));
+ GetWindowManagerFrameValues(&window_manager_);
+
+ screen_.reset(new ScreenMus);
+ screen_->Init(app);
ViewsDelegate::GetInstance()->set_native_widget_factory(
base::Bind(&WindowManagerConnection::CreateNativeWidget,
base::Unretained(this)));
« no previous file with comments | « ui/views/mus/window_manager_connection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698