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> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "services/ui/common/transient_window_utils.h" | 15 #include "services/ui/common/transient_window_utils.h" |
16 #include "services/ui/public/cpp/property_type_converters.h" | 16 #include "services/ui/public/cpp/property_type_converters.h" |
17 #include "services/ui/public/cpp/surface_id_handler.h" | |
18 #include "services/ui/public/cpp/window_compositor_frame_sink.h" | 17 #include "services/ui/public/cpp/window_compositor_frame_sink.h" |
19 #include "services/ui/public/cpp/window_observer.h" | 18 #include "services/ui/public/cpp/window_observer.h" |
20 #include "services/ui/public/cpp/window_private.h" | 19 #include "services/ui/public/cpp/window_private.h" |
21 #include "services/ui/public/cpp/window_property.h" | 20 #include "services/ui/public/cpp/window_property.h" |
22 #include "services/ui/public/cpp/window_tracker.h" | 21 #include "services/ui/public/cpp/window_tracker.h" |
23 #include "services/ui/public/cpp/window_tree_client.h" | 22 #include "services/ui/public/cpp/window_tree_client.h" |
24 #include "services/ui/public/interfaces/window_manager.mojom.h" | 23 #include "services/ui/public/interfaces/window_manager.mojom.h" |
25 #include "ui/display/display.h" | 24 #include "ui/display/display.h" |
26 #include "ui/display/types/display_constants.h" | 25 #include "ui/display/types/display_constants.h" |
27 #include "ui/gfx/geometry/rect.h" | 26 #include "ui/gfx/geometry/rect.h" |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 Window::Window(WindowTreeClient* client, Id id) | 589 Window::Window(WindowTreeClient* client, Id id) |
591 : client_(client), | 590 : client_(client), |
592 server_id_(id), | 591 server_id_(id), |
593 parent_(nullptr), | 592 parent_(nullptr), |
594 stacking_target_(nullptr), | 593 stacking_target_(nullptr), |
595 transient_parent_(nullptr), | 594 transient_parent_(nullptr), |
596 is_modal_(false), | 595 is_modal_(false), |
597 // Matches aura, see aura::Window for details. | 596 // Matches aura, see aura::Window for details. |
598 observers_(base::ObserverList<WindowObserver>::NOTIFY_EXISTING_ONLY), | 597 observers_(base::ObserverList<WindowObserver>::NOTIFY_EXISTING_ONLY), |
599 input_event_handler_(nullptr), | 598 input_event_handler_(nullptr), |
600 surface_id_handler_(nullptr), | |
601 visible_(false), | 599 visible_(false), |
602 opacity_(1.0f), | 600 opacity_(1.0f), |
603 display_id_(display::kInvalidDisplayId), | 601 display_id_(display::kInvalidDisplayId), |
604 cursor_id_(mojom::Cursor::CURSOR_NULL), | 602 cursor_id_(mojom::Cursor::CURSOR_NULL), |
605 parent_drawn_(false) {} | 603 parent_drawn_(false) {} |
606 | 604 |
607 void Window::SetSharedPropertyInternal(const std::string& name, | 605 void Window::SetSharedPropertyInternal(const std::string& name, |
608 const std::vector<uint8_t>* value) { | 606 const std::vector<uint8_t>* value) { |
609 if (!WasCreatedByThisClientOrIsRoot(this)) | 607 if (!WasCreatedByThisClientOrIsRoot(this)) |
610 return; | 608 return; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 | 809 |
812 void Window::LocalSetSurfaceInfo(const cc::SurfaceInfo& surface_info) { | 810 void Window::LocalSetSurfaceInfo(const cc::SurfaceInfo& surface_info) { |
813 if (surface_info_.id().is_valid()) { | 811 if (surface_info_.id().is_valid()) { |
814 const cc::SurfaceId& existing_surface_id = surface_info_.id(); | 812 const cc::SurfaceId& existing_surface_id = surface_info_.id(); |
815 const cc::SurfaceId& new_surface_id = surface_info.id(); | 813 const cc::SurfaceId& new_surface_id = surface_info.id(); |
816 if (existing_surface_id.is_valid() && | 814 if (existing_surface_id.is_valid() && |
817 existing_surface_id != new_surface_id) { | 815 existing_surface_id != new_surface_id) { |
818 // TODO(kylechar): Start return reference here? | 816 // TODO(kylechar): Start return reference here? |
819 } | 817 } |
820 } | 818 } |
821 if (parent_ && parent_->surface_id_handler_) { | |
822 parent_->surface_id_handler_->OnChildWindowSurfaceChanged(this, | |
823 surface_info); | |
824 } | |
825 surface_info_ = surface_info; | 819 surface_info_ = surface_info; |
826 } | 820 } |
827 | 821 |
828 void Window::NotifyWindowStackingChanged() { | 822 void Window::NotifyWindowStackingChanged() { |
829 if (stacking_target_) { | 823 if (stacking_target_) { |
830 Children::const_iterator window_i = std::find( | 824 Children::const_iterator window_i = std::find( |
831 parent()->children().begin(), parent()->children().end(), this); | 825 parent()->children().begin(), parent()->children().end(), this); |
832 DCHECK(window_i != parent()->children().end()); | 826 DCHECK(window_i != parent()->children().end()); |
833 if (window_i != parent()->children().begin() && | 827 if (window_i != parent()->children().begin() && |
834 (*(window_i - 1) == stacking_target_)) | 828 (*(window_i - 1) == stacking_target_)) |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 notifier->NotifyWindowReordered(); | 958 notifier->NotifyWindowReordered(); |
965 | 959 |
966 return true; | 960 return true; |
967 } | 961 } |
968 | 962 |
969 // static | 963 // static |
970 Window** Window::GetStackingTarget(Window* window) { | 964 Window** Window::GetStackingTarget(Window* window) { |
971 return &window->stacking_target_; | 965 return &window->stacking_target_; |
972 } | 966 } |
973 } // namespace ui | 967 } // namespace ui |
OLD | NEW |