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_BASE_MEDIA_KEYS_H_ | 5 #ifndef MEDIA_BASE_MEDIA_KEYS_H_ |
6 #define MEDIA_BASE_MEDIA_KEYS_H_ | 6 #define MEDIA_BASE_MEDIA_KEYS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... | |
31 kClientError, | 31 kClientError, |
32 // The commented v0.1b values below have never been used. | 32 // The commented v0.1b values below have never been used. |
33 // kServiceError, | 33 // kServiceError, |
34 kOutputError = 4, | 34 kOutputError = 4, |
35 // kHardwareChangeError, | 35 // kHardwareChangeError, |
36 // kDomainError, | 36 // kDomainError, |
37 kMaxKeyError // Must be last and greater than any legit value. | 37 kMaxKeyError // Must be last and greater than any legit value. |
38 }; | 38 }; |
39 | 39 |
40 const static uint32 kInvalidSessionId = 0; | 40 const static uint32 kInvalidSessionId = 0; |
41 const static int kInvalidCdmId = -1; | |
41 | 42 |
42 MediaKeys(); | 43 MediaKeys(); |
43 virtual ~MediaKeys(); | 44 virtual ~MediaKeys(); |
44 | 45 |
45 // Creates a session with the |content_type| and |init_data| provided. | 46 // Creates a session with the |content_type| and |init_data| provided. |
46 // Returns true if a session is successfully created, false otherwise. | 47 // Returns true if a session is successfully created, false otherwise. |
47 // Note: UpdateSession() and ReleaseSession() should only be called after | 48 // Note: UpdateSession() and ReleaseSession() should only be called after |
48 // SessionCreatedCB is fired. | 49 // SessionCreatedCB is fired. |
49 // TODO(jrummell): Remove return value when prefixed API is removed. | 50 // TODO(jrummell): Remove return value when prefixed API is removed. |
50 // See http://crbug.com/342510 | 51 // See http://crbug.com/342510 |
(...skipping 14 matching lines...) Expand all Loading... | |
65 int response_length) = 0; | 66 int response_length) = 0; |
66 | 67 |
67 // Releases the session specified by |session_id|. | 68 // Releases the session specified by |session_id|. |
68 virtual void ReleaseSession(uint32 session_id) = 0; | 69 virtual void ReleaseSession(uint32 session_id) = 0; |
69 | 70 |
70 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if | 71 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if |
71 // no Decryptor object is associated. The returned object is only guaranteed | 72 // no Decryptor object is associated. The returned object is only guaranteed |
72 // to be valid during the MediaKeys' lifetime. | 73 // to be valid during the MediaKeys' lifetime. |
73 virtual Decryptor* GetDecryptor(); | 74 virtual Decryptor* GetDecryptor(); |
74 | 75 |
76 // Gets the CDM ID associated with the MediaKeys. Returns kInvalidCdmId if no | |
77 // CDM ID is associated. | |
78 virtual int GetCdmId(); | |
ddorwin
2014/03/11 04:06:33
Too bad this has to be on the main interface. :(
ddorwin
2014/03/11 18:05:14
As discussed, I think we can avoid this.
xhwang
2014/03/12 01:07:52
Removed.
| |
79 | |
75 private: | 80 private: |
76 DISALLOW_COPY_AND_ASSIGN(MediaKeys); | 81 DISALLOW_COPY_AND_ASSIGN(MediaKeys); |
77 }; | 82 }; |
78 | 83 |
79 // Key event callbacks. See the spec for details: | 84 // Key event callbacks. See the spec for details: |
80 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary | 85 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary |
81 typedef base::Callback< | 86 typedef base::Callback< |
82 void(uint32 session_id, const std::string& web_session_id)> | 87 void(uint32 session_id, const std::string& web_session_id)> |
83 SessionCreatedCB; | 88 SessionCreatedCB; |
84 | 89 |
85 typedef base::Callback<void(uint32 session_id, | 90 typedef base::Callback<void(uint32 session_id, |
86 const std::vector<uint8>& message, | 91 const std::vector<uint8>& message, |
87 const std::string& destination_url)> | 92 const std::string& destination_url)> |
88 SessionMessageCB; | 93 SessionMessageCB; |
89 | 94 |
90 typedef base::Callback<void(uint32 session_id)> SessionReadyCB; | 95 typedef base::Callback<void(uint32 session_id)> SessionReadyCB; |
91 | 96 |
92 typedef base::Callback<void(uint32 session_id)> SessionClosedCB; | 97 typedef base::Callback<void(uint32 session_id)> SessionClosedCB; |
93 | 98 |
94 typedef base::Callback<void(uint32 session_id, | 99 typedef base::Callback<void(uint32 session_id, |
95 media::MediaKeys::KeyError error_code, | 100 media::MediaKeys::KeyError error_code, |
96 uint32 system_code)> SessionErrorCB; | 101 uint32 system_code)> SessionErrorCB; |
97 | 102 |
98 } // namespace media | 103 } // namespace media |
99 | 104 |
100 #endif // MEDIA_BASE_MEDIA_KEYS_H_ | 105 #endif // MEDIA_BASE_MEDIA_KEYS_H_ |
OLD | NEW |