| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "media/cdm/ppapi/external_clear_key/clear_key_cdm.h" | 5 #include "media/cdm/ppapi/external_clear_key/clear_key_cdm.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 case cdm::kPersistentLicense: | 164 case cdm::kPersistentLicense: |
| 165 return media::MediaKeys::PERSISTENT_LICENSE_SESSION; | 165 return media::MediaKeys::PERSISTENT_LICENSE_SESSION; |
| 166 case cdm::kPersistentKeyRelease: | 166 case cdm::kPersistentKeyRelease: |
| 167 return media::MediaKeys::PERSISTENT_RELEASE_MESSAGE_SESSION; | 167 return media::MediaKeys::PERSISTENT_RELEASE_MESSAGE_SESSION; |
| 168 } | 168 } |
| 169 NOTIMPLEMENTED(); | 169 NOTIMPLEMENTED(); |
| 170 return media::MediaKeys::TEMPORARY_SESSION; | 170 return media::MediaKeys::TEMPORARY_SESSION; |
| 171 } | 171 } |
| 172 | 172 |
| 173 cdm::KeyStatus ConvertKeyStatus(media::CdmKeyInformation::KeyStatus status) { | 173 cdm::KeyStatus ConvertKeyStatus(media::CdmKeyInformation::KeyStatus status) { |
| 174 // TODO(jrummell): Update OUTPUT_DOWNSCALED and KEY_STATUS_PENDING once CDM | |
| 175 // interface supports them. http://crbug.com/450861 | |
| 176 switch (status) { | 174 switch (status) { |
| 177 case media::CdmKeyInformation::KeyStatus::USABLE: | 175 case media::CdmKeyInformation::KeyStatus::USABLE: |
| 178 return cdm::kUsable; | 176 return cdm::kUsable; |
| 179 case media::CdmKeyInformation::KeyStatus::INTERNAL_ERROR: | 177 case media::CdmKeyInformation::KeyStatus::INTERNAL_ERROR: |
| 180 return cdm::kInternalError; | 178 return cdm::kInternalError; |
| 181 case media::CdmKeyInformation::KeyStatus::EXPIRED: | 179 case media::CdmKeyInformation::KeyStatus::EXPIRED: |
| 182 return cdm::kExpired; | 180 return cdm::kExpired; |
| 183 case media::CdmKeyInformation::KeyStatus::OUTPUT_NOT_ALLOWED: | 181 case media::CdmKeyInformation::KeyStatus::OUTPUT_NOT_ALLOWED: |
| 184 return cdm::kOutputNotAllowed; | 182 return cdm::kOutputNotAllowed; |
| 185 case media::CdmKeyInformation::KeyStatus::OUTPUT_DOWNSCALED: | 183 case media::CdmKeyInformation::KeyStatus::OUTPUT_DOWNSCALED: |
| 186 return cdm::kInternalError; | 184 return cdm::kOutputDownscaled; |
| 187 case media::CdmKeyInformation::KeyStatus::KEY_STATUS_PENDING: | 185 case media::CdmKeyInformation::KeyStatus::KEY_STATUS_PENDING: |
| 188 return cdm::kInternalError; | 186 return cdm::kStatusPending; |
| 189 } | 187 } |
| 190 NOTIMPLEMENTED(); | 188 NOTIMPLEMENTED(); |
| 191 return cdm::kInternalError; | 189 return cdm::kInternalError; |
| 192 } | 190 } |
| 193 | 191 |
| 194 // Shallow copy all the key information from |keys_info| into |keys_vector|. | 192 // Shallow copy all the key information from |keys_info| into |keys_vector|. |
| 195 // |keys_vector| is only valid for the lifetime of |keys_info| because it | 193 // |keys_vector| is only valid for the lifetime of |keys_info| because it |
| 196 // contains pointers into the latter. | 194 // contains pointers into the latter. |
| 197 void ConvertCdmKeysInfo(const std::vector<media::CdmKeyInformation*>& keys_info, | 195 void ConvertCdmKeysInfo(const std::vector<media::CdmKeyInformation*>& keys_info, |
| 198 std::vector<cdm::KeyInformation>* keys_vector) { | 196 std::vector<cdm::KeyInformation>* keys_vector) { |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 void ClearKeyCdm::OnFileIOTestComplete(bool success) { | 900 void ClearKeyCdm::OnFileIOTestComplete(bool success) { |
| 903 DVLOG(1) << __FUNCTION__ << ": " << success; | 901 DVLOG(1) << __FUNCTION__ << ": " << success; |
| 904 std::string message = GetFileIOTestResultMessage(success); | 902 std::string message = GetFileIOTestResultMessage(success); |
| 905 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), | 903 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), |
| 906 cdm::kLicenseRequest, message.data(), | 904 cdm::kLicenseRequest, message.data(), |
| 907 message.length(), NULL, 0); | 905 message.length(), NULL, 0); |
| 908 file_io_test_runner_.reset(); | 906 file_io_test_runner_.reset(); |
| 909 } | 907 } |
| 910 | 908 |
| 911 } // namespace media | 909 } // namespace media |
| OLD | NEW |