Chromium Code Reviews| 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_util.h" | 8 #include "ash/display/display_util.h" |
| 9 #include "ash/rotator/screen_rotation_animator.h" | 9 #include "ash/rotator/screen_rotation_animator.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "ui/display/display_layout.h" | 11 #include "ui/display/display_layout.h" |
| 12 #include "ui/display/manager/display_manager.h" | 12 #include "ui/display/manager/display_manager.h" |
| 13 | 13 |
| 14 #if defined(OS_CHROMEOS) | 14 #if defined(OS_CHROMEOS) |
| 15 #include "ash/display/display_animator_chromeos.h" | 15 #include "ash/display/display_animator_chromeos.h" |
| 16 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
| 17 #include "grit/ash_strings.h" | 17 #include "grit/ash_strings.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 // Specifies how long the display change should have been disabled | 23 // Specifies how long the display change should have been disabled |
| 23 // after each display change operations. | 24 // after each display change operations. |
| 24 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid | 25 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid |
| 25 // changing the settings while the system is still configurating | 26 // changing the settings while the system is still configurating |
| 26 // displays. It will be overriden by |kAfterDisplayChangeThrottleTimeoutMs| | 27 // displays. It will be overriden by |kAfterDisplayChangeThrottleTimeoutMs| |
| 27 // 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 weak_ptr_factory_.GetWeakPtr(), base::Passed(&layout))); | 78 weak_ptr_factory_.GetWeakPtr(), base::Passed(&layout))); |
| 78 } else { | 79 } else { |
| 79 SetDisplayLayoutImpl(std::move(layout)); | 80 SetDisplayLayoutImpl(std::move(layout)); |
| 80 } | 81 } |
| 81 } | 82 } |
| 82 | 83 |
| 83 void DisplayConfigurationController::SetMirrorMode(bool mirror, | 84 void DisplayConfigurationController::SetMirrorMode(bool mirror, |
| 84 bool user_action) { | 85 bool user_action) { |
| 85 if (display_manager_->num_connected_displays() > 2) { | 86 if (display_manager_->num_connected_displays() > 2) { |
| 86 #if defined(OS_CHROMEOS) | 87 #if defined(OS_CHROMEOS) |
| 87 if (user_action) | 88 if (user_action) { |
| 88 ShowDisplayErrorNotification(IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED); | 89 base::string16 message = |
| 90 l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED); | |
|
Evan Stade
2016/12/12 23:44:17
nit: I'd prefer to inline this instead of creating
Greg Levin
2016/12/13 01:48:59
Done.
| |
| 91 ShowDisplayErrorNotification(message, false); | |
| 92 } | |
| 89 #endif | 93 #endif |
| 90 return; | 94 return; |
| 91 } | 95 } |
| 92 if (display_manager_->num_connected_displays() <= 1 || | 96 if (display_manager_->num_connected_displays() <= 1 || |
| 93 display_manager_->IsInMirrorMode() == mirror || IsLimited()) { | 97 display_manager_->IsInMirrorMode() == mirror || IsLimited()) { |
| 94 return; | 98 return; |
| 95 } | 99 } |
| 96 SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); | 100 SetThrottleTimeout(kCycleDisplayThrottleTimeoutMs); |
| 97 if (user_action && display_animator_) { | 101 if (user_action && display_animator_) { |
| 98 display_animator_->StartFadeOutAnimation( | 102 display_animator_->StartFadeOutAnimation( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 } | 173 } |
| 170 | 174 |
| 171 void DisplayConfigurationController::SetPrimaryDisplayIdImpl( | 175 void DisplayConfigurationController::SetPrimaryDisplayIdImpl( |
| 172 int64_t display_id) { | 176 int64_t display_id) { |
| 173 window_tree_host_manager_->SetPrimaryDisplayId(display_id); | 177 window_tree_host_manager_->SetPrimaryDisplayId(display_id); |
| 174 if (display_animator_) | 178 if (display_animator_) |
| 175 display_animator_->StartFadeInAnimation(); | 179 display_animator_->StartFadeInAnimation(); |
| 176 } | 180 } |
| 177 | 181 |
| 178 } // namespace ash | 182 } // namespace ash |
| OLD | NEW |