| 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/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 message.size()); | 386 message.size()); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void WebContentDecryptionModuleSessionImpl::OnSessionKeysChange( | 389 void WebContentDecryptionModuleSessionImpl::OnSessionKeysChange( |
| 390 bool has_additional_usable_key, | 390 bool has_additional_usable_key, |
| 391 CdmKeysInfo keys_info) { | 391 CdmKeysInfo keys_info) { |
| 392 DCHECK(thread_checker_.CalledOnValidThread()); | 392 DCHECK(thread_checker_.CalledOnValidThread()); |
| 393 blink::WebVector<blink::WebEncryptedMediaKeyInformation> keys( | 393 blink::WebVector<blink::WebEncryptedMediaKeyInformation> keys( |
| 394 keys_info.size()); | 394 keys_info.size()); |
| 395 for (size_t i = 0; i < keys_info.size(); ++i) { | 395 for (size_t i = 0; i < keys_info.size(); ++i) { |
| 396 const auto& key_info = keys_info[i]; | 396 auto* key_info = keys_info[i]; |
| 397 keys[i].setId(blink::WebData(reinterpret_cast<char*>(&key_info->key_id[0]), | 397 keys[i].setId(blink::WebData(reinterpret_cast<char*>(&key_info->key_id[0]), |
| 398 key_info->key_id.size())); | 398 key_info->key_id.size())); |
| 399 keys[i].setStatus(convertStatus(key_info->status)); | 399 keys[i].setStatus(convertStatus(key_info->status)); |
| 400 keys[i].setSystemCode(key_info->system_code); | 400 keys[i].setSystemCode(key_info->system_code); |
| 401 } | 401 } |
| 402 | 402 |
| 403 // Now send the event to blink. | 403 // Now send the event to blink. |
| 404 client_->keysStatusesChange(keys, has_additional_usable_key); | 404 client_->keysStatusesChange(keys, has_additional_usable_key); |
| 405 } | 405 } |
| 406 | 406 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 431 | 431 |
| 432 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; | 432 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; |
| 433 session_id_ = session_id; | 433 session_id_ = session_id; |
| 434 *status = | 434 *status = |
| 435 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) | 435 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) |
| 436 ? SessionInitStatus::NEW_SESSION | 436 ? SessionInitStatus::NEW_SESSION |
| 437 : SessionInitStatus::SESSION_ALREADY_EXISTS; | 437 : SessionInitStatus::SESSION_ALREADY_EXISTS; |
| 438 } | 438 } |
| 439 | 439 |
| 440 } // namespace media | 440 } // namespace media |
| OLD | NEW |