| 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/client_surface_embedder.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // static | 25 // static |
| 26 WindowMus* WindowMus::Get(Window* window) { | 26 WindowMus* WindowMus::Get(Window* window) { |
| 27 return WindowPortMus::Get(window); | 27 return WindowPortMus::Get(window); |
| 28 } | 28 } |
| 29 | 29 |
| 30 WindowPortMus::WindowPortMus(WindowTreeClient* client, | 30 WindowPortMus::WindowPortMus(WindowTreeClient* client, |
| 31 WindowMusType window_mus_type) | 31 WindowMusType window_mus_type) |
| 32 : WindowMus(window_mus_type), window_tree_client_(client) {} | 32 : WindowMus(window_mus_type), window_tree_client_(client) {} |
| 33 | 33 |
| 34 WindowPortMus::~WindowPortMus() { | 34 WindowPortMus::~WindowPortMus() { |
| 35 if (surface_info_.id().is_valid()) | 35 if (surface_info_.is_valid()) |
| 36 SetSurfaceInfoFromServer(cc::SurfaceInfo()); | 36 SetSurfaceInfoFromServer(cc::SurfaceInfo()); |
| 37 | 37 |
| 38 // DESTROY is only scheduled from DestroyFromServer(), meaning if DESTROY is | 38 // DESTROY is only scheduled from DestroyFromServer(), meaning if DESTROY is |
| 39 // present then the server originated the change. | 39 // present then the server originated the change. |
| 40 const WindowTreeClient::Origin origin = | 40 const WindowTreeClient::Origin origin = |
| 41 RemoveChangeByTypeAndData(ServerChangeType::DESTROY, ServerChangeData()) | 41 RemoveChangeByTypeAndData(ServerChangeType::DESTROY, ServerChangeData()) |
| 42 ? WindowTreeClient::Origin::SERVER | 42 ? WindowTreeClient::Origin::SERVER |
| 43 : WindowTreeClient::Origin::CLIENT; | 43 : WindowTreeClient::Origin::CLIENT; |
| 44 window_tree_client_->OnWindowMusDestroyed(this, origin); | 44 window_tree_client_->OnWindowMusDestroyed(this, origin); |
| 45 } | 45 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 const std::vector<uint8_t>* property_data) { | 238 const std::vector<uint8_t>* property_data) { |
| 239 ServerChangeData data; | 239 ServerChangeData data; |
| 240 data.property_name = property_name; | 240 data.property_name = property_name; |
| 241 ScopedServerChange change(this, ServerChangeType::PROPERTY, data); | 241 ScopedServerChange change(this, ServerChangeType::PROPERTY, data); |
| 242 GetPropertyConverter()->SetPropertyFromTransportValue(window_, property_name, | 242 GetPropertyConverter()->SetPropertyFromTransportValue(window_, property_name, |
| 243 property_data); | 243 property_data); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void WindowPortMus::SetSurfaceInfoFromServer( | 246 void WindowPortMus::SetSurfaceInfoFromServer( |
| 247 const cc::SurfaceInfo& surface_info) { | 247 const cc::SurfaceInfo& surface_info) { |
| 248 if (surface_info_.id().is_valid()) { | 248 if (surface_info_.is_valid()) { |
| 249 const cc::SurfaceId& existing_surface_id = surface_info_.id(); | 249 const cc::SurfaceId& existing_surface_id = surface_info_.id(); |
| 250 const cc::SurfaceId& new_surface_id = surface_info.id(); | 250 const cc::SurfaceId& new_surface_id = surface_info.id(); |
| 251 if (existing_surface_id.is_valid() && | 251 if (existing_surface_id.is_valid() && |
| 252 existing_surface_id != new_surface_id) { | 252 existing_surface_id != new_surface_id) { |
| 253 // TODO(kylechar): Start return reference here? | 253 // TODO(kylechar): Start return reference here? |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 // The fact that SetSurfaceIdFromServer was called means that this window | 257 // The fact that SetSurfaceIdFromServer was called means that this window |
| 258 // corresponds to an embedded client. | 258 // corresponds to an embedded client. |
| 259 if (!client_surface_embedder && surface_info.id().is_valid()) | 259 if (!client_surface_embedder && surface_info.is_valid()) |
| 260 client_surface_embedder = base::MakeUnique<ClientSurfaceEmbedder>(window_); | 260 client_surface_embedder = base::MakeUnique<ClientSurfaceEmbedder>(window_); |
| 261 | 261 |
| 262 if (surface_info.id().is_valid()) | 262 if (surface_info.is_valid()) |
| 263 client_surface_embedder->UpdateSurface(surface_info); | 263 client_surface_embedder->UpdateSurface(surface_info); |
| 264 else | 264 else |
| 265 client_surface_embedder.reset(); | 265 client_surface_embedder.reset(); |
| 266 | 266 |
| 267 surface_info_ = surface_info; | 267 surface_info_ = surface_info; |
| 268 } | 268 } |
| 269 | 269 |
| 270 void WindowPortMus::DestroyFromServer() { | 270 void WindowPortMus::DestroyFromServer() { |
| 271 std::unique_ptr<ScopedServerChange> remove_from_parent_change; | 271 std::unique_ptr<ScopedServerChange> remove_from_parent_change; |
| 272 if (window_->parent()) { | 272 if (window_->parent()) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 change_data.property_name = | 441 change_data.property_name = |
| 442 GetPropertyConverter()->GetTransportNameForPropertyKey(key); | 442 GetPropertyConverter()->GetTransportNameForPropertyKey(key); |
| 443 // TODO(sky): investigate to see if we need to compare data. In particular do | 443 // TODO(sky): investigate to see if we need to compare data. In particular do |
| 444 // we ever have a case where changing a property cascades into changing the | 444 // we ever have a case where changing a property cascades into changing the |
| 445 // same property? | 445 // same property? |
| 446 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) | 446 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) |
| 447 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); | 447 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); |
| 448 } | 448 } |
| 449 | 449 |
| 450 } // namespace aura | 450 } // namespace aura |
| OLD | NEW |