| 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/display_manager.h" | 5 #include "ash/display/display_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 kMinimumOverlapForInvalidOffset); | 1402 kMinimumOverlapForInvalidOffset); |
| 1403 } | 1403 } |
| 1404 | 1404 |
| 1405 void DisplayManager::RunPendingTasksForTest() { | 1405 void DisplayManager::RunPendingTasksForTest() { |
| 1406 if (!software_mirroring_display_list_.empty()) | 1406 if (!software_mirroring_display_list_.empty()) |
| 1407 base::RunLoop().RunUntilIdle(); | 1407 base::RunLoop().RunUntilIdle(); |
| 1408 } | 1408 } |
| 1409 | 1409 |
| 1410 void DisplayManager::NotifyMetricsChanged(const display::Display& display, | 1410 void DisplayManager::NotifyMetricsChanged(const display::Display& display, |
| 1411 uint32_t metrics) { | 1411 uint32_t metrics) { |
| 1412 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, | 1412 for (auto& observer : observers_) |
| 1413 OnDisplayMetricsChanged(display, metrics)); | 1413 observer.OnDisplayMetricsChanged(display, metrics); |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 void DisplayManager::NotifyDisplayAdded(const display::Display& display) { | 1416 void DisplayManager::NotifyDisplayAdded(const display::Display& display) { |
| 1417 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, | 1417 for (auto& observer : observers_) |
| 1418 OnDisplayAdded(display)); | 1418 observer.OnDisplayAdded(display); |
| 1419 } | 1419 } |
| 1420 | 1420 |
| 1421 void DisplayManager::NotifyDisplayRemoved(const display::Display& display) { | 1421 void DisplayManager::NotifyDisplayRemoved(const display::Display& display) { |
| 1422 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, | 1422 for (auto& observer : observers_) |
| 1423 OnDisplayRemoved(display)); | 1423 observer.OnDisplayRemoved(display); |
| 1424 } | 1424 } |
| 1425 | 1425 |
| 1426 void DisplayManager::AddObserver(display::DisplayObserver* observer) { | 1426 void DisplayManager::AddObserver(display::DisplayObserver* observer) { |
| 1427 observers_.AddObserver(observer); | 1427 observers_.AddObserver(observer); |
| 1428 } | 1428 } |
| 1429 | 1429 |
| 1430 void DisplayManager::RemoveObserver(display::DisplayObserver* observer) { | 1430 void DisplayManager::RemoveObserver(display::DisplayObserver* observer) { |
| 1431 observers_.RemoveObserver(observer); | 1431 observers_.RemoveObserver(observer); |
| 1432 } | 1432 } |
| 1433 | 1433 |
| 1434 const display::Display& DisplayManager::GetSecondaryDisplay() const { | 1434 const display::Display& DisplayManager::GetSecondaryDisplay() const { |
| 1435 CHECK_LE(2U, GetNumDisplays()); | 1435 CHECK_LE(2U, GetNumDisplays()); |
| 1436 return GetDisplayAt(0).id() == | 1436 return GetDisplayAt(0).id() == |
| 1437 display::Screen::GetScreen()->GetPrimaryDisplay().id() | 1437 display::Screen::GetScreen()->GetPrimaryDisplay().id() |
| 1438 ? GetDisplayAt(1) | 1438 ? GetDisplayAt(1) |
| 1439 : GetDisplayAt(0); | 1439 : GetDisplayAt(0); |
| 1440 } | 1440 } |
| 1441 | 1441 |
| 1442 } // namespace ash | 1442 } // namespace ash |
| OLD | NEW |