| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_configuration_controller.h" | 5 #include "ash/display/display_configuration_controller.h" |
| 6 | 6 |
| 7 #include "ash/display/display_animator.h" | 7 #include "ash/display/display_animator.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/display/display_util.h" |
| 9 #include "ash/rotator/screen_rotation_animator.h" | 10 #include "ash/rotator/screen_rotation_animator.h" |
| 10 #include "ash/screen_util.h" | 11 #include "ash/screen_util.h" |
| 11 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 12 #include "ui/display/manager/display_layout.h" | 13 #include "ui/display/manager/display_layout.h" |
| 13 | 14 |
| 14 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
| 15 #include "ash/display/display_animator_chromeos.h" | 16 #include "ash/display/display_animator_chromeos.h" |
| 16 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
| 18 #include "grit/ash_strings.h" |
| 17 #endif | 19 #endif |
| 18 | 20 |
| 19 namespace { | 21 namespace { |
| 20 | 22 |
| 21 // Specifies how long the display change should have been disabled | 23 // Specifies how long the display change should have been disabled |
| 22 // after each display change operations. | 24 // after each display change operations. |
| 23 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid | 25 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid |
| 24 // changing the settings while the system is still configurating | 26 // changing the settings while the system is still configurating |
| 25 // displays. It will be overriden by |kAfterDisplayChangeThrottleTimeoutMs| | 27 // displays. It will be overriden by |kAfterDisplayChangeThrottleTimeoutMs| |
| 26 // when the display change happens, so the actual timeout is much shorter. | 28 // when the display change happens, so the actual timeout is much shorter. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 display_animator_->StartFadeOutAnimation( | 76 display_animator_->StartFadeOutAnimation( |
| 75 base::Bind(&DisplayConfigurationController::SetDisplayLayoutImpl, | 77 base::Bind(&DisplayConfigurationController::SetDisplayLayoutImpl, |
| 76 weak_ptr_factory_.GetWeakPtr(), base::Passed(&layout))); | 78 weak_ptr_factory_.GetWeakPtr(), base::Passed(&layout))); |
| 77 } else { | 79 } else { |
| 78 SetDisplayLayoutImpl(std::move(layout)); | 80 SetDisplayLayoutImpl(std::move(layout)); |
| 79 } | 81 } |
| 80 } | 82 } |
| 81 | 83 |
| 82 void DisplayConfigurationController::SetMirrorMode(bool mirror, | 84 void DisplayConfigurationController::SetMirrorMode(bool mirror, |
| 83 bool user_action) { | 85 bool user_action) { |
| 86 if (display_manager_->num_connected_displays() > 2) { |
| 87 #if defined(OS_CHROMEOS) |
| 88 if (user_action) |
| 89 ShowDisplayErrorNotification(IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED); |
| 90 #endif |
| 91 return; |
| 92 } |
| 84 if (display_manager_->num_connected_displays() <= 1 || | 93 if (display_manager_->num_connected_displays() <= 1 || |
| 85 display_manager_->IsInMirrorMode() == mirror || IsLimited()) { | 94 display_manager_->IsInMirrorMode() == mirror || IsLimited()) { |
| 86 return; | 95 return; |
| 87 } | 96 } |
| 88 SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); | 97 SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); |
| 89 if (user_action && display_animator_) { | 98 if (user_action && display_animator_) { |
| 90 display_animator_->StartFadeOutAnimation( | 99 display_animator_->StartFadeOutAnimation( |
| 91 base::Bind(&DisplayConfigurationController::SetMirrorModeImpl, | 100 base::Bind(&DisplayConfigurationController::SetMirrorModeImpl, |
| 92 weak_ptr_factory_.GetWeakPtr(), mirror)); | 101 weak_ptr_factory_.GetWeakPtr(), mirror)); |
| 93 } else { | 102 } else { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 170 } |
| 162 | 171 |
| 163 void DisplayConfigurationController::SetPrimaryDisplayIdImpl( | 172 void DisplayConfigurationController::SetPrimaryDisplayIdImpl( |
| 164 int64_t display_id) { | 173 int64_t display_id) { |
| 165 window_tree_host_manager_->SetPrimaryDisplayId(display_id); | 174 window_tree_host_manager_->SetPrimaryDisplayId(display_id); |
| 166 if (display_animator_) | 175 if (display_animator_) |
| 167 display_animator_->StartFadeInAnimation(); | 176 display_animator_->StartFadeInAnimation(); |
| 168 } | 177 } |
| 169 | 178 |
| 170 } // namespace ash | 179 } // namespace ash |
| OLD | NEW |