| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 size_t MultiDisplayManager::GetNumDisplays() const { | 283 size_t MultiDisplayManager::GetNumDisplays() const { |
| 284 return displays_.size(); | 284 return displays_.size(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow( | 287 const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow( |
| 288 const Window* window) const { | 288 const Window* window) const { |
| 289 if (!window) | 289 if (!window) |
| 290 return DisplayController::GetPrimaryDisplay(); | 290 return DisplayController::GetPrimaryDisplay(); |
| 291 const RootWindow* root = window->GetRootWindow(); | 291 const RootWindow* root = window->GetRootWindow(); |
| 292 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); | 292 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); |
| 293 return root ? manager->FindDisplayForRootWindow(root) : GetInvalidDisplay(); | 293 return root ? |
| 294 manager->FindDisplayForRootWindow(root) : |
| 295 DisplayController::GetPrimaryDisplay(); |
| 294 } | 296 } |
| 295 | 297 |
| 296 const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint( | 298 const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint( |
| 297 const gfx::Point& point) const { | 299 const gfx::Point& point) const { |
| 298 // Fallback to the primary display if there is no root display containing | 300 // Fallback to the primary display if there is no root display containing |
| 299 // the |point|. | 301 // the |point|. |
| 300 const gfx::Display& display = FindDisplayContainingPoint(point); | 302 const gfx::Display& display = FindDisplayContainingPoint(point); |
| 301 return display.is_valid() ? display : DisplayController::GetPrimaryDisplay(); | 303 return display.is_valid() ? display : DisplayController::GetPrimaryDisplay(); |
| 302 } | 304 } |
| 303 | 305 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 DisplayList::iterator iter_to_update = to_update->begin(); | 454 DisplayList::iterator iter_to_update = to_update->begin(); |
| 453 DisplayList::const_iterator iter = displays_.begin(); | 455 DisplayList::const_iterator iter = displays_.begin(); |
| 454 for (; iter != displays_.end() && iter_to_update != to_update->end(); | 456 for (; iter != displays_.end() && iter_to_update != to_update->end(); |
| 455 ++iter, ++iter_to_update) { | 457 ++iter, ++iter_to_update) { |
| 456 (*iter_to_update).set_id((*iter).id()); | 458 (*iter_to_update).set_id((*iter).id()); |
| 457 } | 459 } |
| 458 } | 460 } |
| 459 | 461 |
| 460 } // namespace internal | 462 } // namespace internal |
| 461 } // namespace ash | 463 } // namespace ash |
| OLD | NEW |