| 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/compositor_frame_sink.h" |
| 16 #include "services/ui/public/cpp/property_type_converters.h" | 17 #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/surface_id_handler.h" |
| 18 #include "services/ui/public/cpp/window_observer.h" | 19 #include "services/ui/public/cpp/window_observer.h" |
| 19 #include "services/ui/public/cpp/window_private.h" | 20 #include "services/ui/public/cpp/window_private.h" |
| 20 #include "services/ui/public/cpp/window_property.h" | 21 #include "services/ui/public/cpp/window_property.h" |
| 21 #include "services/ui/public/cpp/window_surface.h" | 22 #include "services/ui/public/cpp/window_surface.h" |
| 22 #include "services/ui/public/cpp/window_tracker.h" | 23 #include "services/ui/public/cpp/window_tracker.h" |
| 23 #include "services/ui/public/cpp/window_tree_client.h" | 24 #include "services/ui/public/cpp/window_tree_client.h" |
| 24 #include "services/ui/public/interfaces/window_manager.mojom.h" | 25 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 25 #include "ui/display/display.h" | 26 #include "ui/display/display.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 client_->SetPredefinedCursor(server_id_, cursor_id); | 263 client_->SetPredefinedCursor(server_id_, cursor_id); |
| 263 LocalSetPredefinedCursor(cursor_id); | 264 LocalSetPredefinedCursor(cursor_id); |
| 264 } | 265 } |
| 265 | 266 |
| 266 bool Window::IsDrawn() const { | 267 bool Window::IsDrawn() const { |
| 267 if (!visible_) | 268 if (!visible_) |
| 268 return false; | 269 return false; |
| 269 return parent_ ? parent_->IsDrawn() : parent_drawn_; | 270 return parent_ ? parent_->IsDrawn() : parent_drawn_; |
| 270 } | 271 } |
| 271 | 272 |
| 272 std::unique_ptr<WindowSurface> Window::RequestSurface(mojom::SurfaceType type) { | 273 std::unique_ptr<CompositorFrameSink> Window::RequestCompositorFrameSink( |
| 274 mojom::SurfaceType type, |
| 275 scoped_refptr<cc::ContextProvider> context_provider) { |
| 273 std::unique_ptr<WindowSurfaceBinding> surface_binding; | 276 std::unique_ptr<WindowSurfaceBinding> surface_binding; |
| 274 std::unique_ptr<WindowSurface> surface = | 277 std::unique_ptr<WindowSurface> surface = |
| 275 WindowSurface::Create(&surface_binding); | 278 WindowSurface::Create(&surface_binding); |
| 276 AttachSurface(type, std::move(surface_binding)); | 279 AttachCompositorFrameSink(type, std::move(surface_binding)); |
| 277 return surface; | 280 return base::MakeUnique<CompositorFrameSink>(std::move(context_provider), |
| 281 std::move(surface)); |
| 278 } | 282 } |
| 279 | 283 |
| 280 void Window::AttachSurface( | 284 void Window::AttachCompositorFrameSink( |
| 281 mojom::SurfaceType type, | 285 mojom::SurfaceType type, |
| 282 std::unique_ptr<WindowSurfaceBinding> surface_binding) { | 286 std::unique_ptr<WindowSurfaceBinding> surface_binding) { |
| 283 window_tree()->AttachSurface( | 287 window_tree()->AttachSurface( |
| 284 server_id_, type, std::move(surface_binding->surface_request_), | 288 server_id_, type, std::move(surface_binding->surface_request_), |
| 285 mojo::MakeProxy(std::move(surface_binding->surface_client_))); | 289 mojo::MakeProxy(std::move(surface_binding->surface_client_))); |
| 286 } | 290 } |
| 287 | 291 |
| 288 void Window::ClearSharedProperty(const std::string& name) { | 292 void Window::ClearSharedProperty(const std::string& name) { |
| 289 SetSharedPropertyInternal(name, nullptr); | 293 SetSharedPropertyInternal(name, nullptr); |
| 290 } | 294 } |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 notifier->NotifyWindowReordered(); | 962 notifier->NotifyWindowReordered(); |
| 959 | 963 |
| 960 return true; | 964 return true; |
| 961 } | 965 } |
| 962 | 966 |
| 963 // static | 967 // static |
| 964 Window** Window::GetStackingTarget(Window* window) { | 968 Window** Window::GetStackingTarget(Window* window) { |
| 965 return &window->stacking_target_; | 969 return &window->stacking_target_; |
| 966 } | 970 } |
| 967 } // namespace ui | 971 } // namespace ui |
| OLD | NEW |