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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 const bool success = | 214 const bool success = |
215 EnterStateOrFallBackToSoftwareMirroring(new_state, power_state_); | 215 EnterStateOrFallBackToSoftwareMirroring(new_state, power_state_); |
216 | 216 |
217 // Force the DPMS on chrome startup as the driver doesn't always detect | 217 // Force the DPMS on chrome startup as the driver doesn't always detect |
218 // that all displays are on when signing out. | 218 // that all displays are on when signing out. |
219 native_display_delegate_->ForceDPMSOn(); | 219 native_display_delegate_->ForceDPMSOn(); |
220 native_display_delegate_->UngrabServer(); | 220 native_display_delegate_->UngrabServer(); |
221 NotifyObservers(success, new_state); | 221 NotifyObservers(success, new_state); |
222 } | 222 } |
223 | 223 |
224 bool DisplayConfigurator::IsMirroring() const { | |
225 return display_state_ == MULTIPLE_DISPLAY_STATE_DUAL_MIRROR || | |
226 (mirroring_controller_ && | |
227 mirroring_controller_->SoftwareMirroringEnabled()); | |
Daniel Erat
2014/05/16 14:34:17
nit: is this what clang-format recommends? i think
kcwu1
2014/05/16 15:49:54
Done.
| |
228 } | |
229 | |
224 bool DisplayConfigurator::ApplyProtections(const ContentProtections& requests) { | 230 bool DisplayConfigurator::ApplyProtections(const ContentProtections& requests) { |
225 for (DisplayStateList::const_iterator it = cached_displays_.begin(); | 231 for (DisplayStateList::const_iterator it = cached_displays_.begin(); |
226 it != cached_displays_.end(); | 232 it != cached_displays_.end(); |
227 ++it) { | 233 ++it) { |
228 uint32_t all_desired = 0; | 234 uint32_t all_desired = 0; |
229 ContentProtections::const_iterator request_it = | 235 |
230 requests.find(it->display->display_id()); | 236 // In mirror mode, protection request of all displays need to be fulfilled. |
231 if (request_it != requests.end()) | 237 // In non-mirror mode, only request of client's display needs to be |
232 all_desired = request_it->second; | 238 // fulfilled. |
239 ContentProtections::const_iterator request_it; | |
240 if (IsMirroring()) { | |
241 for (request_it = requests.begin(); | |
242 request_it != requests.end(); | |
Daniel Erat
2014/05/16 14:34:17
nit: fix indenting (this and the next line should
kcwu1
2014/05/16 15:49:54
Done.
| |
243 ++request_it) | |
244 all_desired |= request_it->second; | |
245 } else { | |
246 request_it = requests.find(it->display->display_id()); | |
247 if (request_it != requests.end()) | |
248 all_desired = request_it->second; | |
249 } | |
250 | |
233 switch (it->display->type()) { | 251 switch (it->display->type()) { |
234 case DISPLAY_CONNECTION_TYPE_UNKNOWN: | 252 case DISPLAY_CONNECTION_TYPE_UNKNOWN: |
235 return false; | 253 return false; |
236 // DisplayPort, DVI, and HDMI all support HDCP. | 254 // DisplayPort, DVI, and HDMI all support HDCP. |
237 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: | 255 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: |
238 case DISPLAY_CONNECTION_TYPE_DVI: | 256 case DISPLAY_CONNECTION_TYPE_DVI: |
239 case DISPLAY_CONNECTION_TYPE_HDMI: { | 257 case DISPLAY_CONNECTION_TYPE_HDMI: { |
240 HDCPState new_desired_state = | 258 HDCPState new_desired_state = |
241 (all_desired & CONTENT_PROTECTION_METHOD_HDCP) ? | 259 (all_desired & CONTENT_PROTECTION_METHOD_HDCP) ? |
242 HDCP_STATE_DESIRED : HDCP_STATE_UNDESIRED; | 260 HDCP_STATE_DESIRED : HDCP_STATE_UNDESIRED; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 uint32_t* protection_mask) { | 311 uint32_t* protection_mask) { |
294 if (!configure_display_) | 312 if (!configure_display_) |
295 return false; | 313 return false; |
296 | 314 |
297 uint32_t enabled = 0; | 315 uint32_t enabled = 0; |
298 uint32_t unfulfilled = 0; | 316 uint32_t unfulfilled = 0; |
299 *link_mask = 0; | 317 *link_mask = 0; |
300 for (DisplayStateList::const_iterator it = cached_displays_.begin(); | 318 for (DisplayStateList::const_iterator it = cached_displays_.begin(); |
301 it != cached_displays_.end(); | 319 it != cached_displays_.end(); |
302 ++it) { | 320 ++it) { |
303 if (it->display->display_id() != display_id) | 321 |
322 // Query display if it is in mirror mode or client on the same display. | |
323 if (!IsMirroring() && it->display->display_id() != display_id) | |
304 continue; | 324 continue; |
325 | |
305 *link_mask |= it->display->type(); | 326 *link_mask |= it->display->type(); |
306 switch (it->display->type()) { | 327 switch (it->display->type()) { |
307 case DISPLAY_CONNECTION_TYPE_UNKNOWN: | 328 case DISPLAY_CONNECTION_TYPE_UNKNOWN: |
308 return false; | 329 return false; |
309 // DisplayPort, DVI, and HDMI all support HDCP. | 330 // DisplayPort, DVI, and HDMI all support HDCP. |
310 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: | 331 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: |
311 case DISPLAY_CONNECTION_TYPE_DVI: | 332 case DISPLAY_CONNECTION_TYPE_DVI: |
312 case DISPLAY_CONNECTION_TYPE_HDMI: { | 333 case DISPLAY_CONNECTION_TYPE_HDMI: { |
313 HDCPState state; | 334 HDCPState state; |
314 if (!native_display_delegate_->GetHDCPState(*it->display, &state)) | 335 if (!native_display_delegate_->GetHDCPState(*it->display, &state)) |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1037 float width_ratio = static_cast<float>(mirror_mode_info->size().width()) / | 1058 float width_ratio = static_cast<float>(mirror_mode_info->size().width()) / |
1038 static_cast<float>(native_mode_info->size().width()); | 1059 static_cast<float>(native_mode_info->size().width()); |
1039 float height_ratio = static_cast<float>(mirror_mode_info->size().height()) / | 1060 float height_ratio = static_cast<float>(mirror_mode_info->size().height()) / |
1040 static_cast<float>(native_mode_info->size().height()); | 1061 static_cast<float>(native_mode_info->size().height()); |
1041 | 1062 |
1042 area_ratio = width_ratio * height_ratio; | 1063 area_ratio = width_ratio * height_ratio; |
1043 return area_ratio; | 1064 return area_ratio; |
1044 } | 1065 } |
1045 | 1066 |
1046 } // namespace ui | 1067 } // namespace ui |
OLD | NEW |