OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/aura/mus/window_tree_client.h" | 5 #include "ui/aura/mus/window_tree_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 DCHECK(tree_); | 257 DCHECK(tree_); |
258 tree_->SetImeVisibility(window->server_id(), visible, std::move(state)); | 258 tree_->SetImeVisibility(window->server_id(), visible, std::move(state)); |
259 } | 259 } |
260 | 260 |
261 void WindowTreeClient::Embed( | 261 void WindowTreeClient::Embed( |
262 Window* window, | 262 Window* window, |
263 ui::mojom::WindowTreeClientPtr client, | 263 ui::mojom::WindowTreeClientPtr client, |
264 uint32_t flags, | 264 uint32_t flags, |
265 const ui::mojom::WindowTree::EmbedCallback& callback) { | 265 const ui::mojom::WindowTree::EmbedCallback& callback) { |
266 DCHECK(tree_); | 266 DCHECK(tree_); |
| 267 // Window::Init() must be called before Embed() (otherwise the server hasn't |
| 268 // been told about the window). |
| 269 DCHECK(window->layer()); |
267 if (!window->children().empty()) { | 270 if (!window->children().empty()) { |
268 // The window server removes all children before embedding. In other words, | 271 // The window server removes all children before embedding. In other words, |
269 // it's generally an error to Embed() with existing children. So, fail | 272 // it's generally an error to Embed() with existing children. So, fail |
270 // early. | 273 // early. |
271 callback.Run(false); | 274 callback.Run(false); |
272 return; | 275 return; |
273 } | 276 } |
274 | 277 |
275 tree_->Embed(WindowMus::Get(window)->server_id(), std::move(client), flags, | 278 tree_->Embed(WindowMus::Get(window)->server_id(), std::move(client), flags, |
276 callback); | 279 callback); |
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1690 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
1688 this, capture_synchronizer_.get(), window)); | 1691 this, capture_synchronizer_.get(), window)); |
1689 } | 1692 } |
1690 | 1693 |
1691 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1694 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
1692 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1695 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
1693 this, focus_synchronizer_.get(), window)); | 1696 this, focus_synchronizer_.get(), window)); |
1694 } | 1697 } |
1695 | 1698 |
1696 } // namespace aura | 1699 } // namespace aura |
OLD | NEW |