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 |
19 class GURL; | 19 class GURL; |
20 | 20 |
21 namespace media { | 21 namespace media { |
22 | 22 |
23 class CdmFactory; | 23 class CdmFactory; |
| 24 class MediaPermission; |
24 | 25 |
25 // ProxyDecryptor is for EME v0.1b only. It should not be used for the WD API. | 26 // ProxyDecryptor is for EME v0.1b only. It should not be used for the WD API. |
26 // A decryptor proxy that creates a real decryptor object on demand and | 27 // A decryptor proxy that creates a real decryptor object on demand and |
27 // forwards decryptor calls to it. | 28 // forwards decryptor calls to it. |
28 // | 29 // |
29 // TODO(xhwang): Currently we don't support run-time switching among decryptor | 30 // TODO(xhwang): Currently we don't support run-time switching among decryptor |
30 // objects. Fix this when needed. | 31 // objects. Fix this when needed. |
31 // TODO(xhwang): The ProxyDecryptor is not a Decryptor. Find a better name! | 32 // TODO(xhwang): The ProxyDecryptor is not a Decryptor. Find a better name! |
32 class MEDIA_EXPORT ProxyDecryptor { | 33 class MEDIA_EXPORT ProxyDecryptor { |
33 public: | 34 public: |
34 // These are similar to the callbacks in media_keys.h, but pass back the | 35 // These are similar to the callbacks in media_keys.h, but pass back the |
35 // session ID rather than the internal session ID. | 36 // session ID rather than the internal session ID. |
36 typedef base::Callback<void(const std::string& session_id)> KeyAddedCB; | 37 typedef base::Callback<void(const std::string& session_id)> KeyAddedCB; |
37 typedef base::Callback<void(const std::string& session_id, | 38 typedef base::Callback<void(const std::string& session_id, |
38 MediaKeys::KeyError error_code, | 39 MediaKeys::KeyError error_code, |
39 uint32 system_code)> KeyErrorCB; | 40 uint32 system_code)> KeyErrorCB; |
40 typedef base::Callback<void(const std::string& session_id, | 41 typedef base::Callback<void(const std::string& session_id, |
41 const std::vector<uint8>& message, | 42 const std::vector<uint8>& message, |
42 const GURL& destination_url)> KeyMessageCB; | 43 const GURL& destination_url)> KeyMessageCB; |
43 | 44 |
44 ProxyDecryptor(const KeyAddedCB& key_added_cb, | 45 ProxyDecryptor(MediaPermission* media_permission, |
| 46 const KeyAddedCB& key_added_cb, |
45 const KeyErrorCB& key_error_cb, | 47 const KeyErrorCB& key_error_cb, |
46 const KeyMessageCB& key_message_cb); | 48 const KeyMessageCB& key_message_cb); |
47 virtual ~ProxyDecryptor(); | 49 virtual ~ProxyDecryptor(); |
48 | 50 |
49 // Returns the CdmContext associated with this object. | 51 // Returns the CdmContext associated with this object. |
50 CdmContext* GetCdmContext(); | 52 CdmContext* GetCdmContext(); |
51 | 53 |
52 // Only call this once. | 54 // Only call this once. |
53 bool InitializeCDM(CdmFactory* cdm_factory, | 55 bool InitializeCDM(CdmFactory* cdm_factory, |
54 const std::string& key_system, | 56 const std::string& key_system, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 114 |
113 // NOTE: Weak pointers must be invalidated before all other member variables. | 115 // NOTE: Weak pointers must be invalidated before all other member variables. |
114 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; | 116 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; |
115 | 117 |
116 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); | 118 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); |
117 }; | 119 }; |
118 | 120 |
119 } // namespace media | 121 } // namespace media |
120 | 122 |
121 #endif // MEDIA_CDM_PROXY_DECRYPTOR_H_ | 123 #endif // MEDIA_CDM_PROXY_DECRYPTOR_H_ |
OLD | NEW |