OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_port_mus.h" | 5 #include "ui/aura/mus/window_port_mus.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
9 #include "ui/aura/client/transient_window_client.h" | 9 #include "ui/aura/client/transient_window_client.h" |
| 10 #include "ui/aura/mus/client_surface_embedder.h" |
10 #include "ui/aura/mus/property_converter.h" | 11 #include "ui/aura/mus/property_converter.h" |
11 #include "ui/aura/mus/surface_id_handler.h" | 12 #include "ui/aura/mus/surface_id_handler.h" |
12 #include "ui/aura/mus/window_tree_client.h" | 13 #include "ui/aura/mus/window_tree_client.h" |
13 #include "ui/aura/mus/window_tree_client_delegate.h" | 14 #include "ui/aura/mus/window_tree_client_delegate.h" |
14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
15 #include "ui/aura/window_delegate.h" | 16 #include "ui/aura/window_delegate.h" |
16 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
17 #include "ui/aura/window_property.h" | 18 #include "ui/aura/window_property.h" |
18 | 19 |
19 namespace aura { | 20 namespace aura { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 const cc::SurfaceInfo& surface_info) { | 249 const cc::SurfaceInfo& surface_info) { |
249 if (surface_info_.id().is_valid()) { | 250 if (surface_info_.id().is_valid()) { |
250 const cc::SurfaceId& existing_surface_id = surface_info_.id(); | 251 const cc::SurfaceId& existing_surface_id = surface_info_.id(); |
251 const cc::SurfaceId& new_surface_id = surface_info.id(); | 252 const cc::SurfaceId& new_surface_id = surface_info.id(); |
252 if (existing_surface_id.is_valid() && | 253 if (existing_surface_id.is_valid() && |
253 existing_surface_id != new_surface_id) { | 254 existing_surface_id != new_surface_id) { |
254 // TODO(kylechar): Start return reference here? | 255 // TODO(kylechar): Start return reference here? |
255 } | 256 } |
256 } | 257 } |
257 WindowPortMus* parent = Get(window_->parent()); | 258 WindowPortMus* parent = Get(window_->parent()); |
| 259 // TODO(mfomitchev): This is unused. We probably don't need this. |
258 if (parent && parent->surface_id_handler_) { | 260 if (parent && parent->surface_id_handler_) { |
259 parent->surface_id_handler_->OnChildWindowSurfaceChanged(window_, | 261 parent->surface_id_handler_->OnChildWindowSurfaceChanged(window_, |
260 surface_info); | 262 surface_info); |
261 } | 263 } |
| 264 |
| 265 // The fact that SetSurfaceIdFromServer was called means that this window |
| 266 // corresponds to an embedded client. |
| 267 if (!client_surface_embedder && surface_info.id().is_valid()) |
| 268 client_surface_embedder = base::MakeUnique<ClientSurfaceEmbedder>(window_); |
| 269 |
| 270 if (surface_info.id().is_valid()) |
| 271 client_surface_embedder->UpdateSurface(surface_info); |
| 272 else |
| 273 client_surface_embedder.reset(); |
| 274 |
262 surface_info_ = surface_info; | 275 surface_info_ = surface_info; |
263 } | 276 } |
264 | 277 |
265 void WindowPortMus::DestroyFromServer() { | 278 void WindowPortMus::DestroyFromServer() { |
266 std::unique_ptr<ScopedServerChange> remove_from_parent_change; | 279 std::unique_ptr<ScopedServerChange> remove_from_parent_change; |
267 if (window_->parent()) { | 280 if (window_->parent()) { |
268 ServerChangeData data; | 281 ServerChangeData data; |
269 data.child_id = server_id(); | 282 data.child_id = server_id(); |
270 WindowPortMus* parent = Get(window_->parent()); | 283 WindowPortMus* parent = Get(window_->parent()); |
271 remove_from_parent_change = base::MakeUnique<ScopedServerChange>( | 284 remove_from_parent_change = base::MakeUnique<ScopedServerChange>( |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 change_data.property_name = | 438 change_data.property_name = |
426 GetPropertyConverter()->GetTransportNameForPropertyKey(key); | 439 GetPropertyConverter()->GetTransportNameForPropertyKey(key); |
427 // TODO(sky): investigate to see if we need to compare data. In particular do | 440 // TODO(sky): investigate to see if we need to compare data. In particular do |
428 // we ever have a case where changing a property cascades into changing the | 441 // we ever have a case where changing a property cascades into changing the |
429 // same property? | 442 // same property? |
430 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) | 443 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) |
431 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); | 444 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); |
432 } | 445 } |
433 | 446 |
434 } // namespace aura | 447 } // namespace aura |
OLD | NEW |