| 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 "chromeos/system/devicemode.h" |
| 17 #include "grit/ash_strings.h" | 17 #include "grit/ash_strings.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // Specifies how long the display change should have been disabled | 23 // Specifies how long the display change should have been disabled |
| 24 // after each display change operations. | 24 // after each display change operations. |
| 25 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid | 25 // |kCycleDisplayThrottleTimeoutMs| is set to be longer to avoid |
| 26 // changing the settings while the system is still configurating | 26 // changing the settings while the system is still configurating |
| (...skipping 25 matching lines...) Expand all Loading... |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 DisplayConfigurationController::DisplayConfigurationController( | 54 DisplayConfigurationController::DisplayConfigurationController( |
| 55 display::DisplayManager* display_manager, | 55 display::DisplayManager* display_manager, |
| 56 WindowTreeHostManager* window_tree_host_manager) | 56 WindowTreeHostManager* window_tree_host_manager) |
| 57 : display_manager_(display_manager), | 57 : display_manager_(display_manager), |
| 58 window_tree_host_manager_(window_tree_host_manager), | 58 window_tree_host_manager_(window_tree_host_manager), |
| 59 weak_ptr_factory_(this) { | 59 weak_ptr_factory_(this) { |
| 60 window_tree_host_manager_->AddObserver(this); | 60 window_tree_host_manager_->AddObserver(this); |
| 61 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
| 62 if (base::SysInfo::IsRunningOnChromeOS()) | 62 if (chromeos::IsRunningAsSystemCompositor()) |
| 63 limiter_.reset(new DisplayChangeLimiter); | 63 limiter_.reset(new DisplayChangeLimiter); |
| 64 display_animator_.reset(new DisplayAnimatorChromeOS()); | 64 display_animator_.reset(new DisplayAnimatorChromeOS()); |
| 65 #endif | 65 #endif |
| 66 } | 66 } |
| 67 | 67 |
| 68 DisplayConfigurationController::~DisplayConfigurationController() { | 68 DisplayConfigurationController::~DisplayConfigurationController() { |
| 69 window_tree_host_manager_->RemoveObserver(this); | 69 window_tree_host_manager_->RemoveObserver(this); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void DisplayConfigurationController::SetDisplayLayout( | 72 void DisplayConfigurationController::SetDisplayLayout( |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 void DisplayConfigurationController::SetPrimaryDisplayIdImpl( | 175 void DisplayConfigurationController::SetPrimaryDisplayIdImpl( |
| 176 int64_t display_id) { | 176 int64_t display_id) { |
| 177 window_tree_host_manager_->SetPrimaryDisplayId(display_id); | 177 window_tree_host_manager_->SetPrimaryDisplayId(display_id); |
| 178 if (display_animator_) | 178 if (display_animator_) |
| 179 display_animator_->StartFadeInAnimation(); | 179 display_animator_->StartFadeInAnimation(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace ash | 182 } // namespace ash |
| OLD | NEW |