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_ && | |
Daniel Erat
2014/05/15 14:04:25
wrapped line should be indented four spaces, not t
kcwu
2014/05/16 04:36:39
Done.
| |
227 mirroring_controller_->software_mirroring_enabled()); | |
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(); request_it != requests.end(); | |
242 ++request_it) | |
Daniel Erat
2014/05/15 14:04:25
fix indenting
kcwu
2014/05/16 04:36:39
Done.
| |
243 all_desired |= request_it->second; | |
244 } else { | |
245 request_it = requests.find(it->display->display_id()); | |
246 if (request_it != requests.end()) | |
247 all_desired = request_it->second; | |
248 } | |
249 | |
233 switch (it->display->type()) { | 250 switch (it->display->type()) { |
234 case DISPLAY_CONNECTION_TYPE_UNKNOWN: | 251 case DISPLAY_CONNECTION_TYPE_UNKNOWN: |
235 return false; | 252 return false; |
236 // DisplayPort, DVI, and HDMI all support HDCP. | 253 // DisplayPort, DVI, and HDMI all support HDCP. |
237 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: | 254 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: |
238 case DISPLAY_CONNECTION_TYPE_DVI: | 255 case DISPLAY_CONNECTION_TYPE_DVI: |
239 case DISPLAY_CONNECTION_TYPE_HDMI: { | 256 case DISPLAY_CONNECTION_TYPE_HDMI: { |
240 HDCPState new_desired_state = | 257 HDCPState new_desired_state = |
241 (all_desired & CONTENT_PROTECTION_METHOD_HDCP) ? | 258 (all_desired & CONTENT_PROTECTION_METHOD_HDCP) ? |
242 HDCP_STATE_DESIRED : HDCP_STATE_UNDESIRED; | 259 HDCP_STATE_DESIRED : HDCP_STATE_UNDESIRED; |
243 if (!native_display_delegate_->SetHDCPState(*it->display, | 260 if (!native_display_delegate_->SetHDCPState(*it->display, |
244 new_desired_state)) | 261 new_desired_state)) |
245 return false; | 262 return false; |
246 break; | 263 break; |
247 } | 264 } |
248 case DISPLAY_CONNECTION_TYPE_INTERNAL: | 265 case DISPLAY_CONNECTION_TYPE_INTERNAL: |
249 case DISPLAY_CONNECTION_TYPE_VGA: | 266 case DISPLAY_CONNECTION_TYPE_VGA: |
250 case DISPLAY_CONNECTION_TYPE_NETWORK: | 267 case DISPLAY_CONNECTION_TYPE_NETWORK: |
251 // No protections for these types. Do nothing. | 268 // No protections for these types. Do nothing. |
dnicoara
2014/05/15 14:39:49
Perhaps I've misunderstood the bug, but is this co
kcwu1
2014/05/15 15:02:42
This method could be understood as "protect if you
| |
252 break; | 269 break; |
253 case DISPLAY_CONNECTION_TYPE_NONE: | 270 case DISPLAY_CONNECTION_TYPE_NONE: |
254 NOTREACHED(); | 271 NOTREACHED(); |
255 break; | 272 break; |
256 } | 273 } |
257 } | 274 } |
258 | 275 |
259 return true; | 276 return true; |
260 } | 277 } |
261 | 278 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 uint32_t* protection_mask) { | 310 uint32_t* protection_mask) { |
294 if (!configure_display_) | 311 if (!configure_display_) |
295 return false; | 312 return false; |
296 | 313 |
297 uint32_t enabled = 0; | 314 uint32_t enabled = 0; |
298 uint32_t unfulfilled = 0; | 315 uint32_t unfulfilled = 0; |
299 *link_mask = 0; | 316 *link_mask = 0; |
300 for (DisplayStateList::const_iterator it = cached_displays_.begin(); | 317 for (DisplayStateList::const_iterator it = cached_displays_.begin(); |
301 it != cached_displays_.end(); | 318 it != cached_displays_.end(); |
302 ++it) { | 319 ++it) { |
303 if (it->display->display_id() != display_id) | 320 |
321 // Query display if it is in mirror mode or client on the same display. | |
322 if (!IsMirroring() && it->display->display_id() != display_id) | |
304 continue; | 323 continue; |
324 | |
305 *link_mask |= it->display->type(); | 325 *link_mask |= it->display->type(); |
306 switch (it->display->type()) { | 326 switch (it->display->type()) { |
307 case DISPLAY_CONNECTION_TYPE_UNKNOWN: | 327 case DISPLAY_CONNECTION_TYPE_UNKNOWN: |
308 return false; | 328 return false; |
309 // DisplayPort, DVI, and HDMI all support HDCP. | 329 // DisplayPort, DVI, and HDMI all support HDCP. |
310 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: | 330 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: |
311 case DISPLAY_CONNECTION_TYPE_DVI: | 331 case DISPLAY_CONNECTION_TYPE_DVI: |
312 case DISPLAY_CONNECTION_TYPE_HDMI: { | 332 case DISPLAY_CONNECTION_TYPE_HDMI: { |
313 HDCPState state; | 333 HDCPState state; |
314 if (!native_display_delegate_->GetHDCPState(*it->display, &state)) | 334 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()) / | 1057 float width_ratio = static_cast<float>(mirror_mode_info->size().width()) / |
1038 static_cast<float>(native_mode_info->size().width()); | 1058 static_cast<float>(native_mode_info->size().width()); |
1039 float height_ratio = static_cast<float>(mirror_mode_info->size().height()) / | 1059 float height_ratio = static_cast<float>(mirror_mode_info->size().height()) / |
1040 static_cast<float>(native_mode_info->size().height()); | 1060 static_cast<float>(native_mode_info->size().height()); |
1041 | 1061 |
1042 area_ratio = width_ratio * height_ratio; | 1062 area_ratio = width_ratio * height_ratio; |
1043 return area_ratio; | 1063 return area_ratio; |
1044 } | 1064 } |
1045 | 1065 |
1046 } // namespace ui | 1066 } // namespace ui |
OLD | NEW |