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 | 10 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // supported. | 323 // supported. |
324 void ClearKeyCdm::LoadSession(uint32 promise_id, | 324 void ClearKeyCdm::LoadSession(uint32 promise_id, |
325 cdm::SessionType session_type, | 325 cdm::SessionType session_type, |
326 const char* session_id, | 326 const char* session_id, |
327 uint32_t session_id_length) { | 327 uint32_t session_id_length) { |
328 DVLOG(1) << __FUNCTION__; | 328 DVLOG(1) << __FUNCTION__; |
329 DCHECK_EQ(session_type, cdm::kPersistentLicense); | 329 DCHECK_EQ(session_type, cdm::kPersistentLicense); |
330 | 330 |
331 if (std::string(kLoadableSessionId) != | 331 if (std::string(kLoadableSessionId) != |
332 std::string(session_id, session_id_length)) { | 332 std::string(session_id, session_id_length)) { |
333 // TODO(jrummell): This should be resolved with undefined, not rejected. | 333 host_->OnResolveNewSessionPromise(promise_id, nullptr, 0); |
334 std::string message("Incorrect session id specified for LoadSession()."); | |
335 host_->OnRejectPromise(promise_id, | |
336 cdm::kInvalidAccessError, | |
337 0, | |
338 message.data(), | |
339 message.length()); | |
340 return; | 334 return; |
341 } | 335 } |
342 | 336 |
343 // Only allowed to successfully load this session once. | 337 // Only allowed to successfully load this session once. |
344 DCHECK(session_id_for_emulated_loadsession_.empty()); | 338 DCHECK(session_id_for_emulated_loadsession_.empty()); |
345 | 339 |
346 scoped_ptr<media::NewSessionCdmPromise> promise( | 340 scoped_ptr<media::NewSessionCdmPromise> promise( |
347 new media::CdmCallbackPromise<std::string>( | 341 new media::CdmCallbackPromise<std::string>( |
348 base::Bind(&ClearKeyCdm::OnSessionLoaded, | 342 base::Bind(&ClearKeyCdm::OnSessionLoaded, |
349 base::Unretained(this), | 343 base::Unretained(this), |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 void ClearKeyCdm::OnFileIOTestComplete(bool success) { | 908 void ClearKeyCdm::OnFileIOTestComplete(bool success) { |
915 DVLOG(1) << __FUNCTION__ << ": " << success; | 909 DVLOG(1) << __FUNCTION__ << ": " << success; |
916 std::string message = GetFileIOTestResultMessage(success); | 910 std::string message = GetFileIOTestResultMessage(success); |
917 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), | 911 host_->OnSessionMessage(last_session_id_.data(), last_session_id_.length(), |
918 cdm::kLicenseRequest, message.data(), | 912 cdm::kLicenseRequest, message.data(), |
919 message.length(), NULL, 0); | 913 message.length(), NULL, 0); |
920 file_io_test_runner_.reset(); | 914 file_io_test_runner_.reset(); |
921 } | 915 } |
922 | 916 |
923 } // namespace media | 917 } // namespace media |
OLD | NEW |