| 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 <utility> | 10 #include <utility> |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 return output_buffer; | 123 return output_buffer; |
| 124 } | 124 } |
| 125 | 125 |
| 126 static std::string GetUnitTestResultMessage(bool success) { | 126 static std::string GetUnitTestResultMessage(bool success) { |
| 127 std::string message(kUnitTestResultHeader); | 127 std::string message(kUnitTestResultHeader); |
| 128 message += success ? '1' : '0'; | 128 message += success ? '1' : '0'; |
| 129 return message; | 129 return message; |
| 130 } | 130 } |
| 131 | 131 |
| 132 static cdm::Error ConvertException(media::MediaKeys::Exception exception_code) { | 132 static cdm::Error ConvertException( |
| 133 media::CdmPromise::Exception exception_code) { |
| 133 switch (exception_code) { | 134 switch (exception_code) { |
| 134 case media::MediaKeys::NOT_SUPPORTED_ERROR: | 135 case media::CdmPromise::NOT_SUPPORTED_ERROR: |
| 135 return cdm::kNotSupportedError; | 136 return cdm::kNotSupportedError; |
| 136 case media::MediaKeys::INVALID_STATE_ERROR: | 137 case media::CdmPromise::INVALID_STATE_ERROR: |
| 137 return cdm::kInvalidStateError; | 138 return cdm::kInvalidStateError; |
| 138 case media::MediaKeys::INVALID_ACCESS_ERROR: | 139 case media::CdmPromise::INVALID_ACCESS_ERROR: |
| 139 return cdm::kInvalidAccessError; | 140 return cdm::kInvalidAccessError; |
| 140 case media::MediaKeys::QUOTA_EXCEEDED_ERROR: | 141 case media::CdmPromise::QUOTA_EXCEEDED_ERROR: |
| 141 return cdm::kQuotaExceededError; | 142 return cdm::kQuotaExceededError; |
| 142 case media::MediaKeys::UNKNOWN_ERROR: | 143 case media::CdmPromise::UNKNOWN_ERROR: |
| 143 return cdm::kUnknownError; | 144 return cdm::kUnknownError; |
| 144 case media::MediaKeys::CLIENT_ERROR: | 145 case media::CdmPromise::CLIENT_ERROR: |
| 145 return cdm::kClientError; | 146 return cdm::kClientError; |
| 146 case media::MediaKeys::OUTPUT_ERROR: | 147 case media::CdmPromise::OUTPUT_ERROR: |
| 147 return cdm::kOutputError; | 148 return cdm::kOutputError; |
| 148 } | 149 } |
| 149 NOTREACHED(); | 150 NOTREACHED(); |
| 150 return cdm::kUnknownError; | 151 return cdm::kUnknownError; |
| 151 } | 152 } |
| 152 | 153 |
| 153 static media::MediaKeys::SessionType ConvertSessionType( | 154 static media::MediaKeys::SessionType ConvertSessionType( |
| 154 cdm::SessionType session_type) { | 155 cdm::SessionType session_type) { |
| 155 switch (session_type) { | 156 switch (session_type) { |
| 156 case cdm::kTemporary: | 157 case cdm::kTemporary: |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 !keys_vector.empty(), keys_vector.data(), | 853 !keys_vector.empty(), keys_vector.data(), |
| 853 keys_vector.size()); | 854 keys_vector.size()); |
| 854 } | 855 } |
| 855 } | 856 } |
| 856 | 857 |
| 857 void ClearKeyCdm::OnPromiseResolved(uint32_t promise_id) { | 858 void ClearKeyCdm::OnPromiseResolved(uint32_t promise_id) { |
| 858 host_->OnResolvePromise(promise_id); | 859 host_->OnResolvePromise(promise_id); |
| 859 } | 860 } |
| 860 | 861 |
| 861 void ClearKeyCdm::OnPromiseFailed(uint32_t promise_id, | 862 void ClearKeyCdm::OnPromiseFailed(uint32_t promise_id, |
| 862 MediaKeys::Exception exception_code, | 863 CdmPromise::Exception exception_code, |
| 863 uint32_t system_code, | 864 uint32_t system_code, |
| 864 const std::string& error_message) { | 865 const std::string& error_message) { |
| 865 host_->OnRejectPromise(promise_id, | 866 host_->OnRejectPromise(promise_id, |
| 866 ConvertException(exception_code), | 867 ConvertException(exception_code), |
| 867 system_code, | 868 system_code, |
| 868 error_message.data(), | 869 error_message.data(), |
| 869 error_message.length()); | 870 error_message.length()); |
| 870 } | 871 } |
| 871 | 872 |
| 872 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) | 873 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 OnUnitTestComplete(success); | 950 OnUnitTestComplete(success); |
| 950 file_io_test_runner_.reset(); | 951 file_io_test_runner_.reset(); |
| 951 } | 952 } |
| 952 | 953 |
| 953 void ClearKeyCdm::StartOutputProtectionTest() { | 954 void ClearKeyCdm::StartOutputProtectionTest() { |
| 954 is_running_output_protection_test_ = true; | 955 is_running_output_protection_test_ = true; |
| 955 host_->QueryOutputProtectionStatus(); | 956 host_->QueryOutputProtectionStatus(); |
| 956 } | 957 } |
| 957 | 958 |
| 958 } // namespace media | 959 } // namespace media |
| OLD | NEW |