| 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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 return best_mode; | 154 return best_mode; |
| 155 } | 155 } |
| 156 | 156 |
| 157 DisplayConfigurator::DisplayConfigurator() | 157 DisplayConfigurator::DisplayConfigurator() |
| 158 : state_controller_(NULL), | 158 : state_controller_(NULL), |
| 159 mirroring_controller_(NULL), | 159 mirroring_controller_(NULL), |
| 160 is_panel_fitting_enabled_(false), | 160 is_panel_fitting_enabled_(false), |
| 161 configure_display_(base::SysInfo::IsRunningOnChromeOS()), | 161 configure_display_(base::SysInfo::IsRunningOnChromeOS()), |
| 162 display_state_(MULTIPLE_DISPLAY_STATE_INVALID), | 162 display_state_(MULTIPLE_DISPLAY_STATE_INVALID), |
| 163 power_state_(chromeos::DISPLAY_POWER_ALL_ON), | 163 requested_power_state_(chromeos::DISPLAY_POWER_ALL_ON), |
| 164 current_power_state_(chromeos::DISPLAY_POWER_ALL_ON), |
| 164 next_display_protection_client_id_(1) {} | 165 next_display_protection_client_id_(1) {} |
| 165 | 166 |
| 166 DisplayConfigurator::~DisplayConfigurator() { | 167 DisplayConfigurator::~DisplayConfigurator() { |
| 167 if (native_display_delegate_) | 168 if (native_display_delegate_) |
| 168 native_display_delegate_->RemoveObserver(this); | 169 native_display_delegate_->RemoveObserver(this); |
| 169 } | 170 } |
| 170 | 171 |
| 171 void DisplayConfigurator::SetDelegateForTesting( | 172 void DisplayConfigurator::SetDelegateForTesting( |
| 172 scoped_ptr<NativeDisplayDelegate> display_delegate) { | 173 scoped_ptr<NativeDisplayDelegate> display_delegate) { |
| 173 DCHECK(!native_display_delegate_); | 174 DCHECK(!native_display_delegate_); |
| 174 | 175 |
| 175 native_display_delegate_ = display_delegate.Pass(); | 176 native_display_delegate_ = display_delegate.Pass(); |
| 176 configure_display_ = true; | 177 configure_display_ = true; |
| 177 } | 178 } |
| 178 | 179 |
| 179 void DisplayConfigurator::SetInitialDisplayPower( | 180 void DisplayConfigurator::SetInitialDisplayPower( |
| 180 chromeos::DisplayPowerState power_state) { | 181 chromeos::DisplayPowerState power_state) { |
| 181 DCHECK_EQ(display_state_, MULTIPLE_DISPLAY_STATE_INVALID); | 182 DCHECK_EQ(display_state_, MULTIPLE_DISPLAY_STATE_INVALID); |
| 182 power_state_ = power_state; | 183 requested_power_state_ = current_power_state_ = power_state; |
| 183 } | 184 } |
| 184 | 185 |
| 185 void DisplayConfigurator::Init(bool is_panel_fitting_enabled) { | 186 void DisplayConfigurator::Init(bool is_panel_fitting_enabled) { |
| 186 is_panel_fitting_enabled_ = is_panel_fitting_enabled; | 187 is_panel_fitting_enabled_ = is_panel_fitting_enabled; |
| 187 if (!configure_display_) | 188 if (!configure_display_) |
| 188 return; | 189 return; |
| 189 | 190 |
| 190 // If the delegate is already initialized don't update it (For example, tests | 191 // If the delegate is already initialized don't update it (For example, tests |
| 191 // set their own delegates). | 192 // set their own delegates). |
| 192 if (!native_display_delegate_) { | 193 if (!native_display_delegate_) { |
| 193 native_display_delegate_ = CreatePlatformNativeDisplayDelegate(); | 194 native_display_delegate_ = CreatePlatformNativeDisplayDelegate(); |
| 194 native_display_delegate_->AddObserver(this); | 195 native_display_delegate_->AddObserver(this); |
| 195 } | 196 } |
| 196 } | 197 } |
| 197 | 198 |
| 198 void DisplayConfigurator::ForceInitialConfigure( | 199 void DisplayConfigurator::ForceInitialConfigure( |
| 199 uint32_t background_color_argb) { | 200 uint32_t background_color_argb) { |
| 200 if (!configure_display_) | 201 if (!configure_display_) |
| 201 return; | 202 return; |
| 202 | 203 |
| 203 native_display_delegate_->GrabServer(); | 204 native_display_delegate_->GrabServer(); |
| 204 native_display_delegate_->Initialize(); | 205 native_display_delegate_->Initialize(); |
| 205 | 206 |
| 206 UpdateCachedDisplays(); | 207 UpdateCachedDisplays(); |
| 207 if (cached_displays_.size() > 1 && background_color_argb) | 208 if (cached_displays_.size() > 1 && background_color_argb) |
| 208 native_display_delegate_->SetBackgroundColor(background_color_argb); | 209 native_display_delegate_->SetBackgroundColor(background_color_argb); |
| 209 const MultipleDisplayState new_state = ChooseDisplayState(power_state_); | 210 const MultipleDisplayState new_state = ChooseDisplayState( |
| 210 const bool success = | 211 requested_power_state_); |
| 211 EnterStateOrFallBackToSoftwareMirroring(new_state, power_state_); | 212 const bool success = EnterStateOrFallBackToSoftwareMirroring( |
| 213 new_state, requested_power_state_); |
| 212 | 214 |
| 213 // Force the DPMS on chrome startup as the driver doesn't always detect | 215 // Force the DPMS on chrome startup as the driver doesn't always detect |
| 214 // that all displays are on when signing out. | 216 // that all displays are on when signing out. |
| 215 native_display_delegate_->ForceDPMSOn(); | 217 native_display_delegate_->ForceDPMSOn(); |
| 216 native_display_delegate_->UngrabServer(); | 218 native_display_delegate_->UngrabServer(); |
| 217 NotifyObservers(success, new_state); | 219 NotifyObservers(success, new_state); |
| 218 } | 220 } |
| 219 | 221 |
| 220 bool DisplayConfigurator::IsMirroring() const { | 222 bool DisplayConfigurator::IsMirroring() const { |
| 221 return display_state_ == MULTIPLE_DISPLAY_STATE_DUAL_MIRROR || | 223 return display_state_ == MULTIPLE_DISPLAY_STATE_DUAL_MIRROR || |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 bool DisplayConfigurator::SetDisplayPower( | 437 bool DisplayConfigurator::SetDisplayPower( |
| 436 chromeos::DisplayPowerState power_state, | 438 chromeos::DisplayPowerState power_state, |
| 437 int flags) { | 439 int flags) { |
| 438 if (!configure_display_) | 440 if (!configure_display_) |
| 439 return false; | 441 return false; |
| 440 | 442 |
| 441 VLOG(1) << "SetDisplayPower: power_state=" | 443 VLOG(1) << "SetDisplayPower: power_state=" |
| 442 << DisplayPowerStateToString(power_state) << " flags=" << flags | 444 << DisplayPowerStateToString(power_state) << " flags=" << flags |
| 443 << ", configure timer=" | 445 << ", configure timer=" |
| 444 << (configure_timer_.IsRunning() ? "Running" : "Stopped"); | 446 << (configure_timer_.IsRunning() ? "Running" : "Stopped"); |
| 445 if (power_state == power_state_ && !(flags & kSetDisplayPowerForceProbe)) | 447 if (power_state == current_power_state_ && |
| 448 !(flags & kSetDisplayPowerForceProbe)) |
| 446 return true; | 449 return true; |
| 447 | 450 |
| 448 native_display_delegate_->GrabServer(); | 451 native_display_delegate_->GrabServer(); |
| 449 UpdateCachedDisplays(); | 452 UpdateCachedDisplays(); |
| 450 | 453 |
| 451 const MultipleDisplayState new_state = ChooseDisplayState(power_state); | 454 const MultipleDisplayState new_state = ChooseDisplayState(power_state); |
| 452 bool attempted_change = false; | 455 bool attempted_change = false; |
| 453 bool success = false; | 456 bool success = false; |
| 454 | 457 |
| 455 bool only_if_single_internal_display = | 458 bool only_if_single_internal_display = |
| 456 flags & kSetDisplayPowerOnlyIfSingleInternalDisplay; | 459 flags & kSetDisplayPowerOnlyIfSingleInternalDisplay; |
| 457 bool single_internal_display = | 460 bool single_internal_display = |
| 458 cached_displays_.size() == 1 && | 461 cached_displays_.size() == 1 && |
| 459 cached_displays_[0].display->type() == DISPLAY_CONNECTION_TYPE_INTERNAL; | 462 cached_displays_[0].display->type() == DISPLAY_CONNECTION_TYPE_INTERNAL; |
| 460 if (single_internal_display || !only_if_single_internal_display) { | 463 if (single_internal_display || !only_if_single_internal_display) { |
| 461 success = EnterStateOrFallBackToSoftwareMirroring(new_state, power_state); | 464 success = EnterStateOrFallBackToSoftwareMirroring(new_state, power_state); |
| 462 attempted_change = true; | 465 attempted_change = true; |
| 463 | 466 |
| 464 // Force the DPMS on since the driver doesn't always detect that it | 467 // Force the DPMS on since the driver doesn't always detect that it |
| 465 // should turn on. This is needed when coming back from idle suspend. | 468 // should turn on. This is needed when coming back from idle suspend. |
| 466 if (success && power_state != chromeos::DISPLAY_POWER_ALL_OFF) | 469 if (success && power_state != chromeos::DISPLAY_POWER_ALL_OFF) |
| 467 native_display_delegate_->ForceDPMSOn(); | 470 native_display_delegate_->ForceDPMSOn(); |
| 468 } | 471 } |
| 469 | 472 |
| 470 native_display_delegate_->UngrabServer(); | 473 native_display_delegate_->UngrabServer(); |
| 471 if (attempted_change) | 474 if (attempted_change) |
| 472 NotifyObservers(success, new_state); | 475 NotifyObservers(success, new_state); |
| 473 return true; | 476 return success; |
| 474 } | 477 } |
| 475 | 478 |
| 476 bool DisplayConfigurator::SetDisplayMode(MultipleDisplayState new_state) { | 479 bool DisplayConfigurator::SetDisplayMode(MultipleDisplayState new_state) { |
| 477 if (!configure_display_) | 480 if (!configure_display_) |
| 478 return false; | 481 return false; |
| 479 | 482 |
| 480 VLOG(1) << "SetDisplayMode: state=" << DisplayStateToString(new_state); | 483 VLOG(1) << "SetDisplayMode: state=" << DisplayStateToString(new_state); |
| 481 if (display_state_ == new_state) { | 484 if (display_state_ == new_state) { |
| 482 // Cancel software mirroring if the state is moving from | 485 // Cancel software mirroring if the state is moving from |
| 483 // MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED to | 486 // MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED to |
| 484 // MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED. | 487 // MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED. |
| 485 if (mirroring_controller_ && | 488 if (mirroring_controller_ && |
| 486 new_state == MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED) | 489 new_state == MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED) |
| 487 mirroring_controller_->SetSoftwareMirroring(false); | 490 mirroring_controller_->SetSoftwareMirroring(false); |
| 488 NotifyObservers(true, new_state); | 491 NotifyObservers(true, new_state); |
| 489 return true; | 492 return true; |
| 490 } | 493 } |
| 491 | 494 |
| 492 native_display_delegate_->GrabServer(); | 495 native_display_delegate_->GrabServer(); |
| 493 UpdateCachedDisplays(); | 496 UpdateCachedDisplays(); |
| 494 const bool success = | 497 const bool success = EnterStateOrFallBackToSoftwareMirroring( |
| 495 EnterStateOrFallBackToSoftwareMirroring(new_state, power_state_); | 498 new_state, requested_power_state_); |
| 496 native_display_delegate_->UngrabServer(); | 499 native_display_delegate_->UngrabServer(); |
| 497 | 500 |
| 498 NotifyObservers(success, new_state); | 501 NotifyObservers(success, new_state); |
| 499 return success; | 502 return success; |
| 500 } | 503 } |
| 501 | 504 |
| 502 void DisplayConfigurator::OnConfigurationChanged() { | 505 void DisplayConfigurator::OnConfigurationChanged() { |
| 503 // Configure displays with |kConfigureDelayMs| delay, | 506 // Configure displays with |kConfigureDelayMs| delay, |
| 504 // so that time-consuming ConfigureDisplays() won't be called multiple times. | 507 // so that time-consuming ConfigureDisplays() won't be called multiple times. |
| 505 if (configure_timer_.IsRunning()) { | 508 if (configure_timer_.IsRunning()) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 525 void DisplayConfigurator::RemoveObserver(Observer* observer) { | 528 void DisplayConfigurator::RemoveObserver(Observer* observer) { |
| 526 observers_.RemoveObserver(observer); | 529 observers_.RemoveObserver(observer); |
| 527 } | 530 } |
| 528 | 531 |
| 529 void DisplayConfigurator::SuspendDisplays() { | 532 void DisplayConfigurator::SuspendDisplays() { |
| 530 // If the display is off due to user inactivity and there's only a single | 533 // If the display is off due to user inactivity and there's only a single |
| 531 // internal display connected, switch to the all-on state before | 534 // internal display connected, switch to the all-on state before |
| 532 // suspending. This shouldn't be very noticeable to the user since the | 535 // suspending. This shouldn't be very noticeable to the user since the |
| 533 // backlight is off at this point, and doing this lets us resume directly | 536 // backlight is off at this point, and doing this lets us resume directly |
| 534 // into the "on" state, which greatly reduces resume times. | 537 // into the "on" state, which greatly reduces resume times. |
| 535 if (power_state_ == chromeos::DISPLAY_POWER_ALL_OFF) { | 538 if (requested_power_state_ == chromeos::DISPLAY_POWER_ALL_OFF) { |
| 536 SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON, | 539 SetDisplayPower(chromeos::DISPLAY_POWER_ALL_ON, |
| 537 kSetDisplayPowerOnlyIfSingleInternalDisplay); | 540 kSetDisplayPowerOnlyIfSingleInternalDisplay); |
| 538 | 541 |
| 539 // We need to make sure that the monitor configuration we just did actually | 542 // We need to make sure that the monitor configuration we just did actually |
| 540 // completes before we return, because otherwise the X message could be | 543 // completes before we return, because otherwise the X message could be |
| 541 // racing with the HandleSuspendReadiness message. | 544 // racing with the HandleSuspendReadiness message. |
| 542 native_display_delegate_->SyncWithServer(); | 545 native_display_delegate_->SyncWithServer(); |
| 543 } | 546 } |
| 544 } | 547 } |
| 545 | 548 |
| 546 void DisplayConfigurator::ResumeDisplays() { | 549 void DisplayConfigurator::ResumeDisplays() { |
| 547 // Force probing to ensure that we pick up any changes that were made | 550 // Force probing to ensure that we pick up any changes that were made |
| 548 // while the system was suspended. | 551 // while the system was suspended. |
| 549 configure_timer_.Start( | 552 configure_timer_.Start( |
| 550 FROM_HERE, | 553 FROM_HERE, |
| 551 base::TimeDelta::FromMilliseconds(kResumeDelayMs), | 554 base::TimeDelta::FromMilliseconds(kResumeDelayMs), |
| 552 base::Bind(base::IgnoreResult(&DisplayConfigurator::SetDisplayPower), | 555 base::Bind(base::IgnoreResult(&DisplayConfigurator::SetDisplayPower), |
| 553 base::Unretained(this), | 556 base::Unretained(this), |
| 554 power_state_, | 557 requested_power_state_, |
| 555 kSetDisplayPowerForceProbe)); | 558 kSetDisplayPowerForceProbe)); |
| 556 } | 559 } |
| 557 | 560 |
| 558 void DisplayConfigurator::UpdateCachedDisplays() { | 561 void DisplayConfigurator::UpdateCachedDisplays() { |
| 559 std::vector<DisplaySnapshot*> snapshots = | 562 std::vector<DisplaySnapshot*> snapshots = |
| 560 native_display_delegate_->GetDisplays(); | 563 native_display_delegate_->GetDisplays(); |
| 561 | 564 |
| 562 cached_displays_.clear(); | 565 cached_displays_.clear(); |
| 563 for (size_t i = 0; i < snapshots.size(); ++i) { | 566 for (size_t i = 0; i < snapshots.size(); ++i) { |
| 564 DisplayState display_state; | 567 DisplayState display_state; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 | 699 |
| 697 return false; | 700 return false; |
| 698 } | 701 } |
| 699 | 702 |
| 700 void DisplayConfigurator::ConfigureDisplays() { | 703 void DisplayConfigurator::ConfigureDisplays() { |
| 701 if (!configure_display_) | 704 if (!configure_display_) |
| 702 return; | 705 return; |
| 703 | 706 |
| 704 native_display_delegate_->GrabServer(); | 707 native_display_delegate_->GrabServer(); |
| 705 UpdateCachedDisplays(); | 708 UpdateCachedDisplays(); |
| 706 const MultipleDisplayState new_state = ChooseDisplayState(power_state_); | 709 const MultipleDisplayState new_state = ChooseDisplayState( |
| 707 const bool success = | 710 requested_power_state_); |
| 708 EnterStateOrFallBackToSoftwareMirroring(new_state, power_state_); | 711 const bool success = EnterStateOrFallBackToSoftwareMirroring( |
| 712 new_state, requested_power_state_); |
| 709 native_display_delegate_->UngrabServer(); | 713 native_display_delegate_->UngrabServer(); |
| 710 | 714 |
| 711 NotifyObservers(success, new_state); | 715 NotifyObservers(success, new_state); |
| 712 } | 716 } |
| 713 | 717 |
| 714 void DisplayConfigurator::NotifyObservers( | 718 void DisplayConfigurator::NotifyObservers( |
| 715 bool success, | 719 bool success, |
| 716 MultipleDisplayState attempted_state) { | 720 MultipleDisplayState attempted_state) { |
| 717 if (success) { | 721 if (success) { |
| 718 FOR_EACH_OBSERVER( | 722 FOR_EACH_OBSERVER( |
| 719 Observer, observers_, OnDisplayModeChanged(cached_displays_)); | 723 Observer, observers_, OnDisplayModeChanged(cached_displays_)); |
| 720 } else { | 724 } else { |
| 721 FOR_EACH_OBSERVER( | 725 FOR_EACH_OBSERVER( |
| 722 Observer, observers_, OnDisplayModeChangeFailed(attempted_state)); | 726 Observer, observers_, OnDisplayModeChangeFailed(attempted_state)); |
| 723 } | 727 } |
| 724 } | 728 } |
| 725 | 729 |
| 726 bool DisplayConfigurator::EnterStateOrFallBackToSoftwareMirroring( | 730 bool DisplayConfigurator::EnterStateOrFallBackToSoftwareMirroring( |
| 727 MultipleDisplayState display_state, | 731 MultipleDisplayState display_state, |
| 728 chromeos::DisplayPowerState power_state) { | 732 chromeos::DisplayPowerState power_state) { |
| 729 bool success = EnterState(display_state, power_state); | 733 bool success = EnterState(display_state, power_state); |
| 730 if (mirroring_controller_) { | 734 if (mirroring_controller_) { |
| 731 bool enable_software_mirroring = false; | 735 bool enable_software_mirroring = false; |
| 732 if (!success && display_state == MULTIPLE_DISPLAY_STATE_DUAL_MIRROR) { | 736 if (!success && display_state == MULTIPLE_DISPLAY_STATE_DUAL_MIRROR) { |
| 733 if (display_state_ != MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED || | 737 if (display_state_ != MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED || |
| 734 power_state_ != power_state) | 738 current_power_state_ != power_state) |
| 735 EnterState(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, power_state); | 739 EnterState(MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, power_state); |
| 736 enable_software_mirroring = success = | 740 enable_software_mirroring = success = |
| 737 display_state_ == MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; | 741 display_state_ == MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; |
| 738 } | 742 } |
| 739 mirroring_controller_->SetSoftwareMirroring(enable_software_mirroring); | 743 mirroring_controller_->SetSoftwareMirroring(enable_software_mirroring); |
| 740 } | 744 } |
| 741 return success; | 745 return success; |
| 742 } | 746 } |
| 743 | 747 |
| 744 bool DisplayConfigurator::EnterState(MultipleDisplayState display_state, | 748 bool DisplayConfigurator::EnterState(MultipleDisplayState display_state, |
| 745 chromeos::DisplayPowerState power_state) { | 749 chromeos::DisplayPowerState power_state) { |
| 746 std::vector<bool> display_power; | 750 std::vector<bool> display_power; |
| 747 int num_on_displays = | 751 int num_on_displays = |
| 748 GetDisplayPower(cached_displays_, power_state, &display_power); | 752 GetDisplayPower(cached_displays_, power_state, &display_power); |
| 749 VLOG(1) << "EnterState: display=" << DisplayStateToString(display_state) | 753 VLOG(1) << "EnterState: display=" << DisplayStateToString(display_state) |
| 750 << " power=" << DisplayPowerStateToString(power_state); | 754 << " power=" << DisplayPowerStateToString(power_state); |
| 751 | 755 |
| 756 // Save the requested state so we'll try to use it next time even if we fail. |
| 757 requested_power_state_ = power_state; |
| 758 |
| 752 // Framebuffer dimensions. | 759 // Framebuffer dimensions. |
| 753 gfx::Size size; | 760 gfx::Size size; |
| 754 | 761 |
| 755 std::vector<gfx::Point> new_origins(cached_displays_.size(), gfx::Point()); | 762 std::vector<gfx::Point> new_origins(cached_displays_.size(), gfx::Point()); |
| 756 std::vector<const DisplayMode*> new_mode; | 763 std::vector<const DisplayMode*> new_mode; |
| 757 for (size_t i = 0; i < cached_displays_.size(); ++i) | 764 for (size_t i = 0; i < cached_displays_.size(); ++i) |
| 758 new_mode.push_back(cached_displays_[i].display->current_mode()); | 765 new_mode.push_back(cached_displays_[i].display->current_mode()); |
| 759 | 766 |
| 760 switch (display_state) { | 767 switch (display_state) { |
| 761 case MULTIPLE_DISPLAY_STATE_INVALID: | 768 case MULTIPLE_DISPLAY_STATE_INVALID: |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 // false to let the observers be aware. | 915 // false to let the observers be aware. |
| 909 if (display_state == MULTIPLE_DISPLAY_STATE_DUAL_MIRROR && | 916 if (display_state == MULTIPLE_DISPLAY_STATE_DUAL_MIRROR && |
| 910 display_power[i] && | 917 display_power[i] && |
| 911 state.display->current_mode() != state.mirror_mode) | 918 state.display->current_mode() != state.mirror_mode) |
| 912 all_succeeded = false; | 919 all_succeeded = false; |
| 913 } | 920 } |
| 914 } | 921 } |
| 915 | 922 |
| 916 if (all_succeeded) { | 923 if (all_succeeded) { |
| 917 display_state_ = display_state; | 924 display_state_ = display_state; |
| 918 power_state_ = power_state; | 925 current_power_state_ = power_state; |
| 919 framebuffer_size_ = size; | 926 framebuffer_size_ = size; |
| 920 } | 927 } |
| 921 return all_succeeded; | 928 return all_succeeded; |
| 922 } | 929 } |
| 923 | 930 |
| 924 MultipleDisplayState DisplayConfigurator::ChooseDisplayState( | 931 MultipleDisplayState DisplayConfigurator::ChooseDisplayState( |
| 925 chromeos::DisplayPowerState power_state) const { | 932 chromeos::DisplayPowerState power_state) const { |
| 926 int num_on_displays = GetDisplayPower(cached_displays_, power_state, NULL); | 933 int num_on_displays = GetDisplayPower(cached_displays_, power_state, NULL); |
| 927 switch (cached_displays_.size()) { | 934 switch (cached_displays_.size()) { |
| 928 case 0: | 935 case 0: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 949 return state_controller_->GetStateForDisplayIds(display_ids); | 956 return state_controller_->GetStateForDisplayIds(display_ids); |
| 950 } | 957 } |
| 951 } | 958 } |
| 952 default: | 959 default: |
| 953 NOTREACHED(); | 960 NOTREACHED(); |
| 954 } | 961 } |
| 955 return MULTIPLE_DISPLAY_STATE_INVALID; | 962 return MULTIPLE_DISPLAY_STATE_INVALID; |
| 956 } | 963 } |
| 957 | 964 |
| 958 } // namespace ui | 965 } // namespace ui |
| OLD | NEW |