| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 all_desired = request_it->second; | 244 all_desired = request_it->second; |
| 245 } | 245 } |
| 246 | 246 |
| 247 switch (it->display->type()) { | 247 switch (it->display->type()) { |
| 248 case DISPLAY_CONNECTION_TYPE_UNKNOWN: | 248 case DISPLAY_CONNECTION_TYPE_UNKNOWN: |
| 249 return false; | 249 return false; |
| 250 // DisplayPort, DVI, and HDMI all support HDCP. | 250 // DisplayPort, DVI, and HDMI all support HDCP. |
| 251 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: | 251 case DISPLAY_CONNECTION_TYPE_DISPLAYPORT: |
| 252 case DISPLAY_CONNECTION_TYPE_DVI: | 252 case DISPLAY_CONNECTION_TYPE_DVI: |
| 253 case DISPLAY_CONNECTION_TYPE_HDMI: { | 253 case DISPLAY_CONNECTION_TYPE_HDMI: { |
| 254 HDCPState new_desired_state = | 254 HDCPState current_state; |
| 255 (all_desired & CONTENT_PROTECTION_METHOD_HDCP) ? | 255 // Need to poll the driver for updates since other applications may |
| 256 HDCP_STATE_DESIRED : HDCP_STATE_UNDESIRED; | 256 // have updated the state. |
| 257 if (!native_display_delegate_->SetHDCPState(*it->display, | 257 if (!native_display_delegate_->GetHDCPState(*it->display, |
| 258 new_desired_state)) | 258 ¤t_state)) |
| 259 return false; | 259 return false; |
| 260 bool current_desired = (current_state != HDCP_STATE_UNDESIRED); |
| 261 bool new_desired = (all_desired & CONTENT_PROTECTION_METHOD_HDCP); |
| 262 // Don't enable again if HDCP is already active. Some buggy drivers |
| 263 // may disable and enable if setting "desired" in active state. |
| 264 if (current_desired != new_desired) { |
| 265 HDCPState new_state = |
| 266 new_desired ? HDCP_STATE_DESIRED : HDCP_STATE_UNDESIRED; |
| 267 if (!native_display_delegate_->SetHDCPState(*it->display, new_state)) |
| 268 return false; |
| 269 } |
| 260 break; | 270 break; |
| 261 } | 271 } |
| 262 case DISPLAY_CONNECTION_TYPE_INTERNAL: | 272 case DISPLAY_CONNECTION_TYPE_INTERNAL: |
| 263 case DISPLAY_CONNECTION_TYPE_VGA: | 273 case DISPLAY_CONNECTION_TYPE_VGA: |
| 264 case DISPLAY_CONNECTION_TYPE_NETWORK: | 274 case DISPLAY_CONNECTION_TYPE_NETWORK: |
| 265 // No protections for these types. Do nothing. | 275 // No protections for these types. Do nothing. |
| 266 break; | 276 break; |
| 267 case DISPLAY_CONNECTION_TYPE_NONE: | 277 case DISPLAY_CONNECTION_TYPE_NONE: |
| 268 NOTREACHED(); | 278 NOTREACHED(); |
| 269 break; | 279 break; |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 return state_controller_->GetStateForDisplayIds(display_ids); | 959 return state_controller_->GetStateForDisplayIds(display_ids); |
| 950 } | 960 } |
| 951 } | 961 } |
| 952 default: | 962 default: |
| 953 NOTREACHED(); | 963 NOTREACHED(); |
| 954 } | 964 } |
| 955 return MULTIPLE_DISPLAY_STATE_INVALID; | 965 return MULTIPLE_DISPLAY_STATE_INVALID; |
| 956 } | 966 } |
| 957 | 967 |
| 958 } // namespace ui | 968 } // namespace ui |
| OLD | NEW |