| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/display/multi_display_manager.h" | 5 #include "ash/display/multi_display_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 const gfx::Display& MultiDisplayManager::GetDisplayMatching( | 333 const gfx::Display& MultiDisplayManager::GetDisplayMatching( |
| 334 const gfx::Rect& rect) const { | 334 const gfx::Rect& rect) const { |
| 335 if (rect.IsEmpty()) | 335 if (rect.IsEmpty()) |
| 336 return GetDisplayNearestPoint(rect.origin()); | 336 return GetDisplayNearestPoint(rect.origin()); |
| 337 | 337 |
| 338 int max = 0; | 338 int max = 0; |
| 339 const gfx::Display* matching = 0; | 339 const gfx::Display* matching = 0; |
| 340 for (std::vector<gfx::Display>::const_iterator iter = displays_.begin(); | 340 for (std::vector<gfx::Display>::const_iterator iter = displays_.begin(); |
| 341 iter != displays_.end(); ++iter) { | 341 iter != displays_.end(); ++iter) { |
| 342 const gfx::Display& display = *iter; | 342 const gfx::Display& display = *iter; |
| 343 gfx::Rect intersect = display.bounds().Intersect(rect); | 343 gfx::Rect intersect = display.bounds(); |
| 344 intersect.Intersect(rect); |
| 344 int area = intersect.width() * intersect.height(); | 345 int area = intersect.width() * intersect.height(); |
| 345 if (area > max) { | 346 if (area > max) { |
| 346 max = area; | 347 max = area; |
| 347 matching = &(*iter); | 348 matching = &(*iter); |
| 348 } | 349 } |
| 349 } | 350 } |
| 350 // Fallback to the primary display if there is no matching display. | 351 // Fallback to the primary display if there is no matching display. |
| 351 return matching ? *matching : DisplayController::GetPrimaryDisplay(); | 352 return matching ? *matching : DisplayController::GetPrimaryDisplay(); |
| 352 } | 353 } |
| 353 | 354 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 DisplayList::iterator iter_to_update = to_update->begin(); | 484 DisplayList::iterator iter_to_update = to_update->begin(); |
| 484 DisplayList::const_iterator iter = displays_.begin(); | 485 DisplayList::const_iterator iter = displays_.begin(); |
| 485 for (; iter != displays_.end() && iter_to_update != to_update->end(); | 486 for (; iter != displays_.end() && iter_to_update != to_update->end(); |
| 486 ++iter, ++iter_to_update) { | 487 ++iter, ++iter_to_update) { |
| 487 (*iter_to_update).set_id((*iter).id()); | 488 (*iter_to_update).set_id((*iter).id()); |
| 488 } | 489 } |
| 489 } | 490 } |
| 490 | 491 |
| 491 } // namespace internal | 492 } // namespace internal |
| 492 } // namespace ash | 493 } // namespace ash |
| OLD | NEW |