Chromium Code Reviews| 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 "components/mus/connection_manager.h" | 5 #include "components/mus/connection_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/quads/shared_quad_state.h" | 10 #include "cc/quads/shared_quad_state.h" |
| 11 #include "cc/quads/surface_draw_quad.h" | |
| 11 #include "components/mus/client_connection.h" | 12 #include "components/mus/client_connection.h" |
| 12 #include "components/mus/connection_manager_delegate.h" | 13 #include "components/mus/connection_manager_delegate.h" |
| 13 #include "components/mus/server_view.h" | 14 #include "components/mus/server_view.h" |
| 14 #include "components/mus/view_coordinate_conversions.h" | 15 #include "components/mus/view_coordinate_conversions.h" |
| 15 #include "components/mus/view_tree_host_connection.h" | 16 #include "components/mus/view_tree_host_connection.h" |
| 16 #include "components/mus/view_tree_impl.h" | 17 #include "components/mus/view_tree_impl.h" |
| 17 #include "mojo/application/public/cpp/application_connection.h" | 18 #include "mojo/application/public/cpp/application_connection.h" |
| 18 #include "mojo/converters/geometry/geometry_type_converters.h" | 19 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 19 #include "mojo/converters/input_events/input_events_type_converters.h" | 20 #include "mojo/converters/input_events/input_events_type_converters.h" |
| 20 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 21 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 unsigned int id = static_cast<unsigned int>( | 440 unsigned int id = static_cast<unsigned int>( |
| 440 input->surface_quad_state->surface.To<cc::SurfaceId>().id); | 441 input->surface_quad_state->surface.To<cc::SurfaceId>().id); |
| 441 // TODO(fsamuel): Security checks: | 442 // TODO(fsamuel): Security checks: |
| 442 // 1. We need to make sure the embedder can only position views it's allowed | 443 // 1. We need to make sure the embedder can only position views it's allowed |
| 443 // to access. | 444 // to access. |
| 444 // 2. We need to make sure that the embedder cannot place views in areas | 445 // 2. We need to make sure that the embedder cannot place views in areas |
| 445 // outside of its own bounds. | 446 // outside of its own bounds. |
| 446 ServerView* view = GetView(ViewIdFromTransportId(id)); | 447 ServerView* view = GetView(ViewIdFromTransportId(id)); |
| 447 // If a CompositorFrame message arrives late, say during a navigation, then | 448 // If a CompositorFrame message arrives late, say during a navigation, then |
| 448 // it may contain view IDs that no longer exist. | 449 // it may contain view IDs that no longer exist. |
| 449 if (!view) | 450 if (!view || view->surface_id().is_null()) |
| 450 return false; | 451 return false; |
| 451 gfx::Rect bounds(input->visible_rect.To<gfx::Rect>()); | 452 |
| 452 gfx::Point p; | 453 // TODO(fsamuel): This shouldn't be in the ConnectionManager. Let's fine a |
|
rjkroege
2015/09/17 19:03:56
fine -> find
Fady Samuel
2015/09/17 20:00:21
Done.
| |
| 453 sqs->quad_to_target_transform.TransformPoint(&p); | 454 // better home for it. http://crbug.com/533029. |
| 454 bounds.set_origin(p); | 455 cc::SurfaceDrawQuad* surface_quad = |
| 455 // TODO(fsamuel): This seems like a crude way to set the size that probably | 456 render_pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); |
| 456 // doesn't work correctly in the general case. We need to get transforms | 457 surface_quad->SetAll( |
| 457 // working correctly in the general case. | 458 sqs, |
| 458 bounds.set_size(gfx::ToRoundedSize( | 459 input->rect.To<gfx::Rect>(), |
| 459 gfx::ScaleSize(bounds.size(), metadata->device_scale_factor))); | 460 input->opaque_rect.To<gfx::Rect>(), |
| 460 view->SetBounds(bounds); | 461 input->visible_rect.To<gfx::Rect>(), |
| 462 input->needs_blending, | |
| 463 view->surface_id()); | |
| 461 return true; | 464 return true; |
| 462 } | 465 } |
| 463 | 466 |
| 464 } // namespace mus | 467 } // namespace mus |
| OLD | NEW |