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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // 10.6 Let message be null. | 353 // 10.6 Let message be null. |
354 // 10.7 Let message type be null. | 354 // 10.7 Let message type be null. |
355 // (Done by CDM.) | 355 // (Done by CDM.) |
356 | 356 |
357 // 10.8 Let cdm be the CDM instance represented by this object's cdm | 357 // 10.8 Let cdm be the CDM instance represented by this object's cdm |
358 // instance value. | 358 // instance value. |
359 // 10.9 Use the cdm to execute the following steps: | 359 // 10.9 Use the cdm to execute the following steps: |
360 adapter_->InitializeNewSession( | 360 adapter_->InitializeNewSession( |
361 eme_init_data_type, sanitized_init_data, convertSessionType(session_type), | 361 eme_init_data_type, sanitized_init_data, convertSessionType(session_type), |
362 std::unique_ptr<NewSessionCdmPromise>(new NewSessionCdmResultPromise( | 362 std::unique_ptr<NewSessionCdmPromise>(new NewSessionCdmResultPromise( |
363 result, adapter_->GetKeySystemUMAPrefix() + kGenerateRequestUMAName, | 363 result, adapter_->GetKeySystemUMAPrefix(), kGenerateRequestUMAName, |
364 base::Bind( | 364 base::Bind( |
365 &WebContentDecryptionModuleSessionImpl::OnSessionInitialized, | 365 &WebContentDecryptionModuleSessionImpl::OnSessionInitialized, |
366 weak_ptr_factory_.GetWeakPtr())))); | 366 weak_ptr_factory_.GetWeakPtr())))); |
367 } | 367 } |
368 | 368 |
369 void WebContentDecryptionModuleSessionImpl::load( | 369 void WebContentDecryptionModuleSessionImpl::load( |
370 const blink::WebString& session_id, | 370 const blink::WebString& session_id, |
371 blink::WebContentDecryptionModuleResult result) { | 371 blink::WebContentDecryptionModuleResult result) { |
372 DCHECK(!session_id.isEmpty()); | 372 DCHECK(!session_id.isEmpty()); |
373 DCHECK(session_id_.empty()); | 373 DCHECK(session_id_.empty()); |
(...skipping 13 matching lines...) Expand all Loading... |
387 "Invalid session ID."); | 387 "Invalid session ID."); |
388 return; | 388 return; |
389 } | 389 } |
390 | 390 |
391 // TODO(jrummell): Now that there are 2 types of persistent sessions, the | 391 // TODO(jrummell): Now that there are 2 types of persistent sessions, the |
392 // session type should be passed from blink. Type should also be passed in the | 392 // session type should be passed from blink. Type should also be passed in the |
393 // constructor (and removed from initializeNewSession()). | 393 // constructor (and removed from initializeNewSession()). |
394 adapter_->LoadSession( | 394 adapter_->LoadSession( |
395 CdmSessionType::PERSISTENT_LICENSE_SESSION, sanitized_session_id, | 395 CdmSessionType::PERSISTENT_LICENSE_SESSION, sanitized_session_id, |
396 std::unique_ptr<NewSessionCdmPromise>(new NewSessionCdmResultPromise( | 396 std::unique_ptr<NewSessionCdmPromise>(new NewSessionCdmResultPromise( |
397 result, adapter_->GetKeySystemUMAPrefix() + kLoadSessionUMAName, | 397 result, adapter_->GetKeySystemUMAPrefix(), kLoadSessionUMAName, |
398 base::Bind( | 398 base::Bind( |
399 &WebContentDecryptionModuleSessionImpl::OnSessionInitialized, | 399 &WebContentDecryptionModuleSessionImpl::OnSessionInitialized, |
400 weak_ptr_factory_.GetWeakPtr())))); | 400 weak_ptr_factory_.GetWeakPtr())))); |
401 } | 401 } |
402 | 402 |
403 void WebContentDecryptionModuleSessionImpl::update( | 403 void WebContentDecryptionModuleSessionImpl::update( |
404 const uint8_t* response, | 404 const uint8_t* response, |
405 size_t response_length, | 405 size_t response_length, |
406 blink::WebContentDecryptionModuleResult result) { | 406 blink::WebContentDecryptionModuleResult result) { |
407 DCHECK(response); | 407 DCHECK(response); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 | 525 |
526 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; | 526 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; |
527 session_id_ = session_id; | 527 session_id_ = session_id; |
528 *status = | 528 *status = |
529 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) | 529 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) |
530 ? SessionInitStatus::NEW_SESSION | 530 ? SessionInitStatus::NEW_SESSION |
531 : SessionInitStatus::SESSION_ALREADY_EXISTS; | 531 : SessionInitStatus::SESSION_ALREADY_EXISTS; |
532 } | 532 } |
533 | 533 |
534 } // namespace media | 534 } // namespace media |
OLD | NEW |