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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
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/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "media/base/media_keys.h" | 15 #include "media/base/media_keys.h" |
16 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h " | 16 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h " |
17 | 17 |
18 class GURL; | 18 class GURL; |
19 | 19 |
20 namespace media { | 20 namespace media { |
21 | 21 |
22 class CdmFactory; | 22 class CdmFactory; |
23 class Decryptor; | |
23 class WebContentDecryptionModuleSessionImpl; | 24 class WebContentDecryptionModuleSessionImpl; |
24 | 25 |
25 // Owns the CDM instance and makes calls from session objects to the CDM. | 26 // Owns the CDM instance and makes calls from session objects to the CDM. |
26 // Forwards the web session ID-based callbacks of the MediaKeys interface to the | 27 // Forwards the web session ID-based callbacks of the MediaKeys interface to the |
27 // appropriate session object. Callers should hold references to this class | 28 // appropriate session object. Callers should hold references to this class |
28 // as long as they need the CDM instance. | 29 // as long as they need the CDM instance. |
29 class CdmSessionAdapter : public base::RefCounted<CdmSessionAdapter> { | 30 class CdmSessionAdapter : public base::RefCounted<CdmSessionAdapter> { |
30 public: | 31 public: |
31 CdmSessionAdapter(); | 32 CdmSessionAdapter(); |
32 | 33 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 | 86 |
86 // Retrieves the key IDs for keys in the session that the CDM knows are | 87 // Retrieves the key IDs for keys in the session that the CDM knows are |
87 // currently usable to decrypt media data. | 88 // currently usable to decrypt media data. |
88 void GetUsableKeyIds(const std::string& web_session_id, | 89 void GetUsableKeyIds(const std::string& web_session_id, |
89 scoped_ptr<KeyIdsPromise> promise); | 90 scoped_ptr<KeyIdsPromise> promise); |
90 | 91 |
91 // Returns the Decryptor associated with this CDM. May be NULL if no | 92 // Returns the Decryptor associated with this CDM. May be NULL if no |
92 // Decryptor is associated with the MediaKeys object. | 93 // Decryptor is associated with the MediaKeys object. |
93 // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor | 94 // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor |
94 // after WebContentDecryptionModule is freed. http://crbug.com/330324 | 95 // after WebContentDecryptionModule is freed. http://crbug.com/330324 |
95 Decryptor* GetDecryptor(); | 96 Decryptor* GetDecryptor(); |
ddorwin
2014/11/21 05:04:27
What do we use this for? Should this class be a Cd
xhwang
2014/11/21 05:15:41
This CL only introduce the new interface. In the n
| |
96 | 97 |
97 // Returns a prefix to use for UMAs. | 98 // Returns a prefix to use for UMAs. |
98 const std::string& GetKeySystemUMAPrefix() const; | 99 const std::string& GetKeySystemUMAPrefix() const; |
99 | 100 |
100 #if defined(ENABLE_BROWSER_CDMS) | 101 #if defined(ENABLE_BROWSER_CDMS) |
101 // Returns the CDM ID associated with the |media_keys_|. May be kInvalidCdmId | 102 // Returns the CDM ID associated with the |media_keys_|. May be kInvalidCdmId |
102 // if no CDM ID is associated. | 103 // if no CDM ID is associated. |
103 int GetCdmId() const; | 104 int GetCdmId() const; |
104 #endif | 105 #endif |
105 | 106 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 | 139 |
139 // NOTE: Weak pointers must be invalidated before all other member variables. | 140 // NOTE: Weak pointers must be invalidated before all other member variables. |
140 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; | 141 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; |
141 | 142 |
142 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); | 143 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); |
143 }; | 144 }; |
144 | 145 |
145 } // namespace media | 146 } // namespace media |
146 | 147 |
147 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ | 148 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ |
OLD | NEW |