Chromium Code Reviews| Index: ui/display/chromeos/display_configurator.cc |
| diff --git a/ui/display/chromeos/display_configurator.cc b/ui/display/chromeos/display_configurator.cc |
| index 68c026ea0c6f8d9d41cca7660f75f6e96b117d80..1bfff85579611e91c2dca362346120f87c876b88 100644 |
| --- a/ui/display/chromeos/display_configurator.cc |
| +++ b/ui/display/chromeos/display_configurator.cc |
| @@ -11,6 +11,7 @@ |
| #include "base/time/time.h" |
| #include "ui/display/chromeos/apply_content_protection_task.h" |
| #include "ui/display/chromeos/display_layout_manager.h" |
| +#include "ui/display/chromeos/display_snapshot_virtual.h" |
| #include "ui/display/chromeos/display_util.h" |
| #include "ui/display/chromeos/update_display_configuration_task.h" |
| #include "ui/display/display_switches.h" |
| @@ -661,6 +662,15 @@ void DisplayConfigurator::QueryContentProtectionStatus( |
| ContentProtectionClientId client_id, |
| int64_t display_id, |
| const QueryProtectionCallback& callback) { |
| + // Exclude virtual displays. |
|
oshima
2015/11/24 22:19:27
I believe this is not to cast the protected conten
robert.bradford
2015/11/26 16:29:40
My aim was to prevent protected content from being
oshima
2015/12/02 20:34:27
Can you add comment?
|
| + for (const DisplaySnapshot* display : cached_displays_) { |
| + if (display->display_id() == display_id && |
| + !IsPhysicalDisplayType(display->type())) { |
| + callback.Run(QueryProtectionResponse()); |
| + return; |
| + } |
| + } |
| + |
| if (!configure_display_ || display_externally_controlled_) { |
| callback.Run(QueryProtectionResponse()); |
| return; |
| @@ -779,7 +789,8 @@ DisplayConfigurator::GetAvailableColorCalibrationProfiles(int64_t display_id) { |
| if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kDisableDisplayColorCalibration)) { |
| for (const DisplaySnapshot* display : cached_displays_) { |
| - if (display->display_id() == display_id) { |
| + if (display->display_id() == display_id && |
| + IsPhysicalDisplayType(display->type())) { |
| return native_display_delegate_->GetAvailableColorCalibrationProfiles( |
| *display); |
| } |
| @@ -793,7 +804,8 @@ bool DisplayConfigurator::SetColorCalibrationProfile( |
| int64_t display_id, |
| ui::ColorCalibrationProfile new_profile) { |
| for (const DisplaySnapshot* display : cached_displays_) { |
| - if (display->display_id() == display_id) { |
| + if (display->display_id() == display_id && |
| + IsPhysicalDisplayType(display->type())) { |
| return native_display_delegate_->SetColorCalibrationProfile(*display, |
| new_profile); |
| } |
| @@ -964,6 +976,8 @@ void DisplayConfigurator::RunPendingConfiguration() { |
| requested_display_state_, requested_power_state_, requested_power_flags_, |
| 0, force_configure_, base::Bind(&DisplayConfigurator::OnConfigured, |
| weak_ptr_factory_.GetWeakPtr()))); |
| + configuration_task_->set_virtual_display_snapshots( |
| + virtual_display_snapshots_.get()); |
| // Reset the flags before running the task; otherwise it may end up scheduling |
| // another configuration. |
| @@ -1079,4 +1093,27 @@ void DisplayConfigurator::NotifyObservers( |
| } |
| } |
| +int64_t DisplayConfigurator::AddVirtualDisplay(gfx::Size display_size) { |
| + DisplaySnapshotVirtual* virtual_snapshot = |
| + new DisplaySnapshotVirtual(++last_virtual_display_id_, display_size); |
| + virtual_display_snapshots_.push_back(virtual_snapshot); |
| + ConfigureDisplays(); |
| + |
| + return virtual_snapshot->display_id(); |
| +} |
| + |
| +bool DisplayConfigurator::RemoveVirtualDisplay(int64_t display_id) { |
| + for (auto it = virtual_display_snapshots_.begin(); |
| + it != virtual_display_snapshots_.end(); ++it) { |
| + if ((*it)->display_id() == display_id) { |
| + if (display_id == last_virtual_display_id_) |
| + last_virtual_display_id_--; |
| + virtual_display_snapshots_.erase(it); |
|
oshima
2015/11/24 22:19:27
where are DisplaySnapshotVirtual objects deleted?
robert.bradford
2015/11/26 16:29:40
I'm using a base::ScopedVector. This means that I
|
| + ConfigureDisplays(); |
| + return true; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| } // namespace ui |