Chromium Code Reviews| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 return false; | 316 return false; |
| 317 } | 317 } |
| 318 | 318 |
| 319 size.set_width(std::max<int>(size.width(), mode_info->size().width())); | 319 size.set_width(std::max<int>(size.width(), mode_info->size().width())); |
| 320 size.set_height(size.height() + (size.height() ? kVerticalGap : 0) + | 320 size.set_height(size.height() + (size.height() ? kVerticalGap : 0) + |
| 321 mode_info->size().height()); | 321 mode_info->size().height()); |
| 322 } | 322 } |
| 323 break; | 323 break; |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 | 326 DCHECK(new_display_state == MULTIPLE_DISPLAY_STATE_HEADLESS || |
| 327 !size.IsEmpty()); | |
| 327 *framebuffer_size = size; | 328 *framebuffer_size = size; |
| 328 return true; | 329 return true; |
| 329 } | 330 } |
| 330 | 331 |
| 331 const DisplayMode* | 332 const DisplayMode* |
| 332 DisplayConfigurator::DisplayLayoutManagerImpl::GetUserSelectedMode( | 333 DisplayConfigurator::DisplayLayoutManagerImpl::GetUserSelectedMode( |
| 333 const DisplaySnapshot& display) const { | 334 const DisplaySnapshot& display) const { |
| 334 gfx::Size size; | 335 gfx::Size size; |
| 335 const DisplayMode* selected_mode = nullptr; | 336 const DisplayMode* selected_mode = nullptr; |
| 336 if (GetStateController() && | 337 if (GetStateController() && |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 912 MultipleDisplayState new_display_state, | 913 MultipleDisplayState new_display_state, |
| 913 chromeos::DisplayPowerState new_power_state) { | 914 chromeos::DisplayPowerState new_power_state) { |
| 914 VLOG(1) << "OnConfigured: success=" << success << " new_display_state=" | 915 VLOG(1) << "OnConfigured: success=" << success << " new_display_state=" |
| 915 << MultipleDisplayStateToString(new_display_state) | 916 << MultipleDisplayStateToString(new_display_state) |
| 916 << " new_power_state=" << DisplayPowerStateToString(new_power_state); | 917 << " new_power_state=" << DisplayPowerStateToString(new_power_state); |
| 917 | 918 |
| 918 cached_displays_ = displays; | 919 cached_displays_ = displays; |
| 919 if (success) { | 920 if (success) { |
| 920 current_display_state_ = new_display_state; | 921 current_display_state_ = new_display_state; |
| 921 current_power_state_ = new_power_state; | 922 current_power_state_ = new_power_state; |
| 922 framebuffer_size_ = framebuffer_size; | 923 |
| 924 // |framebuffer_size| is empty in software mirroring mode, headless mode, | |
| 925 // or all displays are off. | |
| 926 DCHECK(!framebuffer_size.IsEmpty() || | |
| 927 mirroring_controller_->SoftwareMirroringEnabled() || | |
| 928 new_display_state == MULTIPLE_DISPLAY_STATE_HEADLESS || | |
| 929 new_power_state == chromeos::DISPLAY_POWER_ALL_OFF); | |
|
dnicoara
2015/03/20 18:36:42
Shouldn't happen when the display power is all off
oshima
2015/03/20 20:30:08
when suspending display(s), it may skip actual con
dnicoara
2015/03/20 20:37:36
Acknowledged.
| |
| 930 | |
| 931 if (!framebuffer_size.IsEmpty()) | |
| 932 framebuffer_size_ = framebuffer_size; | |
| 933 | |
| 923 // If the requested power state hasn't changed then make sure that value | 934 // If the requested power state hasn't changed then make sure that value |
| 924 // gets updated as well since the last requested value may have been | 935 // gets updated as well since the last requested value may have been |
| 925 // dependent on certain conditions (ie: if only the internal monitor was | 936 // dependent on certain conditions (ie: if only the internal monitor was |
| 926 // present). | 937 // present). |
| 927 if (!requested_power_state_change_) | 938 if (!requested_power_state_change_) |
| 928 requested_power_state_ = new_power_state; | 939 requested_power_state_ = new_power_state; |
| 929 } | 940 } |
| 930 | 941 |
| 931 configuration_task_.reset(); | 942 configuration_task_.reset(); |
| 932 NotifyObservers(success, new_display_state); | 943 NotifyObservers(success, new_display_state); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 989 FOR_EACH_OBSERVER( | 1000 FOR_EACH_OBSERVER( |
| 990 Observer, observers_, OnDisplayModeChanged(cached_displays_)); | 1001 Observer, observers_, OnDisplayModeChanged(cached_displays_)); |
| 991 } else { | 1002 } else { |
| 992 FOR_EACH_OBSERVER( | 1003 FOR_EACH_OBSERVER( |
| 993 Observer, observers_, OnDisplayModeChangeFailed(cached_displays_, | 1004 Observer, observers_, OnDisplayModeChangeFailed(cached_displays_, |
| 994 attempted_state)); | 1005 attempted_state)); |
| 995 } | 1006 } |
| 996 } | 1007 } |
| 997 | 1008 |
| 998 } // namespace ui | 1009 } // namespace ui |
| OLD | NEW |