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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 keys[i].setSystemCode(key_info->system_code); | 487 keys[i].setSystemCode(key_info->system_code); |
488 } | 488 } |
489 | 489 |
490 // Now send the event to blink. | 490 // Now send the event to blink. |
491 client_->keysStatusesChange(keys, has_additional_usable_key); | 491 client_->keysStatusesChange(keys, has_additional_usable_key); |
492 } | 492 } |
493 | 493 |
494 void WebContentDecryptionModuleSessionImpl::OnSessionExpirationUpdate( | 494 void WebContentDecryptionModuleSessionImpl::OnSessionExpirationUpdate( |
495 base::Time new_expiry_time) { | 495 base::Time new_expiry_time) { |
496 DCHECK(thread_checker_.CalledOnValidThread()); | 496 DCHECK(thread_checker_.CalledOnValidThread()); |
497 client_->expirationChanged(new_expiry_time.ToJsTime()); | 497 // The check works around an issue in base::Time that converts null base::Time |
| 498 // to |1601-01-01 00:00:00 UTC| in ToJsTime(). See http://crbug.com/679079 |
| 499 client_->expirationChanged(new_expiry_time.is_null() |
| 500 ? std::numeric_limits<double>::quiet_NaN() |
| 501 : new_expiry_time.ToJsTime()); |
498 } | 502 } |
499 | 503 |
500 void WebContentDecryptionModuleSessionImpl::OnSessionClosed() { | 504 void WebContentDecryptionModuleSessionImpl::OnSessionClosed() { |
501 DCHECK(thread_checker_.CalledOnValidThread()); | 505 DCHECK(thread_checker_.CalledOnValidThread()); |
502 | 506 |
503 // Only send one closed event to blink. | 507 // Only send one closed event to blink. |
504 if (is_closed_) | 508 if (is_closed_) |
505 return; | 509 return; |
506 | 510 |
507 is_closed_ = true; | 511 is_closed_ = true; |
(...skipping 12 matching lines...) Expand all Loading... |
520 | 524 |
521 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; | 525 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; |
522 session_id_ = session_id; | 526 session_id_ = session_id; |
523 *status = | 527 *status = |
524 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) | 528 adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) |
525 ? SessionInitStatus::NEW_SESSION | 529 ? SessionInitStatus::NEW_SESSION |
526 : SessionInitStatus::SESSION_ALREADY_EXISTS; | 530 : SessionInitStatus::SESSION_ALREADY_EXISTS; |
527 } | 531 } |
528 | 532 |
529 } // namespace media | 533 } // namespace media |
OLD | NEW |