| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/display/chromeos/display_configurator.h" | 5 #include "ui/display/chromeos/display_configurator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 } | 847 } |
| 848 | 848 |
| 849 void DisplayConfigurator::AddObserver(Observer* observer) { | 849 void DisplayConfigurator::AddObserver(Observer* observer) { |
| 850 observers_.AddObserver(observer); | 850 observers_.AddObserver(observer); |
| 851 } | 851 } |
| 852 | 852 |
| 853 void DisplayConfigurator::RemoveObserver(Observer* observer) { | 853 void DisplayConfigurator::RemoveObserver(Observer* observer) { |
| 854 observers_.RemoveObserver(observer); | 854 observers_.RemoveObserver(observer); |
| 855 } | 855 } |
| 856 | 856 |
| 857 void DisplayConfigurator::SuspendDisplays() { | 857 void DisplayConfigurator::SuspendDisplays( |
| 858 const ConfigurationCallback& callback) { |
| 858 // If the display is off due to user inactivity and there's only a single | 859 // If the display is off due to user inactivity and there's only a single |
| 859 // internal display connected, switch to the all-on state before | 860 // internal display connected, switch to the all-on state before |
| 860 // suspending. This shouldn't be very noticeable to the user since the | 861 // suspending. This shouldn't be very noticeable to the user since the |
| 861 // backlight is off at this point, and doing this lets us resume directly | 862 // backlight is off at this point, and doing this lets us resume directly |
| 862 // into the "on" state, which greatly reduces resume times. | 863 // into the "on" state, which greatly reduces resume times. |
| 863 if (requested_power_state_ == chromeos::DISPLAY_POWER_ALL_OFF) { | 864 if (requested_power_state_ == chromeos::DISPLAY_POWER_ALL_OFF) { |
| 864 SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON, | 865 SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON, |
| 865 kSetDisplayPowerOnlyIfSingleInternalDisplay, | 866 kSetDisplayPowerOnlyIfSingleInternalDisplay, callback); |
| 866 base::Bind(&DoNothing)); | |
| 867 | 867 |
| 868 // We need to make sure that the monitor configuration we just did actually | 868 // We need to make sure that the monitor configuration we just did actually |
| 869 // completes before we return, because otherwise the X message could be | 869 // completes before we return, because otherwise the X message could be |
| 870 // racing with the HandleSuspendReadiness message. | 870 // racing with the HandleSuspendReadiness message. |
| 871 native_display_delegate_->SyncWithServer(); | 871 native_display_delegate_->SyncWithServer(); |
| 872 } else { |
| 873 callback.Run(true); |
| 872 } | 874 } |
| 873 | 875 |
| 874 displays_suspended_ = true; | 876 displays_suspended_ = true; |
| 875 | 877 |
| 876 // Stop |configure_timer_| because we will force probe and configure all the | 878 // Stop |configure_timer_| because we will force probe and configure all the |
| 877 // displays at resume time anyway. | 879 // displays at resume time anyway. |
| 878 configure_timer_.Stop(); | 880 configure_timer_.Stop(); |
| 879 } | 881 } |
| 880 | 882 |
| 881 void DisplayConfigurator::ResumeDisplays() { | 883 void DisplayConfigurator::ResumeDisplays() { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 FOR_EACH_OBSERVER( | 1025 FOR_EACH_OBSERVER( |
| 1024 Observer, observers_, OnDisplayModeChanged(cached_displays_)); | 1026 Observer, observers_, OnDisplayModeChanged(cached_displays_)); |
| 1025 } else { | 1027 } else { |
| 1026 FOR_EACH_OBSERVER( | 1028 FOR_EACH_OBSERVER( |
| 1027 Observer, observers_, OnDisplayModeChangeFailed(cached_displays_, | 1029 Observer, observers_, OnDisplayModeChangeFailed(cached_displays_, |
| 1028 attempted_state)); | 1030 attempted_state)); |
| 1029 } | 1031 } |
| 1030 } | 1032 } |
| 1031 | 1033 |
| 1032 } // namespace ui | 1034 } // namespace ui |
| OLD | NEW |