Chromium Code Reviews| Index: chromeos/display/output_configurator.cc |
| diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc |
| index fb545aaf7cb45720c94884524486f5cdce3374a5..3e7680c3c069925f344d5cc2fce5bd7cce884b16 100644 |
| --- a/chromeos/display/output_configurator.cc |
| +++ b/chromeos/display/output_configurator.cc |
| @@ -106,20 +106,6 @@ int GetOutputPower( |
| return num_on_outputs; |
| } |
| -// Determine if there is an "internal" output and how many outputs are |
| -// connected. |
| -bool IsProjecting( |
| - const std::vector<OutputConfigurator::OutputSnapshot>& outputs) { |
| - bool has_internal_output = false; |
| - int connected_output_count = outputs.size(); |
| - for (size_t i = 0; i < outputs.size(); ++i) |
| - has_internal_output |= outputs[i].type == OUTPUT_TYPE_INTERNAL; |
| - |
| - // "Projecting" is defined as having more than 1 output connected while at |
| - // least one of them is an internal output. |
| - return has_internal_output && (connected_output_count > 1); |
| -} |
| - |
| } // namespace |
| OutputConfigurator::ModeInfo::ModeInfo() |
| @@ -252,7 +238,8 @@ OutputConfigurator::OutputConfigurator() |
| xrandr_event_base_(0), |
| output_state_(STATE_INVALID), |
| power_state_(DISPLAY_POWER_ALL_ON), |
| - next_output_protection_client_id_(1) { |
| + next_output_protection_client_id_(1), |
| + screen_sharing_count_(0) { |
| } |
| OutputConfigurator::~OutputConfigurator() {} |
| @@ -267,6 +254,17 @@ void OutputConfigurator::SetInitialDisplayPower(DisplayPowerState power_state) { |
| power_state_ = power_state; |
| } |
| +bool OutputConfigurator::IsProjecting() const { |
|
oshima
2014/01/15 02:26:37
Since IsProjecting is always used with delegate ho
hshi1
2014/01/15 19:43:24
Done.
|
| + bool has_internal_output = false; |
| + int connected_output_count = cached_outputs_.size() + screen_sharing_count_; |
| + for (size_t i = 0; i < cached_outputs_.size(); ++i) |
| + has_internal_output |= cached_outputs_[i].type == OUTPUT_TYPE_INTERNAL; |
| + |
| + // "Projecting" is defined as having more than 1 output connected while at |
| + // least one of them is an internal output. |
| + return has_internal_output && (connected_output_count > 1); |
| +} |
| + |
| void OutputConfigurator::Init(bool is_panel_fitting_enabled) { |
| is_panel_fitting_enabled_ = is_panel_fitting_enabled; |
| if (!configure_display_) |
| @@ -294,7 +292,7 @@ void OutputConfigurator::Start(uint32 background_color_argb) { |
| // that all displays are on when signing out. |
| delegate_->ForceDPMSOn(); |
| delegate_->UngrabServer(); |
| - delegate_->SendProjectingStateToPowerManager(IsProjecting(cached_outputs_)); |
| + delegate_->SendProjectingStateToPowerManager(IsProjecting()); |
| NotifyObservers(success, new_state); |
| } |
| @@ -777,7 +775,7 @@ void OutputConfigurator::ConfigureOutputs() { |
| delegate_->UngrabServer(); |
| NotifyObservers(success, new_state); |
| - delegate_->SendProjectingStateToPowerManager(IsProjecting(cached_outputs_)); |
| + delegate_->SendProjectingStateToPowerManager(IsProjecting()); |
| } |
| void OutputConfigurator::NotifyObservers(bool success, |
| @@ -1136,4 +1134,12 @@ float OutputConfigurator::GetMirroredDisplayAreaRatio( |
| return area_ratio; |
| } |
| +void OutputConfigurator::SetScreenSharingCount(int screen_sharing_count) { |
| + if (screen_sharing_count_ == screen_sharing_count) |
| + return; |
| + |
| + screen_sharing_count_ = screen_sharing_count; |
| + delegate_->SendProjectingStateToPowerManager(IsProjecting()); |
| +} |
| + |
| } // namespace chromeos |