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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 // Defer OnSessionCreated() until the session is loaded. | 555 // Defer OnSessionCreated() until the session is loaded. |
556 return; | 556 return; |
557 } | 557 } |
558 | 558 |
559 host_->OnSessionCreated( | 559 host_->OnSessionCreated( |
560 session_id, web_session_id.data(), web_session_id.size()); | 560 session_id, web_session_id.data(), web_session_id.size()); |
561 } | 561 } |
562 | 562 |
563 void ClearKeyCdm::OnSessionMessage(uint32 session_id, | 563 void ClearKeyCdm::OnSessionMessage(uint32 session_id, |
564 const std::vector<uint8>& message, | 564 const std::vector<uint8>& message, |
565 const std::string& destination_url) { | 565 const GURL& destination_url) { |
566 DVLOG(1) << "OnSessionMessage: " << message.size(); | 566 DVLOG(1) << "OnSessionMessage: " << message.size(); |
567 | 567 |
568 // Ignore the message when we are waiting to update the loadable session. | 568 // Ignore the message when we are waiting to update the loadable session. |
569 if (session_id == session_id_for_emulated_loadsession_) | 569 if (session_id == session_id_for_emulated_loadsession_) |
570 return; | 570 return; |
571 | 571 |
572 host_->OnSessionMessage(session_id, | 572 host_->OnSessionMessage(session_id, |
573 reinterpret_cast<const char*>(message.data()), | 573 reinterpret_cast<const char*>(message.data()), |
574 message.size(), | 574 message.size(), |
575 destination_url.data(), | 575 destination_url.spec().data(), |
576 destination_url.size()); | 576 destination_url.spec().size()); |
577 } | 577 } |
578 | 578 |
579 void ClearKeyCdm::OnSessionReady(uint32 session_id) { | 579 void ClearKeyCdm::OnSessionReady(uint32 session_id) { |
580 if (session_id == session_id_for_emulated_loadsession_) { | 580 if (session_id == session_id_for_emulated_loadsession_) { |
581 session_id_for_emulated_loadsession_ = MediaKeys::kInvalidSessionId; | 581 session_id_for_emulated_loadsession_ = MediaKeys::kInvalidSessionId; |
582 host_->OnSessionCreated( | 582 host_->OnSessionCreated( |
583 session_id, kLoadableWebSessionId, strlen(kLoadableWebSessionId)); | 583 session_id, kLoadableWebSessionId, strlen(kLoadableWebSessionId)); |
584 } | 584 } |
585 | 585 |
586 host_->OnSessionReady(session_id); | 586 host_->OnSessionReady(session_id); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 | 665 |
666 void ClearKeyCdm::OnFileIOTestComplete(bool success) { | 666 void ClearKeyCdm::OnFileIOTestComplete(bool success) { |
667 DVLOG(1) << __FUNCTION__ << ": " << success; | 667 DVLOG(1) << __FUNCTION__ << ": " << success; |
668 std::string message = GetFileIOTestResultMessage(success); | 668 std::string message = GetFileIOTestResultMessage(success); |
669 host_->OnSessionMessage( | 669 host_->OnSessionMessage( |
670 last_session_id_, message.data(), message.size(), NULL, 0); | 670 last_session_id_, message.data(), message.size(), NULL, 0); |
671 file_io_test_runner_.reset(); | 671 file_io_test_runner_.reset(); |
672 } | 672 } |
673 | 673 |
674 } // namespace media | 674 } // namespace media |
OLD | NEW |