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

Unified Diff: ui/aura/mus/window_tree_host_mus.cc

Issue 2823903005: Extracts parameters to WindowTreeHostMus into structure (Closed)
Patch Set: cleanup Created 3 years, 8 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/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..ef12650f19a2e037cac1ef8a3061b7fc253f8314 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"
@@ -39,28 +40,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) {
+ std::unique_ptr<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 +76,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,26 +90,10 @@ WindowTreeHostMus::WindowTreeHostMus(
// Mus windows are assumed hidden.
compositor()->SetVisible(false);
- if (frame_sink_id.is_valid())
- window_mus->SetFrameSinkIdFromServer(frame_sink_id);
+ if (init_params->frame_sink_id.is_valid())
+ window_mus->SetFrameSinkIdFromServer(init_params->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) {}
-
WindowTreeHostMus::~WindowTreeHostMus() {
DestroyCompositor();
DestroyDispatcher();

Powered by Google App Engine
This is Rietveld 408576698