| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/pepper/content_decryptor_delegate.h" | 5 #include "content/renderer/pepper/content_decryptor_delegate.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 | 823 |
| 824 void ContentDecryptorDelegate::OnSessionExpirationChange( | 824 void ContentDecryptorDelegate::OnSessionExpirationChange( |
| 825 PP_Var session_id, | 825 PP_Var session_id, |
| 826 PP_Time new_expiry_time) { | 826 PP_Time new_expiry_time) { |
| 827 if (session_expiration_update_cb_.is_null()) | 827 if (session_expiration_update_cb_.is_null()) |
| 828 return; | 828 return; |
| 829 | 829 |
| 830 StringVar* session_id_string = StringVar::FromPPVar(session_id); | 830 StringVar* session_id_string = StringVar::FromPPVar(session_id); |
| 831 DCHECK(session_id_string); | 831 DCHECK(session_id_string); |
| 832 | 832 |
| 833 session_expiration_update_cb_.Run(session_id_string->value(), | 833 // PPTimeToTime() converts exact 0 to base::Time::UnixEpoch, which is not |
| 834 ppapi::PPTimeToTime(new_expiry_time)); | 834 // desired here. We want to convert 0.0 to a null base::Time. |
| 835 base::Time expiry_time; |
| 836 if (new_expiry_time != 0.0) |
| 837 expiry_time = ppapi::PPTimeToTime(new_expiry_time); |
| 838 |
| 839 session_expiration_update_cb_.Run(session_id_string->value(), expiry_time); |
| 835 } | 840 } |
| 836 | 841 |
| 837 void ContentDecryptorDelegate::OnSessionClosed(PP_Var session_id) { | 842 void ContentDecryptorDelegate::OnSessionClosed(PP_Var session_id) { |
| 838 StringVar* session_id_string = StringVar::FromPPVar(session_id); | 843 StringVar* session_id_string = StringVar::FromPPVar(session_id); |
| 839 DCHECK(session_id_string); | 844 DCHECK(session_id_string); |
| 840 | 845 |
| 841 cdm_session_tracker_.RemoveSession(session_id_string->value()); | 846 cdm_session_tracker_.RemoveSession(session_id_string->value()); |
| 842 if (!session_closed_cb_.is_null()) | 847 if (!session_closed_cb_.is_null()) |
| 843 session_closed_cb_.Run(session_id_string->value()); | 848 session_closed_cb_.Run(session_id_string->value()); |
| 844 } | 849 } |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 | 1280 |
| 1276 if (!video_decode_cb_.is_null()) | 1281 if (!video_decode_cb_.is_null()) |
| 1277 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); | 1282 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); |
| 1278 | 1283 |
| 1279 cdm_promise_adapter_.Clear(); | 1284 cdm_promise_adapter_.Clear(); |
| 1280 | 1285 |
| 1281 cdm_session_tracker_.CloseRemainingSessions(session_closed_cb_); | 1286 cdm_session_tracker_.CloseRemainingSessions(session_closed_cb_); |
| 1282 } | 1287 } |
| 1283 | 1288 |
| 1284 } // namespace content | 1289 } // namespace content |
| OLD | NEW |