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

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

Issue 2495423005: Enables passing initial properties to top level window creation (Closed)
Patch Set: cleanup Created 4 years, 1 month 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 602fb573f468236ae63304707f29c368824fdd97..e458fd2be0246f90e980defd79510518d57cb44a 100644
--- a/ui/aura/mus/window_tree_host_mus.cc
+++ b/ui/aura/mus/window_tree_host_mus.cc
@@ -31,12 +31,25 @@ bool IsUsingTestContext() {
////////////////////////////////////////////////////////////////////////////////
// WindowTreeHostMus, public:
-WindowTreeHostMus::WindowTreeHostMus(std::unique_ptr<WindowPortMus> window_port,
- WindowTreeHostMusDelegate* delegate,
- int64_t display_id)
+WindowTreeHostMus::WindowTreeHostMus(
+ std::unique_ptr<WindowPortMus> window_port,
+ WindowTreeHostMusDelegate* delegate,
+ int64_t display_id,
+ const std::map<std::string, std::vector<uint8_t>>* properties)
: WindowTreeHostPlatform(std::move(window_port)),
display_id_(display_id),
delegate_(delegate) {
+ // TODO(sky): find a cleaner way to set this! Better solution is to likely
+ // have constructor take aura::Window.
+ WindowPortMus::Get(window())->window_ = window();
+ if (properties) {
+ // Apply the properties before initializing the window, that way the
+ // server seems them at the time the window is created.
+ WindowMus* window_mus = WindowMus::Get(window());
+ for (auto& pair : *properties)
+ window_mus->SetPropertyFromServer(pair.first, &pair.second);
+ }
+ CreateCompositor();
gfx::AcceleratedWidget accelerated_widget;
if (IsUsingTestContext()) {
accelerated_widget = gfx::kNullAcceleratedWidget;
@@ -69,12 +82,15 @@ WindowTreeHostMus::WindowTreeHostMus(std::unique_ptr<WindowPortMus> window_port,
compositor()->SetVisible(false);
}
-WindowTreeHostMus::WindowTreeHostMus(WindowTreeClient* window_tree_client)
+WindowTreeHostMus::WindowTreeHostMus(
+ WindowTreeClient* window_tree_client,
+ const std::map<std::string, std::vector<uint8_t>>* properties)
: WindowTreeHostMus(
static_cast<WindowTreeHostMusDelegate*>(window_tree_client)
->CreateWindowPortForTopLevel(),
window_tree_client,
- display::Screen::GetScreen()->GetPrimaryDisplay().id()) {}
+ display::Screen::GetScreen()->GetPrimaryDisplay().id(),
+ properties) {}
WindowTreeHostMus::~WindowTreeHostMus() {
DestroyCompositor();

Powered by Google App Engine
This is Rietveld 408576698