Index: ui/aura/mus/window_tree_host_mus.cc |
diff --git a/ui/aura/mus/window_tree_host_mus.cc b/ui/aura/mus/window_tree_host_mus.cc |
index 880b5411337303eca032392246353ff6255ca7f3..2c6f3b2dd4321994dd07a7f0c902d7e939ed1945 100644 |
--- a/ui/aura/mus/window_tree_host_mus.cc |
+++ b/ui/aura/mus/window_tree_host_mus.cc |
@@ -10,6 +10,7 @@ |
#include "ui/aura/mus/window_port_mus.h" |
#include "ui/aura/mus/window_tree_client.h" |
#include "ui/aura/mus/window_tree_host_mus_delegate.h" |
+#include "ui/aura/mus/window_tree_host_mus_init_params.h" |
#include "ui/aura/window.h" |
#include "ui/aura/window_event_dispatcher.h" |
#include "ui/base/class_property.h" |
@@ -38,29 +39,22 @@ bool IsUsingTestContext() { |
//////////////////////////////////////////////////////////////////////////////// |
// WindowTreeHostMus, public: |
-WindowTreeHostMus::WindowTreeHostMus( |
- std::unique_ptr<WindowPortMus> window_port, |
- WindowTreeClient* window_tree_client, |
- int64_t display_id, |
- const cc::FrameSinkId& frame_sink_id, |
- const std::map<std::string, std::vector<uint8_t>>* properties) |
- : WindowTreeHostPlatform(std::move(window_port)), |
- display_id_(display_id), |
- delegate_(window_tree_client) { |
+WindowTreeHostMus::WindowTreeHostMus(WindowTreeHostMusInitParams init_params) |
+ : WindowTreeHostPlatform(std::move(init_params.window_port)), |
+ display_id_(init_params.display_id), |
+ delegate_(init_params.window_tree_client) { |
window()->SetProperty(kWindowTreeHostMusKey, this); |
// TODO(sky): find a cleaner way to set this! Better solution is to likely |
// have constructor take aura::Window. |
WindowPortMus* window_mus = WindowPortMus::Get(window()); |
window_mus->window_ = window(); |
- if (properties) { |
- // Apply the properties before initializing the window, that way the |
- // server seems them at the time the window is created. |
- for (auto& pair : *properties) |
- window_mus->SetPropertyFromServer(pair.first, &pair.second); |
- } |
+ // Apply the properties before initializing the window, that way the server |
+ // seems them at the time the window is created. |
+ for (auto& pair : init_params.properties) |
+ window_mus->SetPropertyFromServer(pair.first, &pair.second); |
// TODO(fsamuel): Once the display compositor is decoupled from the browser |
// process then ui::Compositor will not a cc::FrameSinkId. |
- CreateCompositor(frame_sink_id); |
+ CreateCompositor(init_params.frame_sink_id); |
gfx::AcceleratedWidget accelerated_widget; |
if (IsUsingTestContext()) { |
accelerated_widget = gfx::kNullAcceleratedWidget; |
@@ -81,12 +75,13 @@ WindowTreeHostMus::WindowTreeHostMus( |
delegate_->OnWindowTreeHostCreated(this); |
- SetPlatformWindow(base::MakeUnique<ui::StubWindow>( |
- this, |
- false)); // Do not advertise accelerated widget; already set manually. |
+ // Do not advertise accelerated widget; already set manually. |
+ const bool use_default_accelerated_widget = false; |
+ SetPlatformWindow( |
+ base::MakeUnique<ui::StubWindow>(this, use_default_accelerated_widget)); |
input_method_ = base::MakeUnique<InputMethodMus>(this, window()); |
- input_method_->Init(window_tree_client->connector()); |
+ input_method_->Init(init_params.window_tree_client->connector()); |
SetSharedInputMethod(input_method_.get()); |
compositor()->SetHostHasTransparentBackground(true); |
@@ -94,25 +89,9 @@ WindowTreeHostMus::WindowTreeHostMus( |
// Mus windows are assumed hidden. |
compositor()->SetVisible(false); |
- if (frame_sink_id.is_valid()) |
- window_mus->SetFrameSinkIdFromServer(frame_sink_id); |
-} |
- |
-// Pass |properties| to CreateWindowPortForTopLevel() so that |properties| |
-// are passed to the server *and* pass |properties| to the WindowTreeHostMus |
-// constructor (above) which applies the properties to the Window. Some of the |
-// properties may be server specific and not applied to the Window. |
-WindowTreeHostMus::WindowTreeHostMus( |
- WindowTreeClient* window_tree_client, |
- const cc::FrameSinkId& frame_sink_id, |
- const std::map<std::string, std::vector<uint8_t>>* properties) |
- : WindowTreeHostMus( |
- static_cast<WindowTreeHostMusDelegate*>(window_tree_client) |
- ->CreateWindowPortForTopLevel(properties), |
- window_tree_client, |
- display::Screen::GetScreen()->GetPrimaryDisplay().id(), |
- frame_sink_id, |
- properties) {} |
+ if (init_params.frame_sink_id.is_valid()) |
+ window_mus->SetFrameSinkIdFromServer(init_params.frame_sink_id); |
+} |
WindowTreeHostMus::~WindowTreeHostMus() { |
DestroyCompositor(); |