OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/ui/public/cpp/window.h" | 5 #include "services/ui/public/cpp/window.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 // we update local state only, and wait for the next focus change from the | 537 // we update local state only, and wait for the next focus change from the |
538 // server. | 538 // server. |
539 client_->LocalSetFocus(nullptr); | 539 client_->LocalSetFocus(nullptr); |
540 } | 540 } |
541 | 541 |
542 // Remove from transient parent. | 542 // Remove from transient parent. |
543 if (transient_parent_) | 543 if (transient_parent_) |
544 transient_parent_->LocalRemoveTransientWindow(this); | 544 transient_parent_->LocalRemoveTransientWindow(this); |
545 | 545 |
546 // Return the surface reference if there is one. | 546 // Return the surface reference if there is one. |
547 if (surface_info_) | 547 if (surface_info_.id().is_valid()) |
548 LocalSetSurfaceId(nullptr); | 548 LocalSetSurfaceInfo(cc::SurfaceInfo()); |
549 | 549 |
550 // Remove transient children. | 550 // Remove transient children. |
551 while (!transient_children_.empty()) { | 551 while (!transient_children_.empty()) { |
552 Window* transient_child = transient_children_.front(); | 552 Window* transient_child = transient_children_.front(); |
553 LocalRemoveTransientWindow(transient_child); | 553 LocalRemoveTransientWindow(transient_child); |
554 transient_child->LocalDestroy(); | 554 transient_child->LocalDestroy(); |
555 DCHECK(transient_children_.empty() || | 555 DCHECK(transient_children_.empty() || |
556 transient_children_.front() != transient_child); | 556 transient_children_.front() != transient_child); |
557 } | 557 } |
558 | 558 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 if (value) { | 802 if (value) { |
803 properties_[name] = *value; | 803 properties_[name] = *value; |
804 } else if (it != properties_.end()) { | 804 } else if (it != properties_.end()) { |
805 properties_.erase(it); | 805 properties_.erase(it); |
806 } | 806 } |
807 | 807 |
808 for (auto& observer : observers_) | 808 for (auto& observer : observers_) |
809 observer.OnWindowSharedPropertyChanged(this, name, old_value_ptr, value); | 809 observer.OnWindowSharedPropertyChanged(this, name, old_value_ptr, value); |
810 } | 810 } |
811 | 811 |
812 void Window::LocalSetSurfaceId(std::unique_ptr<SurfaceInfo> surface_info) { | 812 void Window::LocalSetSurfaceInfo(const cc::SurfaceInfo& surface_info) { |
813 if (surface_info_) { | 813 if (surface_info_.id().is_valid()) { |
814 const cc::SurfaceId& existing_surface_id = surface_info_->surface_id; | 814 const cc::SurfaceId& existing_surface_id = surface_info_.id(); |
815 cc::SurfaceId new_surface_id = | 815 const cc::SurfaceId& new_surface_id = surface_info.id(); |
816 surface_info ? surface_info->surface_id : cc::SurfaceId(); | |
817 if (existing_surface_id.is_valid() && | 816 if (existing_surface_id.is_valid() && |
818 existing_surface_id != new_surface_id) { | 817 existing_surface_id != new_surface_id) { |
819 // TODO(kylechar): Start return reference here? | 818 // TODO(kylechar): Start return reference here? |
820 } | 819 } |
821 } | 820 } |
822 if (parent_ && parent_->surface_id_handler_) { | 821 if (parent_ && parent_->surface_id_handler_) { |
823 parent_->surface_id_handler_->OnChildWindowSurfaceChanged(this, | 822 parent_->surface_id_handler_->OnChildWindowSurfaceChanged(this, |
824 &surface_info); | 823 surface_info); |
825 } | 824 } |
826 surface_info_ = std::move(surface_info); | 825 surface_info_ = surface_info; |
827 } | 826 } |
828 | 827 |
829 void Window::NotifyWindowStackingChanged() { | 828 void Window::NotifyWindowStackingChanged() { |
830 if (stacking_target_) { | 829 if (stacking_target_) { |
831 Children::const_iterator window_i = std::find( | 830 Children::const_iterator window_i = std::find( |
832 parent()->children().begin(), parent()->children().end(), this); | 831 parent()->children().begin(), parent()->children().end(), this); |
833 DCHECK(window_i != parent()->children().end()); | 832 DCHECK(window_i != parent()->children().end()); |
834 if (window_i != parent()->children().begin() && | 833 if (window_i != parent()->children().begin() && |
835 (*(window_i - 1) == stacking_target_)) | 834 (*(window_i - 1) == stacking_target_)) |
836 return; | 835 return; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 notifier->NotifyWindowReordered(); | 964 notifier->NotifyWindowReordered(); |
966 | 965 |
967 return true; | 966 return true; |
968 } | 967 } |
969 | 968 |
970 // static | 969 // static |
971 Window** Window::GetStackingTarget(Window* window) { | 970 Window** Window::GetStackingTarget(Window* window) { |
972 return &window->stacking_target_; | 971 return &window->stacking_target_; |
973 } | 972 } |
974 } // namespace ui | 973 } // namespace ui |
OLD | NEW |