| 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 "webcontentdecryptionmodulesession_impl.h" | 5 #include "webcontentdecryptionmodulesession_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 message.size()); | 489 message.size()); |
| 490 } | 490 } |
| 491 | 491 |
| 492 void WebContentDecryptionModuleSessionImpl::OnSessionKeysChange( | 492 void WebContentDecryptionModuleSessionImpl::OnSessionKeysChange( |
| 493 bool has_additional_usable_key, | 493 bool has_additional_usable_key, |
| 494 CdmKeysInfo keys_info) { | 494 CdmKeysInfo keys_info) { |
| 495 DCHECK(thread_checker_.CalledOnValidThread()); | 495 DCHECK(thread_checker_.CalledOnValidThread()); |
| 496 blink::WebVector<blink::WebEncryptedMediaKeyInformation> keys( | 496 blink::WebVector<blink::WebEncryptedMediaKeyInformation> keys( |
| 497 keys_info.size()); | 497 keys_info.size()); |
| 498 for (size_t i = 0; i < keys_info.size(); ++i) { | 498 for (size_t i = 0; i < keys_info.size(); ++i) { |
| 499 auto* key_info = keys_info[i]; | 499 auto& key_info = keys_info[i]; |
| 500 keys[i].SetId(blink::WebData(reinterpret_cast<char*>(&key_info->key_id[0]), | 500 keys[i].SetId(blink::WebData(reinterpret_cast<char*>(&key_info->key_id[0]), |
| 501 key_info->key_id.size())); | 501 key_info->key_id.size())); |
| 502 keys[i].SetStatus(convertStatus(key_info->status)); | 502 keys[i].SetStatus(convertStatus(key_info->status)); |
| 503 keys[i].SetSystemCode(key_info->system_code); | 503 keys[i].SetSystemCode(key_info->system_code); |
| 504 } | 504 } |
| 505 | 505 |
| 506 // Now send the event to blink. | 506 // Now send the event to blink. |
| 507 client_->KeysStatusesChange(keys, has_additional_usable_key); | 507 client_->KeysStatusesChange(keys, has_additional_usable_key); |
| 508 } | 508 } |
| 509 | 509 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 540 | 540 |
| 541 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; | 541 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; |
| 542 session_id_ = session_id; | 542 session_id_ = session_id; |
| 543 *status = | 543 *status = |
| 544 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) | 544 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) |
| 545 ? SessionInitStatus::NEW_SESSION | 545 ? SessionInitStatus::NEW_SESSION |
| 546 : SessionInitStatus::SESSION_ALREADY_EXISTS; | 546 : SessionInitStatus::SESSION_ALREADY_EXISTS; |
| 547 } | 547 } |
| 548 | 548 |
| 549 } // namespace media | 549 } // namespace media |
| OLD | NEW |