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 "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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 | 238 |
| 239 void ConnectionManager::ProcessViewBoundsChanged(const ServerView* view, | 239 void ConnectionManager::ProcessViewBoundsChanged(const ServerView* view, |
| 240 const gfx::Rect& old_bounds, | 240 const gfx::Rect& old_bounds, |
| 241 const gfx::Rect& new_bounds) { | 241 const gfx::Rect& new_bounds) { |
| 242 for (auto& pair : connection_map_) { | 242 for (auto& pair : connection_map_) { |
| 243 pair.second->service()->ProcessViewBoundsChanged( | 243 pair.second->service()->ProcessViewBoundsChanged( |
| 244 view, old_bounds, new_bounds, IsChangeSource(pair.first)); | 244 view, old_bounds, new_bounds, IsChangeSource(pair.first)); |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 void ConnectionManager::ProcessViewportMetricsChanged( | |
| 249 const ServerView* view, | |
| 250 const mojo::ViewportMetrics& old_metrics, | |
| 251 const mojo::ViewportMetrics& new_metrics) { | |
| 252 for (auto& pair : connection_map_) { | |
| 253 pair.second->service()->ProcessViewportMetricsChanged( | |
| 254 view, old_metrics, new_metrics, IsChangeSource(pair.first)); | |
| 255 } | |
| 256 } | |
| 257 | |
| 248 void ConnectionManager::ProcessWillChangeViewHierarchy( | 258 void ConnectionManager::ProcessWillChangeViewHierarchy( |
| 249 const ServerView* view, | 259 const ServerView* view, |
| 250 const ServerView* new_parent, | 260 const ServerView* new_parent, |
| 251 const ServerView* old_parent) { | 261 const ServerView* old_parent) { |
| 252 for (auto& pair : connection_map_) { | 262 for (auto& pair : connection_map_) { |
| 253 pair.second->service()->ProcessWillChangeViewHierarchy( | 263 pair.second->service()->ProcessWillChangeViewHierarchy( |
| 254 view, new_parent, old_parent, IsChangeSource(pair.first)); | 264 view, new_parent, old_parent, IsChangeSource(pair.first)); |
| 255 } | 265 } |
| 256 } | 266 } |
| 257 | 267 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 | 379 |
| 370 ProcessViewBoundsChanged(view, old_bounds, new_bounds); | 380 ProcessViewBoundsChanged(view, old_bounds, new_bounds); |
| 371 if (!view->parent()) | 381 if (!view->parent()) |
| 372 return; | 382 return; |
| 373 | 383 |
| 374 // TODO(sky): optimize this. | 384 // TODO(sky): optimize this. |
| 375 display_manager_->SchedulePaint(view->parent(), old_bounds); | 385 display_manager_->SchedulePaint(view->parent(), old_bounds); |
| 376 display_manager_->SchedulePaint(view->parent(), new_bounds); | 386 display_manager_->SchedulePaint(view->parent(), new_bounds); |
| 377 } | 387 } |
| 378 | 388 |
| 389 void ConnectionManager::OnViewViewportMetricsChanged( | |
| 390 const ServerView* view, | |
| 391 const mojo::ViewportMetrics& old_metrics, | |
| 392 const mojo::ViewportMetrics& new_metrics) { | |
| 393 if (in_destructor_) | |
| 394 return; | |
| 395 | |
| 396 ProcessViewportMetricsChanged(view, old_metrics, new_metrics); | |
| 397 // TODO(sky): Do we need to repaint here? | |
|
sky
2015/01/27 23:40:23
I would think not.
| |
| 398 } | |
| 399 | |
| 379 void ConnectionManager::OnViewSurfaceIdChanged(const ServerView* view) { | 400 void ConnectionManager::OnViewSurfaceIdChanged(const ServerView* view) { |
| 380 if (!in_destructor_) | 401 if (!in_destructor_) |
| 381 display_manager_->SchedulePaint(view, gfx::Rect(view->bounds().size())); | 402 display_manager_->SchedulePaint(view, gfx::Rect(view->bounds().size())); |
| 382 } | 403 } |
| 383 | 404 |
| 384 void ConnectionManager::OnViewReordered(const ServerView* view, | 405 void ConnectionManager::OnViewReordered(const ServerView* view, |
| 385 const ServerView* relative, | 406 const ServerView* relative, |
| 386 mojo::OrderDirection direction) { | 407 mojo::OrderDirection direction) { |
| 387 if (!in_destructor_) | 408 if (!in_destructor_) |
| 388 display_manager_->SchedulePaint(view, gfx::Rect(view->bounds().size())); | 409 display_manager_->SchedulePaint(view, gfx::Rect(view->bounds().size())); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 void ConnectionManager::SetViewportSize(mojo::SizePtr size) { | 475 void ConnectionManager::SetViewportSize(mojo::SizePtr size) { |
| 455 gfx::Size new_size = size.To<gfx::Size>(); | 476 gfx::Size new_size = size.To<gfx::Size>(); |
| 456 display_manager_->SetViewportSize(new_size); | 477 display_manager_->SetViewportSize(new_size); |
| 457 } | 478 } |
| 458 | 479 |
| 459 void ConnectionManager::CloneAndAnimate(mojo::Id transport_view_id) { | 480 void ConnectionManager::CloneAndAnimate(mojo::Id transport_view_id) { |
| 460 CloneAndAnimate(ViewIdFromTransportId(transport_view_id)); | 481 CloneAndAnimate(ViewIdFromTransportId(transport_view_id)); |
| 461 } | 482 } |
| 462 | 483 |
| 463 } // namespace view_manager | 484 } // namespace view_manager |
| OLD | NEW |