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 |
174 switch (status) { | 176 switch (status) { |
175 case media::CdmKeyInformation::KeyStatus::USABLE: | 177 case media::CdmKeyInformation::KeyStatus::USABLE: |
176 return cdm::kUsable; | 178 return cdm::kUsable; |
177 case media::CdmKeyInformation::KeyStatus::INTERNAL_ERROR: | 179 case media::CdmKeyInformation::KeyStatus::INTERNAL_ERROR: |
178 return cdm::kInternalError; | 180 return cdm::kInternalError; |
179 case media::CdmKeyInformation::KeyStatus::EXPIRED: | 181 case media::CdmKeyInformation::KeyStatus::EXPIRED: |
180 return cdm::kExpired; | 182 return cdm::kExpired; |
181 case media::CdmKeyInformation::KeyStatus::OUTPUT_NOT_ALLOWED: | 183 case media::CdmKeyInformation::KeyStatus::OUTPUT_NOT_ALLOWED: |
182 return cdm::kOutputNotAllowed; | 184 return cdm::kOutputNotAllowed; |
| 185 case media::CdmKeyInformation::KeyStatus::OUTPUT_DOWNSCALED: |
| 186 return cdm::kInternalError; |
| 187 case media::CdmKeyInformation::KeyStatus::KEY_STATUS_PENDING: |
| 188 return cdm::kInternalError; |
183 } | 189 } |
184 NOTIMPLEMENTED(); | 190 NOTIMPLEMENTED(); |
185 return cdm::kInternalError; | 191 return cdm::kInternalError; |
186 } | 192 } |
187 | 193 |
188 // Shallow copy all the key information from |keys_info| into |keys_vector|. | 194 // Shallow copy all the key information from |keys_info| into |keys_vector|. |
189 // |keys_vector| is only valid for the lifetime of |keys_info| because it | 195 // |keys_vector| is only valid for the lifetime of |keys_info| because it |
190 // contains pointers into the latter. | 196 // contains pointers into the latter. |
191 void ConvertCdmKeysInfo(const std::vector<media::CdmKeyInformation*>& keys_info, | 197 void ConvertCdmKeysInfo(const std::vector<media::CdmKeyInformation*>& keys_info, |
192 std::vector<cdm::KeyInformation>* keys_vector) { | 198 std::vector<cdm::KeyInformation>* keys_vector) { |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 void ClearKeyCdm::OnFileIOTestComplete(bool success) { | 902 void ClearKeyCdm::OnFileIOTestComplete(bool success) { |
897 DVLOG(1) << __FUNCTION__ << ": " << success; | 903 DVLOG(1) << __FUNCTION__ << ": " << success; |
898 std::string message = GetFileIOTestResultMessage(success); | 904 std::string message = GetFileIOTestResultMessage(success); |
899 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), | 905 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), |
900 cdm::kLicenseRequest, message.data(), | 906 cdm::kLicenseRequest, message.data(), |
901 message.length(), NULL, 0); | 907 message.length(), NULL, 0); |
902 file_io_test_runner_.reset(); | 908 file_io_test_runner_.reset(); |
903 } | 909 } |
904 | 910 |
905 } // namespace media | 911 } // namespace media |
OLD | NEW |