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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 size_t MultiDisplayManager::GetNumDisplays() const { | 310 size_t MultiDisplayManager::GetNumDisplays() const { |
311 return displays_.size(); | 311 return displays_.size(); |
312 } | 312 } |
313 | 313 |
314 const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow( | 314 const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow( |
315 const Window* window) const { | 315 const Window* window) const { |
316 if (!window) | 316 if (!window) |
317 return DisplayController::GetPrimaryDisplay(); | 317 return DisplayController::GetPrimaryDisplay(); |
318 const RootWindow* root = window->GetRootWindow(); | 318 const RootWindow* root = window->GetRootWindow(); |
319 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); | 319 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); |
320 return root ? | 320 return root ? manager->FindDisplayForRootWindow(root) : GetInvalidDisplay(); |
321 manager->FindDisplayForRootWindow(root) : | |
322 DisplayController::GetPrimaryDisplay(); | |
323 } | 321 } |
324 | 322 |
325 const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint( | 323 const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint( |
326 const gfx::Point& point) const { | 324 const gfx::Point& point) const { |
327 // Fallback to the primary display if there is no root display containing | 325 // Fallback to the primary display if there is no root display containing |
328 // the |point|. | 326 // the |point|. |
329 const gfx::Display& display = FindDisplayContainingPoint(point); | 327 const gfx::Display& display = FindDisplayContainingPoint(point); |
330 return display.is_valid() ? display : DisplayController::GetPrimaryDisplay(); | 328 return display.is_valid() ? display : DisplayController::GetPrimaryDisplay(); |
331 } | 329 } |
332 | 330 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 DisplayList::iterator iter_to_update = to_update->begin(); | 481 DisplayList::iterator iter_to_update = to_update->begin(); |
484 DisplayList::const_iterator iter = displays_.begin(); | 482 DisplayList::const_iterator iter = displays_.begin(); |
485 for (; iter != displays_.end() && iter_to_update != to_update->end(); | 483 for (; iter != displays_.end() && iter_to_update != to_update->end(); |
486 ++iter, ++iter_to_update) { | 484 ++iter, ++iter_to_update) { |
487 (*iter_to_update).set_id((*iter).id()); | 485 (*iter_to_update).set_id((*iter).id()); |
488 } | 486 } |
489 } | 487 } |
490 | 488 |
491 } // namespace internal | 489 } // namespace internal |
492 } // namespace ash | 490 } // namespace ash |
OLD | NEW |