Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/mojo/services/mojo_cdm.h" | 5 #include "media/mojo/services/mojo_cdm.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "media/base/cdm_key_information.h" | 9 #include "media/base/cdm_key_information.h" |
| 10 #include "media/base/cdm_promise.h" | 10 #include "media/base/cdm_promise.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 result->system_code, result->error_message); | 32 result->system_code, result->error_message); |
| 33 } | 33 } |
| 34 | 34 |
| 35 MojoCdm::MojoCdm(mojo::ContentDecryptionModulePtr remote_cdm, | 35 MojoCdm::MojoCdm(mojo::ContentDecryptionModulePtr remote_cdm, |
| 36 const SessionMessageCB& session_message_cb, | 36 const SessionMessageCB& session_message_cb, |
| 37 const SessionClosedCB& session_closed_cb, | 37 const SessionClosedCB& session_closed_cb, |
| 38 const SessionErrorCB& session_error_cb, | 38 const SessionErrorCB& session_error_cb, |
| 39 const SessionKeysChangeCB& session_keys_change_cb, | 39 const SessionKeysChangeCB& session_keys_change_cb, |
| 40 const SessionExpirationUpdateCB& session_expiration_update_cb) | 40 const SessionExpirationUpdateCB& session_expiration_update_cb) |
| 41 : remote_cdm_(remote_cdm.Pass()), | 41 : remote_cdm_(remote_cdm.Pass()), |
| 42 binding_(this), | |
| 42 session_message_cb_(session_message_cb), | 43 session_message_cb_(session_message_cb), |
| 43 session_closed_cb_(session_closed_cb), | 44 session_closed_cb_(session_closed_cb), |
| 44 session_error_cb_(session_error_cb), | 45 session_error_cb_(session_error_cb), |
| 45 session_keys_change_cb_(session_keys_change_cb), | 46 session_keys_change_cb_(session_keys_change_cb), |
| 46 session_expiration_update_cb_(session_expiration_update_cb), | 47 session_expiration_update_cb_(session_expiration_update_cb), |
| 47 weak_factory_(this) { | 48 weak_factory_(this) { |
| 48 DVLOG(1) << __FUNCTION__; | 49 DVLOG(1) << __FUNCTION__; |
| 49 DCHECK(!session_message_cb_.is_null()); | 50 DCHECK(!session_message_cb_.is_null()); |
| 50 DCHECK(!session_closed_cb_.is_null()); | 51 DCHECK(!session_closed_cb_.is_null()); |
| 51 DCHECK(!session_error_cb_.is_null()); | 52 DCHECK(!session_error_cb_.is_null()); |
| 52 DCHECK(!session_keys_change_cb_.is_null()); | 53 DCHECK(!session_keys_change_cb_.is_null()); |
| 53 DCHECK(!session_expiration_update_cb_.is_null()); | 54 DCHECK(!session_expiration_update_cb_.is_null()); |
| 54 | 55 |
| 55 // TODO(xhwang): Client syntax has been removed, so a new mechanism for client | 56 mojo::ContentDecryptionModuleClientPtr client_ptr; |
| 56 // discovery must be added to this interface. See http://crbug.com/451321. | 57 binding_.Bind(GetProxy(&client_ptr)); |
| 57 NOTREACHED(); | 58 remote_cdm_->SetClient(client_ptr.Pass()); |
|
xhwang
2015/03/17 23:30:37
We don't need to wait for a confirmation callaback
| |
| 58 } | 59 } |
| 59 | 60 |
| 60 MojoCdm::~MojoCdm() { | 61 MojoCdm::~MojoCdm() { |
| 61 DVLOG(1) << __FUNCTION__; | 62 DVLOG(1) << __FUNCTION__; |
| 62 } | 63 } |
| 63 | 64 |
| 64 void MojoCdm::SetServerCertificate(const uint8_t* certificate_data, | 65 void MojoCdm::SetServerCertificate(const uint8_t* certificate_data, |
| 65 int certificate_data_length, | 66 int certificate_data_length, |
| 66 scoped_ptr<SimpleCdmPromise> promise) { | 67 scoped_ptr<SimpleCdmPromise> promise) { |
| 67 remote_cdm_->SetServerCertificate( | 68 remote_cdm_->SetServerCertificate( |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 key_data.Pass()); | 166 key_data.Pass()); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void MojoCdm::OnSessionExpirationUpdate(const mojo::String& session_id, | 169 void MojoCdm::OnSessionExpirationUpdate(const mojo::String& session_id, |
| 169 int64_t new_expiry_time_usec) { | 170 int64_t new_expiry_time_usec) { |
| 170 session_expiration_update_cb_.Run( | 171 session_expiration_update_cb_.Run( |
| 171 session_id, base::Time::FromInternalValue(new_expiry_time_usec)); | 172 session_id, base::Time::FromInternalValue(new_expiry_time_usec)); |
| 172 } | 173 } |
| 173 | 174 |
| 174 } // namespace media | 175 } // namespace media |
| OLD | NEW |