| 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 "ui/aura/client/aura_constants.h" | 7 #include "ui/aura/client/aura_constants.h" |
| 8 #include "ui/aura/mus/property_converter.h" | 8 #include "ui/aura/mus/property_converter.h" |
| 9 #include "ui/aura/mus/surface_id_handler.h" | 9 #include "ui/aura/mus/surface_id_handler.h" |
| 10 #include "ui/aura/mus/window_tree_client.h" | 10 #include "ui/aura/mus/window_tree_client.h" |
| 11 #include "ui/aura/mus/window_tree_client_delegate.h" | 11 #include "ui/aura/mus/window_tree_client_delegate.h" |
| 12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 13 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
| 14 #include "ui/aura/window_property.h" | 14 #include "ui/aura/window_property.h" |
| 15 | 15 |
| 16 namespace aura { | 16 namespace aura { |
| 17 | 17 |
| 18 WindowPortMus::WindowMusChangeDataImpl::WindowMusChangeDataImpl() = default; |
| 19 |
| 20 WindowPortMus::WindowMusChangeDataImpl::~WindowMusChangeDataImpl() = default; |
| 21 |
| 18 // static | 22 // static |
| 19 WindowMus* WindowMus::Get(Window* window) { | 23 WindowMus* WindowMus::Get(Window* window) { |
| 20 return WindowPortMus::Get(window); | 24 return WindowPortMus::Get(window); |
| 21 } | 25 } |
| 22 | 26 |
| 23 WindowPortMus::WindowPortMus(WindowTreeClient* client) | 27 WindowPortMus::WindowPortMus(WindowTreeClient* client, |
| 24 : window_tree_client_(client) {} | 28 bool create_remote_window) |
| 29 : WindowMus(create_remote_window), window_tree_client_(client) {} |
| 25 | 30 |
| 26 WindowPortMus::~WindowPortMus() { | 31 WindowPortMus::~WindowPortMus() { |
| 27 if (surface_info_) | 32 if (surface_info_) |
| 28 SetSurfaceIdFromServer(nullptr); | 33 SetSurfaceIdFromServer(nullptr); |
| 29 | 34 |
| 30 window_tree_client_->OnWindowMusDestroyed(this); | 35 window_tree_client_->OnWindowMusDestroyed(this); |
| 31 } | 36 } |
| 32 | 37 |
| 33 // static | 38 // static |
| 34 WindowPortMus* WindowPortMus::Get(Window* window) { | 39 WindowPortMus* WindowPortMus::Get(Window* window) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 205 } |
| 201 } | 206 } |
| 202 WindowPortMus* parent = Get(window_->parent()); | 207 WindowPortMus* parent = Get(window_->parent()); |
| 203 if (parent && parent->surface_id_handler_) { | 208 if (parent && parent->surface_id_handler_) { |
| 204 parent->surface_id_handler_->OnChildWindowSurfaceChanged(window_, | 209 parent->surface_id_handler_->OnChildWindowSurfaceChanged(window_, |
| 205 &surface_info); | 210 &surface_info); |
| 206 } | 211 } |
| 207 surface_info_ = std::move(surface_info); | 212 surface_info_ = std::move(surface_info); |
| 208 } | 213 } |
| 209 | 214 |
| 215 std::unique_ptr<WindowMusChangeData> |
| 216 WindowPortMus::PrepareForServerBoundsChange(const gfx::Rect& bounds) { |
| 217 std::unique_ptr<WindowMusChangeDataImpl> data( |
| 218 base::MakeUnique<WindowMusChangeDataImpl>()); |
| 219 ServerChangeData change_data; |
| 220 change_data.bounds = bounds; |
| 221 data->change = base::MakeUnique<ScopedServerChange>( |
| 222 this, ServerChangeType::BOUNDS, change_data); |
| 223 return std::move(data); |
| 224 } |
| 225 |
| 226 std::unique_ptr<WindowMusChangeData> |
| 227 WindowPortMus::PrepareForServerVisibilityChange(bool value) { |
| 228 std::unique_ptr<WindowMusChangeDataImpl> data( |
| 229 base::MakeUnique<WindowMusChangeDataImpl>()); |
| 230 ServerChangeData change_data; |
| 231 change_data.visible = value; |
| 232 data->change = base::MakeUnique<ScopedServerChange>( |
| 233 this, ServerChangeType::VISIBLE, change_data); |
| 234 return std::move(data); |
| 235 } |
| 236 |
| 210 void WindowPortMus::NotifyEmbeddedAppDisconnected() { | 237 void WindowPortMus::NotifyEmbeddedAppDisconnected() { |
| 211 for (WindowObserver& observer : *GetObservers(window_)) | 238 for (WindowObserver& observer : *GetObservers(window_)) |
| 212 observer.OnEmbeddedAppDisconnected(window_); | 239 observer.OnEmbeddedAppDisconnected(window_); |
| 213 } | 240 } |
| 214 | 241 |
| 215 std::unique_ptr<WindowPortInitData> WindowPortMus::OnPreInit(Window* window) { | 242 std::unique_ptr<WindowPortInitData> WindowPortMus::OnPreInit(Window* window) { |
| 216 window_ = window; | 243 window_ = window; |
| 217 return window_tree_client_->OnWindowMusCreated(this); | 244 return window_tree_client_->OnWindowMusCreated(this); |
| 218 } | 245 } |
| 219 | 246 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 change_data.property_name = | 319 change_data.property_name = |
| 293 GetPropertyConverter()->GetTransportNameForPropertyKey(key); | 320 GetPropertyConverter()->GetTransportNameForPropertyKey(key); |
| 294 // TODO(sky): investigate to see if we need to compare data. In particular do | 321 // TODO(sky): investigate to see if we need to compare data. In particular do |
| 295 // we ever have a case where changing a property cascades into changing the | 322 // we ever have a case where changing a property cascades into changing the |
| 296 // same property? | 323 // same property? |
| 297 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) | 324 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) |
| 298 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); | 325 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); |
| 299 } | 326 } |
| 300 | 327 |
| 301 } // namespace aura | 328 } // namespace aura |
| OLD | NEW |