From 92649ee22541f53698978b8fd6f25e5e17302c92 Mon Sep 17 00:00:00 2001 From: Antonio Gomes Date: Fri, 9 Mar 2018 17:03:26 +0000 Subject: [PATCH] Prepare mus_demo for external window mode some more This CL brings no functionality changes, to makes the CL [1] that will bring external window mode capabilities to Mus slightly smaller. In summary it: - removes a loose include in mus_demo_external.h - adds a setter for the WindowTreeHostMus in WindowTreeData class, as a protected member (to be used by WindowTreeDataExternal in [1]) and uses it. - Conditions WindowTreeData::IsInitialized to 'window_delegate_' rather than to 'window_tree_host_'. Reason: after [1], window_tree_host_ will be initialized earlier on, and not reflect a WindowTreeData instance actually be initialized anymore. BUG=666958 [1] https://crrev.com/c/955782 Change-Id: Ifec202d2217cfeafd9a13c7811610fbe450b9937 Reviewed-on: https://chromium-review.googlesource.com/957143 Reviewed-by: Robert Kroeger Commit-Queue: Antonio Gomes Cr-Commit-Position: refs/heads/master@{#542145} --- services/ui/demo/mus_demo_external.h | 1 - services/ui/demo/window_tree_data.cc | 2 +- services/ui/demo/window_tree_data.h | 8 +++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/services/ui/demo/mus_demo_external.h b/services/ui/demo/mus_demo_external.h index 2b62462312cdfc..2974b31bf3215b 100644 --- a/services/ui/demo/mus_demo_external.h +++ b/services/ui/demo/mus_demo_external.h @@ -9,7 +9,6 @@ #include #include "services/ui/demo/mus_demo.h" -#include "services/ui/public/interfaces/window_tree_host_factory.mojom.h" namespace ui { namespace demo { diff --git a/services/ui/demo/window_tree_data.cc b/services/ui/demo/window_tree_data.cc index e298166babb63b..fcf140e99b85d0 100644 --- a/services/ui/demo/window_tree_data.cc +++ b/services/ui/demo/window_tree_data.cc @@ -70,7 +70,7 @@ void WindowTreeData::Init( std::unique_ptr window_tree_host) { window_tree_host->Show(); // Take ownership of the WTH. - window_tree_host_ = std::move(window_tree_host); + SetWindowTreeHost(std::move(window_tree_host)); // Initialize the window for the bitmap. window_delegate_ = new aura_extra::ImageWindowDelegate(); diff --git a/services/ui/demo/window_tree_data.h b/services/ui/demo/window_tree_data.h index 007b04f6d284c4..15fd07c7870c6b 100644 --- a/services/ui/demo/window_tree_data.h +++ b/services/ui/demo/window_tree_data.h @@ -27,12 +27,18 @@ class WindowTreeData { // Initializes the window tree host and start drawing frames. void Init(std::unique_ptr window_tree_host); - bool IsInitialized() const { return !!window_tree_host_; } + bool IsInitialized() const { return !!window_delegate_; } const aura::WindowTreeHostMus* WindowTreeHost() const { return window_tree_host_.get(); } + protected: + void SetWindowTreeHost( + std::unique_ptr window_tree_host) { + window_tree_host_ = std::move(window_tree_host); + } + private: // Draws one frame, incrementing the rotation angle. void DrawFrame();