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/view_manager/connection_manager.h" | 5 #include "services/view_manager/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 "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
10 #include "mojo/converters/input_events/input_events_type_converters.h" | 10 #include "mojo/converters/input_events/input_events_type_converters.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 void ConnectionManager::OnScheduleViewPaint(const ServerView* view) { | 442 void ConnectionManager::OnScheduleViewPaint(const ServerView* view) { |
443 if (!in_destructor_) | 443 if (!in_destructor_) |
444 display_manager_->SchedulePaint(view, gfx::Rect(view->bounds().size())); | 444 display_manager_->SchedulePaint(view, gfx::Rect(view->bounds().size())); |
445 } | 445 } |
446 | 446 |
447 void ConnectionManager::DispatchInputEventToView(mojo::Id transport_view_id, | 447 void ConnectionManager::DispatchInputEventToView(mojo::Id transport_view_id, |
448 mojo::EventPtr event) { | 448 mojo::EventPtr event) { |
449 const ViewId view_id(ViewIdFromTransportId(transport_view_id)); | 449 const ViewId view_id(ViewIdFromTransportId(transport_view_id)); |
450 | 450 |
451 ViewManagerServiceImpl* connection = GetConnectionWithRoot(view_id); | 451 ViewManagerServiceImpl* connection = GetConnectionWithRoot(view_id); |
452 // We only allow the connection that created a view to set properties on it. | |
453 // If the connection set 'event-root', then the connection wants the event and | |
454 // not any views that are embedded in it. | |
455 if (connection && GetView(view_id)->properties().count("event-root") > 0) | |
456 connection = nullptr; | |
457 if (!connection) | 452 if (!connection) |
458 connection = GetConnection(view_id.connection_id); | 453 connection = GetConnection(view_id.connection_id); |
459 if (connection) { | 454 if (connection) { |
460 connection->client()->OnViewInputEvent( | 455 connection->client()->OnViewInputEvent( |
461 transport_view_id, event.Pass(), base::Bind(&base::DoNothing)); | 456 transport_view_id, event.Pass(), base::Bind(&base::DoNothing)); |
462 } | 457 } |
463 } | 458 } |
464 | 459 |
465 void ConnectionManager::SetViewportSize(mojo::SizePtr size) { | 460 void ConnectionManager::SetViewportSize(mojo::SizePtr size) { |
466 gfx::Size new_size = size.To<gfx::Size>(); | 461 gfx::Size new_size = size.To<gfx::Size>(); |
467 display_manager_->SetViewportSize(new_size); | 462 display_manager_->SetViewportSize(new_size); |
468 } | 463 } |
469 | 464 |
470 void ConnectionManager::CloneAndAnimate(mojo::Id transport_view_id) { | 465 void ConnectionManager::CloneAndAnimate(mojo::Id transport_view_id) { |
471 CloneAndAnimate(ViewIdFromTransportId(transport_view_id)); | 466 CloneAndAnimate(ViewIdFromTransportId(transport_view_id)); |
472 } | 467 } |
473 | 468 |
474 } // namespace view_manager | 469 } // namespace view_manager |
OLD | NEW |