| Index: ui/aura/mus/window_tree_client.cc
|
| diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc
|
| index 0f7351c738917443789d004d657cba9e57e89b8b..2bd5bd0e68793ef56159267a76bdd8891c05e25c 100644
|
| --- a/ui/aura/mus/window_tree_client.cc
|
| +++ b/ui/aura/mus/window_tree_client.cc
|
| @@ -226,6 +226,20 @@ void WindowTreeClient::ConnectViaWindowTreeFactory() {
|
| SetWindowTree(std::move(window_tree));
|
| }
|
|
|
| +void WindowTreeClient::ConnectViaWindowTreeHostFactory() {
|
| + // The client id doesn't really matter, we use 101 purely for debugging.
|
| + client_id_ = 101;
|
| +
|
| + ui::mojom::WindowTreeHostFactoryRegistrarPtr host_factory_registrar;
|
| + connector_->BindInterface(ui::mojom::kServiceName, &host_factory_registrar);
|
| +
|
| + ui::mojom::WindowTreePtr window_tree;
|
| + host_factory_registrar->Register(MakeRequest(&window_tree_host_factory_ptr_),
|
| + MakeRequest(&window_tree),
|
| + binding_.CreateInterfacePtrAndBind());
|
| + SetWindowTree(std::move(window_tree));
|
| +}
|
| +
|
| void WindowTreeClient::ConnectAsWindowManager() {
|
| DCHECK(window_manager_delegate_);
|
|
|
| @@ -237,6 +251,10 @@ void WindowTreeClient::ConnectAsWindowManager() {
|
| SetWindowTree(std::move(window_tree));
|
| }
|
|
|
| +void WindowTreeClient::CreateHost(ui::mojom::WindowTreeHostRequest host) {
|
| + window_tree_host_factory_ptr_->CreateWindowTreeHost(std::move(host));
|
| +}
|
| +
|
| void WindowTreeClient::SetCanFocus(Window* window, bool can_focus) {
|
| DCHECK(tree_);
|
| DCHECK(window);
|
| @@ -505,7 +523,6 @@ void WindowTreeClient::OnEmbedImpl(ui::mojom::WindowTree* window_tree,
|
| client_id_ = client_id;
|
| WindowTreeConnectionEstablished(window_tree);
|
|
|
| - DCHECK(roots_.empty());
|
| std::unique_ptr<WindowTreeHostMus> window_tree_host =
|
| CreateWindowTreeHost(WindowMusType::EMBED, *root_data, display_id);
|
|
|
| @@ -839,8 +856,13 @@ void WindowTreeClient::OnEmbed(ClientSpecificId client_id,
|
| int64_t display_id,
|
| Id focused_window_id,
|
| bool drawn) {
|
| - DCHECK(!tree_ptr_);
|
| - tree_ptr_ = std::move(tree);
|
| + // No need to set 'tree_ptr_' whether it was already set during
|
| + // ConnectViaWindowManagerHostFactory.
|
| + DCHECK((tree_ptr_ && !tree) || (!tree_ptr_ && tree));
|
| + if (tree) {
|
| + DCHECK(roots_.empty());
|
| + tree_ptr_ = std::move(tree);
|
| + }
|
|
|
| is_from_embed_ = true;
|
|
|
|
|