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" | |
17 #include "services/ui/public/cpp/property_type_converters.h" | 16 #include "services/ui/public/cpp/property_type_converters.h" |
18 #include "services/ui/public/cpp/surface_id_handler.h" | 17 #include "services/ui/public/cpp/surface_id_handler.h" |
18 #include "services/ui/public/cpp/window_compositor_frame_sink.h" | |
19 #include "services/ui/public/cpp/window_observer.h" | 19 #include "services/ui/public/cpp/window_observer.h" |
20 #include "services/ui/public/cpp/window_private.h" | 20 #include "services/ui/public/cpp/window_private.h" |
21 #include "services/ui/public/cpp/window_property.h" | 21 #include "services/ui/public/cpp/window_property.h" |
22 #include "services/ui/public/cpp/window_surface.h" | |
23 #include "services/ui/public/cpp/window_tracker.h" | 22 #include "services/ui/public/cpp/window_tracker.h" |
24 #include "services/ui/public/cpp/window_tree_client.h" | 23 #include "services/ui/public/cpp/window_tree_client.h" |
25 #include "services/ui/public/interfaces/window_manager.mojom.h" | 24 #include "services/ui/public/interfaces/window_manager.mojom.h" |
26 #include "ui/display/display.h" | 25 #include "ui/display/display.h" |
27 #include "ui/gfx/geometry/rect.h" | 26 #include "ui/gfx/geometry/rect.h" |
28 #include "ui/gfx/geometry/size.h" | 27 #include "ui/gfx/geometry/size.h" |
29 | 28 |
30 namespace ui { | 29 namespace ui { |
31 | 30 |
32 namespace { | 31 namespace { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 client_->SetPredefinedCursor(server_id_, cursor_id); | 262 client_->SetPredefinedCursor(server_id_, cursor_id); |
264 LocalSetPredefinedCursor(cursor_id); | 263 LocalSetPredefinedCursor(cursor_id); |
265 } | 264 } |
266 | 265 |
267 bool Window::IsDrawn() const { | 266 bool Window::IsDrawn() const { |
268 if (!visible_) | 267 if (!visible_) |
269 return false; | 268 return false; |
270 return parent_ ? parent_->IsDrawn() : parent_drawn_; | 269 return parent_ ? parent_->IsDrawn() : parent_drawn_; |
271 } | 270 } |
272 | 271 |
273 std::unique_ptr<CompositorFrameSink> Window::RequestCompositorFrameSink( | 272 std::unique_ptr<WindowCompositorFrameSink> Window::RequestCompositorFrameSink( |
rjkroege
2016/10/20 22:22:18
my whining about long names applies. using is nice
Fady Samuel
2016/10/21 20:53:27
As per offline conversation, I'm ignoring this. I
| |
274 mojom::SurfaceType type, | 273 mojom::CompositorFrameSinkType type, |
275 scoped_refptr<cc::ContextProvider> context_provider) { | 274 scoped_refptr<cc::ContextProvider> context_provider) { |
276 std::unique_ptr<WindowSurfaceBinding> surface_binding; | 275 std::unique_ptr<WindowCompositorFrameSinkBinding> |
277 std::unique_ptr<WindowSurface> surface = | 276 compositor_frame_sink_binding; |
278 WindowSurface::Create(&surface_binding); | 277 std::unique_ptr<WindowCompositorFrameSink> compositor_frame_sink = |
279 AttachCompositorFrameSink(type, std::move(surface_binding)); | 278 WindowCompositorFrameSink::Create(std::move(context_provider), |
280 return base::MakeUnique<CompositorFrameSink>(std::move(context_provider), | 279 &compositor_frame_sink_binding); |
281 std::move(surface)); | 280 AttachCompositorFrameSink(type, std::move(compositor_frame_sink_binding)); |
281 return compositor_frame_sink; | |
282 } | 282 } |
283 | 283 |
284 void Window::AttachCompositorFrameSink( | 284 void Window::AttachCompositorFrameSink( |
285 mojom::SurfaceType type, | 285 mojom::CompositorFrameSinkType type, |
286 std::unique_ptr<WindowSurfaceBinding> surface_binding) { | 286 std::unique_ptr<WindowCompositorFrameSinkBinding> |
287 window_tree()->AttachSurface( | 287 compositor_frame_sink_binding) { |
288 server_id_, type, std::move(surface_binding->surface_request_), | 288 window_tree()->AttachCompositorFrameSink( |
289 mojo::MakeProxy(std::move(surface_binding->surface_client_))); | 289 server_id_, type, |
290 std::move(compositor_frame_sink_binding->compositor_frame_sink_request_), | |
291 mojo::MakeProxy(std::move( | |
292 compositor_frame_sink_binding->compositor_frame_sink_client_))); | |
290 } | 293 } |
291 | 294 |
292 void Window::ClearSharedProperty(const std::string& name) { | 295 void Window::ClearSharedProperty(const std::string& name) { |
293 SetSharedPropertyInternal(name, nullptr); | 296 SetSharedPropertyInternal(name, nullptr); |
294 } | 297 } |
295 | 298 |
296 bool Window::HasSharedProperty(const std::string& name) const { | 299 bool Window::HasSharedProperty(const std::string& name) const { |
297 return properties_.count(name) > 0; | 300 return properties_.count(name) > 0; |
298 } | 301 } |
299 | 302 |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
962 notifier->NotifyWindowReordered(); | 965 notifier->NotifyWindowReordered(); |
963 | 966 |
964 return true; | 967 return true; |
965 } | 968 } |
966 | 969 |
967 // static | 970 // static |
968 Window** Window::GetStackingTarget(Window* window) { | 971 Window** Window::GetStackingTarget(Window* window) { |
969 return &window->stacking_target_; | 972 return &window->stacking_target_; |
970 } | 973 } |
971 } // namespace ui | 974 } // namespace ui |
OLD | NEW |