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