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" |
11 #include "ui/aura/mus/property_converter.h" | 11 #include "ui/aura/mus/property_converter.h" |
12 #include "ui/aura/mus/window_tree_client.h" | 12 #include "ui/aura/mus/window_tree_client.h" |
13 #include "ui/aura/mus/window_tree_client_delegate.h" | 13 #include "ui/aura/mus/window_tree_client_delegate.h" |
14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
15 #include "ui/aura/window_delegate.h" | 15 #include "ui/aura/window_delegate.h" |
16 #include "ui/aura/window_observer.h" | 16 #include "ui/aura/window_observer.h" |
17 #include "ui/aura/window_property.h" | 17 #include "ui/base/class_property.h" |
18 | 18 |
19 namespace aura { | 19 namespace aura { |
20 | 20 |
21 WindowPortMus::WindowMusChangeDataImpl::WindowMusChangeDataImpl() = default; | 21 WindowPortMus::WindowMusChangeDataImpl::WindowMusChangeDataImpl() = default; |
22 | 22 |
23 WindowPortMus::WindowMusChangeDataImpl::~WindowMusChangeDataImpl() = default; | 23 WindowPortMus::WindowMusChangeDataImpl::~WindowMusChangeDataImpl() = default; |
24 | 24 |
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); |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 412 } |
413 | 413 |
414 void WindowPortMus::OnDidChangeBounds(const gfx::Rect& old_bounds, | 414 void WindowPortMus::OnDidChangeBounds(const gfx::Rect& old_bounds, |
415 const gfx::Rect& new_bounds) { | 415 const gfx::Rect& new_bounds) { |
416 ServerChangeData change_data; | 416 ServerChangeData change_data; |
417 change_data.bounds_in_dip = new_bounds; | 417 change_data.bounds_in_dip = new_bounds; |
418 if (!RemoveChangeByTypeAndData(ServerChangeType::BOUNDS, change_data)) | 418 if (!RemoveChangeByTypeAndData(ServerChangeType::BOUNDS, change_data)) |
419 window_tree_client_->OnWindowMusBoundsChanged(this, old_bounds, new_bounds); | 419 window_tree_client_->OnWindowMusBoundsChanged(this, old_bounds, new_bounds); |
420 } | 420 } |
421 | 421 |
422 std::unique_ptr<WindowPortPropertyData> WindowPortMus::OnWillChangeProperty( | 422 std::unique_ptr<ui::PropertyData> WindowPortMus::OnWillChangeProperty( |
423 const void* key) { | 423 const void* key) { |
424 // |window_| is null if a property is set on the aura::Window before | 424 // |window_| is null if a property is set on the aura::Window before |
425 // Window::Init() is called. It's safe to ignore the change in this case as | 425 // Window::Init() is called. It's safe to ignore the change in this case as |
426 // once Window::Init() is called the Window is queried for the current set of | 426 // once Window::Init() is called the Window is queried for the current set of |
427 // properties. | 427 // properties. |
428 if (!window_) | 428 if (!window_) |
429 return nullptr; | 429 return nullptr; |
430 | 430 |
431 return window_tree_client_->OnWindowMusWillChangeProperty(this, key); | 431 return window_tree_client_->OnWindowMusWillChangeProperty(this, key); |
432 } | 432 } |
433 | 433 |
434 void WindowPortMus::OnPropertyChanged( | 434 void WindowPortMus::OnPropertyChanged( |
435 const void* key, | 435 const void* key, |
436 std::unique_ptr<WindowPortPropertyData> data) { | 436 std::unique_ptr<ui::PropertyData> data) { |
437 // See comment in OnWillChangeProperty() as to why |window_| may be null. | 437 // See comment in OnWillChangeProperty() as to why |window_| may be null. |
438 if (!window_) | 438 if (!window_) |
439 return; | 439 return; |
440 | 440 |
441 ServerChangeData change_data; | 441 ServerChangeData change_data; |
442 change_data.property_name = | 442 change_data.property_name = |
443 GetPropertyConverter()->GetTransportNameForPropertyKey(key); | 443 GetPropertyConverter()->GetTransportNameForPropertyKey(key); |
444 // TODO(sky): investigate to see if we need to compare data. In particular do | 444 // TODO(sky): investigate to see if we need to compare data. In particular do |
445 // we ever have a case where changing a property cascades into changing the | 445 // we ever have a case where changing a property cascades into changing the |
446 // same property? | 446 // same property? |
447 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) | 447 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) |
448 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); | 448 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); |
449 } | 449 } |
450 | 450 |
451 } // namespace aura | 451 } // namespace aura |
OLD | NEW |