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 <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 return active_display_list_[0]; | 863 return active_display_list_[0]; |
864 DisplayLayout layout = layout_store_->GetRegisteredDisplayLayout( | 864 DisplayLayout layout = layout_store_->GetRegisteredDisplayLayout( |
865 GetCurrentDisplayIdPair()); | 865 GetCurrentDisplayIdPair()); |
866 return GetDisplayForId(layout.primary_id); | 866 return GetDisplayForId(layout.primary_id); |
867 } | 867 } |
868 | 868 |
869 size_t DisplayManager::GetNumDisplays() const { | 869 size_t DisplayManager::GetNumDisplays() const { |
870 return active_display_list_.size(); | 870 return active_display_list_.size(); |
871 } | 871 } |
872 | 872 |
| 873 bool DisplayManager::IsActiveDisplayId(int64 display_id) const { |
| 874 return std::find_if(active_display_list_.begin(), active_display_list_.end(), |
| 875 [display_id](const gfx::Display& display) { |
| 876 return display.id() == display_id; |
| 877 }) != active_display_list_.end(); |
| 878 } |
| 879 |
873 bool DisplayManager::IsInMirrorMode() const { | 880 bool DisplayManager::IsInMirrorMode() const { |
874 return mirroring_display_id_ != gfx::Display::kInvalidDisplayID; | 881 return mirroring_display_id_ != gfx::Display::kInvalidDisplayID; |
875 } | 882 } |
876 | 883 |
877 void DisplayManager::SetUnifiedDesktopEnabled(bool enable) { | 884 void DisplayManager::SetUnifiedDesktopEnabled(bool enable) { |
878 unified_desktop_enabled_ = enable; | 885 unified_desktop_enabled_ = enable; |
879 // There is no need to update the displays in mirror mode. Doing | 886 // There is no need to update the displays in mirror mode. Doing |
880 // this in hardware mirroring mode can cause crash because display | 887 // this in hardware mirroring mode can cause crash because display |
881 // info in hardware mirroring comes from DisplayConfigurator. | 888 // info in hardware mirroring comes from DisplayConfigurator. |
882 if (!IsInMirrorMode()) | 889 if (!IsInMirrorMode()) |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 1410 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
1404 secondary_display->UpdateWorkAreaFromInsets(insets); | 1411 secondary_display->UpdateWorkAreaFromInsets(insets); |
1405 } | 1412 } |
1406 | 1413 |
1407 void DisplayManager::RunPendingTasksForTest() { | 1414 void DisplayManager::RunPendingTasksForTest() { |
1408 if (!software_mirroring_display_list_.empty()) | 1415 if (!software_mirroring_display_list_.empty()) |
1409 base::RunLoop().RunUntilIdle(); | 1416 base::RunLoop().RunUntilIdle(); |
1410 } | 1417 } |
1411 | 1418 |
1412 } // namespace ash | 1419 } // namespace ash |
OLD | NEW |