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

Unified Diff: services/ui/demo/mus_demo_internal.cc

Issue 2700493005: Mus Demo: Refactor code to prepare multiple windows in external mode (Closed)
Patch Set: Rename MusExternal::tree_client_ & describes the helper functions for WindowTreeData. Created 3 years, 10 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
« no previous file with comments | « services/ui/demo/mus_demo_internal.h ('k') | services/ui/demo/window_tree_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/demo/mus_demo_internal.cc
diff --git a/services/ui/demo/mus_demo_internal.cc b/services/ui/demo/mus_demo_internal.cc
index 153ffbb0062bab18febe4ab77b1ddbd048338109..6c2125692fa142f61cc57ce1945e241549a8c72f 100644
--- a/services/ui/demo/mus_demo_internal.cc
+++ b/services/ui/demo/mus_demo_internal.cc
@@ -22,13 +22,16 @@ MusDemoInternal::MusDemoInternal() {}
MusDemoInternal::~MusDemoInternal() {}
-void MusDemoInternal::OnStartImpl(
- std::unique_ptr<aura::WindowTreeClient>* window_tree_client,
- std::unique_ptr<WindowTreeData>* window_tree_data) {
- *window_tree_client = base::MakeUnique<aura::WindowTreeClient>(
- context()->connector(), this, this);
- window_tree_client->get()->ConnectAsWindowManager();
- *window_tree_data = base::MakeUnique<WindowTreeData>(kSquareSize);
+std::unique_ptr<aura::WindowTreeClient>
+MusDemoInternal::CreateWindowTreeClient() {
+ return base::MakeUnique<aura::WindowTreeClient>(context()->connector(), this,
+ this);
+}
+
+void MusDemoInternal::OnStartImpl() {
+ window_tree_client()->ConnectAsWindowManager();
+ // The demo will actually start when the window server creates the display,
+ // causing OnWmNewDisplay to be called.
}
void MusDemoInternal::SetWindowManagerClient(
@@ -67,12 +70,13 @@ void MusDemoInternal::OnWmWillCreateDisplay(const display::Display& display) {
void MusDemoInternal::OnWmNewDisplay(
std::unique_ptr<aura::WindowTreeHostMus> window_tree_host,
const display::Display& display) {
+ AppendWindowTreeData(base::MakeUnique<WindowTreeData>(kSquareSize));
InitWindowTreeData(std::move(window_tree_host));
}
void MusDemoInternal::OnWmDisplayRemoved(
aura::WindowTreeHostMus* window_tree_host) {
- CleanupWindowTreeData();
+ RemoveWindowTreeData(window_tree_host);
}
void MusDemoInternal::OnWmDisplayModified(const display::Display& display) {}
« no previous file with comments | « services/ui/demo/mus_demo_internal.h ('k') | services/ui/demo/window_tree_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698