Skip to content

Commit

Permalink
Prepare mus_demo for external window mode some more
Browse files Browse the repository at this point in the history
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 <rjkroege@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#542145}
  • Loading branch information
tonikitoo authored and Commit Bot committed Mar 9, 2018
1 parent 489b507 commit 92649ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion services/ui/demo/mus_demo_external.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <vector>

#include "services/ui/demo/mus_demo.h"
#include "services/ui/public/interfaces/window_tree_host_factory.mojom.h"

namespace ui {
namespace demo {
Expand Down
2 changes: 1 addition & 1 deletion services/ui/demo/window_tree_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void WindowTreeData::Init(
std::unique_ptr<aura::WindowTreeHostMus> 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();
Expand Down
8 changes: 7 additions & 1 deletion services/ui/demo/window_tree_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@ class WindowTreeData {

// Initializes the window tree host and start drawing frames.
void Init(std::unique_ptr<aura::WindowTreeHostMus> 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<aura::WindowTreeHostMus> window_tree_host) {
window_tree_host_ = std::move(window_tree_host);
}

private:
// Draws one frame, incrementing the rotation angle.
void DrawFrame();
Expand Down

0 comments on commit 92649ee

Please sign in to comment.