| 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 : window_tree_client_(client) {} |
| 25 | 29 |
| 26 WindowPortMus::~WindowPortMus() { | 30 WindowPortMus::~WindowPortMus() { |
| 27 if (surface_info_) | 31 if (surface_info_) |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 204 } |
| 201 } | 205 } |
| 202 WindowPortMus* parent = Get(window_->parent()); | 206 WindowPortMus* parent = Get(window_->parent()); |
| 203 if (parent && parent->surface_id_handler_) { | 207 if (parent && parent->surface_id_handler_) { |
| 204 parent->surface_id_handler_->OnChildWindowSurfaceChanged(window_, | 208 parent->surface_id_handler_->OnChildWindowSurfaceChanged(window_, |
| 205 &surface_info); | 209 &surface_info); |
| 206 } | 210 } |
| 207 surface_info_ = std::move(surface_info); | 211 surface_info_ = std::move(surface_info); |
| 208 } | 212 } |
| 209 | 213 |
| 214 std::unique_ptr<WindowMusChangeData> |
| 215 WindowPortMus::PrepareForServerBoundsChange(const gfx::Rect& bounds) { |
| 216 std::unique_ptr<WindowMusChangeDataImpl> data( |
| 217 base::MakeUnique<WindowMusChangeDataImpl>()); |
| 218 ServerChangeData change_data; |
| 219 change_data.bounds = bounds; |
| 220 data->change = base::MakeUnique<ScopedServerChange>( |
| 221 this, ServerChangeType::BOUNDS, change_data); |
| 222 return std::move(data); |
| 223 } |
| 224 |
| 225 std::unique_ptr<WindowMusChangeData> |
| 226 WindowPortMus::PrepareForServerVisibilityChange(bool value) { |
| 227 std::unique_ptr<WindowMusChangeDataImpl> data( |
| 228 base::MakeUnique<WindowMusChangeDataImpl>()); |
| 229 ServerChangeData change_data; |
| 230 change_data.visible = value; |
| 231 data->change = base::MakeUnique<ScopedServerChange>( |
| 232 this, ServerChangeType::VISIBLE, change_data); |
| 233 return std::move(data); |
| 234 } |
| 235 |
| 210 void WindowPortMus::NotifyEmbeddedAppDisconnected() { | 236 void WindowPortMus::NotifyEmbeddedAppDisconnected() { |
| 211 for (WindowObserver& observer : *GetObservers(window_)) | 237 for (WindowObserver& observer : *GetObservers(window_)) |
| 212 observer.OnEmbeddedAppDisconnected(window_); | 238 observer.OnEmbeddedAppDisconnected(window_); |
| 213 } | 239 } |
| 214 | 240 |
| 215 std::unique_ptr<WindowPortInitData> WindowPortMus::OnPreInit(Window* window) { | 241 std::unique_ptr<WindowPortInitData> WindowPortMus::OnPreInit(Window* window) { |
| 216 window_ = window; | 242 window_ = window; |
| 217 return window_tree_client_->OnWindowMusCreated(this); | 243 return window_tree_client_->OnWindowMusCreated(this); |
| 218 } | 244 } |
| 219 | 245 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 change_data.property_name = | 318 change_data.property_name = |
| 293 GetPropertyConverter()->GetTransportNameForPropertyKey(key); | 319 GetPropertyConverter()->GetTransportNameForPropertyKey(key); |
| 294 // TODO(sky): investigate to see if we need to compare data. In particular do | 320 // 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 | 321 // we ever have a case where changing a property cascades into changing the |
| 296 // same property? | 322 // same property? |
| 297 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) | 323 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) |
| 298 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); | 324 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); |
| 299 } | 325 } |
| 300 | 326 |
| 301 } // namespace aura | 327 } // namespace aura |
| OLD | NEW |