Index: services/ui/ws/window_tree_host_factory.cc |
diff --git a/services/ui/ws/window_tree_host_factory.cc b/services/ui/ws/window_tree_host_factory.cc |
index 1a2170b0a67144aeeaf31f6260afcce47ada1e00..1efbf9b5a429e200be7e13eacc01f56704830a3a 100644 |
--- a/services/ui/ws/window_tree_host_factory.cc |
+++ b/services/ui/ws/window_tree_host_factory.cc |
@@ -4,6 +4,7 @@ |
#include "services/ui/ws/window_tree_host_factory.h" |
+#include "services/ui/display/viewport_metrics.h" |
#include "services/ui/ws/display.h" |
#include "services/ui/ws/display_binding.h" |
#include "services/ui/ws/window_server.h" |
@@ -13,12 +14,7 @@ namespace ws { |
WindowTreeHostFactory::WindowTreeHostFactory(WindowServer* window_server, |
const UserId& user_id) |
- : window_server_(window_server), user_id_(user_id) { |
- platform_display_init_params_.metrics.bounds.set_width(1024); |
- platform_display_init_params_.metrics.bounds.set_height(768); |
- platform_display_init_params_.metrics.pixel_size.SetSize(1024, 768); |
- platform_display_init_params_.metrics.device_scale_factor = 1.0f; |
-} |
+ : window_server_(window_server), user_id_(user_id) {} |
WindowTreeHostFactory::~WindowTreeHostFactory() {} |
@@ -30,11 +26,22 @@ void WindowTreeHostFactory::AddBinding( |
void WindowTreeHostFactory::CreateWindowTreeHost( |
mojom::WindowTreeHostRequest host, |
mojom::WindowTreeClientPtr tree_client) { |
- Display* display = new Display(window_server_); |
+ Display* ws_display = new Display(window_server_); |
+ |
std::unique_ptr<DisplayBindingImpl> display_binding( |
- new DisplayBindingImpl(std::move(host), display, user_id_, |
+ new DisplayBindingImpl(std::move(host), ws_display, user_id_, |
std::move(tree_client), window_server_)); |
- display->Init(platform_display_init_params_, std::move(display_binding)); |
+ |
+ // Provide an initial size for the WindowTreeHost. |
+ display::ViewportMetrics metrics; |
+ metrics.bounds_in_pixels = gfx::Rect(1024, 768); |
+ metrics.device_scale_factor = 1.0f; |
+ metrics.ui_scale_factor = 1.0f; |
+ |
+ display::Display display(1, metrics.bounds_in_pixels); |
+ ws_display->SetDisplay(display); |
+ |
+ ws_display->Init(metrics, std::move(display_binding)); |
} |
} // namespace ws |