| 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 #ifndef MEDIA_CDM_PROXY_DECRYPTOR_H_ | 5 #ifndef MEDIA_CDM_PROXY_DECRYPTOR_H_ |
| 6 #define MEDIA_CDM_PROXY_DECRYPTOR_H_ | 6 #define MEDIA_CDM_PROXY_DECRYPTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "media/base/decryptor.h" | 15 #include "media/base/decryptor.h" |
| 16 #include "media/base/media_export.h" | 16 #include "media/base/media_export.h" |
| 17 #include "media/base/media_keys.h" | 17 #include "media/base/media_keys.h" |
| 18 | 18 #include "url/gurl.h" |
| 19 class GURL; | |
| 20 | 19 |
| 21 namespace media { | 20 namespace media { |
| 22 | 21 |
| 23 class CdmFactory; | 22 class CdmFactory; |
| 24 class MediaPermission; | 23 class MediaPermission; |
| 25 | 24 |
| 26 // ProxyDecryptor is for EME v0.1b only. It should not be used for the WD API. | 25 // ProxyDecryptor is for EME v0.1b only. It should not be used for the WD API. |
| 27 // A decryptor proxy that creates a real decryptor object on demand and | 26 // A decryptor proxy that creates a real decryptor object on demand and |
| 28 // forwards decryptor calls to it. | 27 // forwards decryptor calls to it. |
| 29 // | 28 // |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 CdmKeysInfo keys_info); | 81 CdmKeysInfo keys_info); |
| 83 void OnSessionExpirationUpdate(const std::string& session_id, | 82 void OnSessionExpirationUpdate(const std::string& session_id, |
| 84 const base::Time& new_expiry_time); | 83 const base::Time& new_expiry_time); |
| 85 void GenerateKeyAdded(const std::string& session_id); | 84 void GenerateKeyAdded(const std::string& session_id); |
| 86 void OnSessionClosed(const std::string& session_id); | 85 void OnSessionClosed(const std::string& session_id); |
| 87 void OnSessionError(const std::string& session_id, | 86 void OnSessionError(const std::string& session_id, |
| 88 MediaKeys::Exception exception_code, | 87 MediaKeys::Exception exception_code, |
| 89 uint32 system_code, | 88 uint32 system_code, |
| 90 const std::string& error_message); | 89 const std::string& error_message); |
| 91 | 90 |
| 91 // Callback for permission request. |
| 92 void OnPermissionStatus(MediaKeys::SessionType session_type, |
| 93 const std::string& init_data_type, |
| 94 const std::vector<uint8>& init_data, |
| 95 scoped_ptr<NewSessionCdmPromise> promise, |
| 96 bool granted); |
| 97 |
| 92 enum SessionCreationType { | 98 enum SessionCreationType { |
| 93 TemporarySession, | 99 TemporarySession, |
| 94 PersistentSession, | 100 PersistentSession, |
| 95 LoadSession | 101 LoadSession |
| 96 }; | 102 }; |
| 97 | 103 |
| 98 // Called when a session is actually created or loaded. | 104 // Called when a session is actually created or loaded. |
| 99 void SetSessionId(SessionCreationType session_type, | 105 void SetSessionId(SessionCreationType session_type, |
| 100 const std::string& session_id); | 106 const std::string& session_id); |
| 101 | 107 |
| 102 // The real MediaKeys that manages key operations for the ProxyDecryptor. | 108 // The real MediaKeys that manages key operations for the ProxyDecryptor. |
| 103 scoped_ptr<MediaKeys> media_keys_; | 109 scoped_ptr<MediaKeys> media_keys_; |
| 104 | 110 |
| 111 MediaPermission* media_permission_; |
| 112 |
| 105 // Callbacks for firing key events. | 113 // Callbacks for firing key events. |
| 106 KeyAddedCB key_added_cb_; | 114 KeyAddedCB key_added_cb_; |
| 107 KeyErrorCB key_error_cb_; | 115 KeyErrorCB key_error_cb_; |
| 108 KeyMessageCB key_message_cb_; | 116 KeyMessageCB key_message_cb_; |
| 109 | 117 |
| 118 std::string key_system_; |
| 119 GURL security_origin_; |
| 120 |
| 110 // Keep track of both persistent and non-persistent sessions. | 121 // Keep track of both persistent and non-persistent sessions. |
| 111 base::hash_map<std::string, bool> active_sessions_; | 122 base::hash_map<std::string, bool> active_sessions_; |
| 112 | 123 |
| 113 bool is_clear_key_; | 124 bool is_clear_key_; |
| 114 | 125 |
| 115 // NOTE: Weak pointers must be invalidated before all other member variables. | 126 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 116 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; | 127 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; |
| 117 | 128 |
| 118 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); | 129 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); |
| 119 }; | 130 }; |
| 120 | 131 |
| 121 } // namespace media | 132 } // namespace media |
| 122 | 133 |
| 123 #endif // MEDIA_CDM_PROXY_DECRYPTOR_H_ | 134 #endif // MEDIA_CDM_PROXY_DECRYPTOR_H_ |
| OLD | NEW |