| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ | 5 #ifndef MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ |
| 6 #define MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ | 6 #define MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 // Callback for CreateCdm(). | 114 // Callback for CreateCdm(). |
| 115 void OnCdmCreated(const std::string& key_system, | 115 void OnCdmCreated(const std::string& key_system, |
| 116 base::TimeTicks start_time, | 116 base::TimeTicks start_time, |
| 117 const scoped_refptr<MediaKeys>& cdm, | 117 const scoped_refptr<MediaKeys>& cdm, |
| 118 const std::string& error_message); | 118 const std::string& error_message); |
| 119 | 119 |
| 120 // Callbacks for firing session events. | 120 // Callbacks for firing session events. |
| 121 void OnSessionMessage(const std::string& session_id, | 121 void OnSessionMessage(const std::string& session_id, |
| 122 MediaKeys::MessageType message_type, | 122 MediaKeys::MessageType message_type, |
| 123 const std::vector<uint8_t>& message, | 123 const std::vector<uint8_t>& message); |
| 124 const GURL& legacy_destination_url); | |
| 125 void OnSessionKeysChange(const std::string& session_id, | 124 void OnSessionKeysChange(const std::string& session_id, |
| 126 bool has_additional_usable_key, | 125 bool has_additional_usable_key, |
| 127 CdmKeysInfo keys_info); | 126 CdmKeysInfo keys_info); |
| 128 void OnSessionExpirationUpdate(const std::string& session_id, | 127 void OnSessionExpirationUpdate(const std::string& session_id, |
| 129 const base::Time& new_expiry_time); | 128 const base::Time& new_expiry_time); |
| 130 void OnSessionClosed(const std::string& session_id); | 129 void OnSessionClosed(const std::string& session_id); |
| 131 void OnLegacySessionError(const std::string& session_id, | |
| 132 MediaKeys::Exception exception_code, | |
| 133 uint32_t system_code, | |
| 134 const std::string& error_message); | |
| 135 | 130 |
| 136 // Helper function of the callbacks. | 131 // Helper function of the callbacks. |
| 137 WebContentDecryptionModuleSessionImpl* GetSession( | 132 WebContentDecryptionModuleSessionImpl* GetSession( |
| 138 const std::string& session_id); | 133 const std::string& session_id); |
| 139 | 134 |
| 140 void ReportTimeToCreateCdmUMA(base::TimeDelta cdm_creation_time) const; | 135 void ReportTimeToCreateCdmUMA(base::TimeDelta cdm_creation_time) const; |
| 141 | 136 |
| 142 scoped_refptr<MediaKeys> cdm_; | 137 scoped_refptr<MediaKeys> cdm_; |
| 143 | 138 |
| 144 SessionMap sessions_; | 139 SessionMap sessions_; |
| 145 | 140 |
| 146 std::string key_system_; | 141 std::string key_system_; |
| 147 std::string key_system_uma_prefix_; | 142 std::string key_system_uma_prefix_; |
| 148 | 143 |
| 149 // A unique ID to trace CdmSessionAdapter::CreateCdm() call and the matching | 144 // A unique ID to trace CdmSessionAdapter::CreateCdm() call and the matching |
| 150 // OnCdmCreated() call. | 145 // OnCdmCreated() call. |
| 151 uint32_t trace_id_; | 146 uint32_t trace_id_; |
| 152 | 147 |
| 153 std::unique_ptr<blink::WebContentDecryptionModuleResult> cdm_created_result_; | 148 std::unique_ptr<blink::WebContentDecryptionModuleResult> cdm_created_result_; |
| 154 | 149 |
| 155 // NOTE: Weak pointers must be invalidated before all other member variables. | 150 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 156 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; | 151 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; |
| 157 | 152 |
| 158 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); | 153 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); |
| 159 }; | 154 }; |
| 160 | 155 |
| 161 } // namespace media | 156 } // namespace media |
| 162 | 157 |
| 163 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ | 158 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ |
| OLD | NEW |