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 19 matching lines...) Expand all Loading... | |
30 kUnknownError = 1, | 30 kUnknownError = 1, |
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 kInvalidReferenceId = 0; | 40 const static uint32 kInvalidReferenceId = 0; |
xhwang
2013/12/05 18:51:37
update
jrummell
2013/12/06 23:42:35
Done.
| |
41 | 41 |
42 MediaKeys(); | 42 MediaKeys(); |
43 virtual ~MediaKeys(); | 43 virtual ~MediaKeys(); |
44 | 44 |
45 // Generates a key request with the |type| and |init_data| provided. | 45 // Generates a key request with the |type| and |init_data| provided. |
46 // Returns true if generating key request succeeded, false otherwise. | 46 // Returns true if generating key request succeeded, false otherwise. |
47 // Note: UpdateSession() and ReleaseSession() should only be called after | 47 // Note: UpdateSession() and ReleaseSession() should only be called after |
48 // CreateSession() returns true. | 48 // CreateSession() returns true. |
49 // TODO(jrummell): Remove return value when prefixed API is removed. | 49 // TODO(jrummell): Remove return value when prefixed API is removed. |
50 virtual bool CreateSession(uint32 reference_id, | 50 virtual bool CreateSession(uint32 session_id, |
51 const std::string& type, | 51 const std::string& type, |
52 const uint8* init_data, | 52 const uint8* init_data, |
53 int init_data_length) = 0; | 53 int init_data_length) = 0; |
54 | 54 |
55 // Updates a session specified by |reference_id| with |response|. | 55 // Updates a session specified by |session_id| with |response|. |
56 virtual void UpdateSession(uint32 reference_id, | 56 virtual void UpdateSession(uint32 session_id, |
57 const uint8* response, | 57 const uint8* response, |
58 int response_length) = 0; | 58 int response_length) = 0; |
59 | 59 |
60 // Releases the session specified by |reference_id|. | 60 // Releases the session specified by |session_id|. |
61 virtual void ReleaseSession(uint32 reference_id) = 0; | 61 virtual void ReleaseSession(uint32 session_id) = 0; |
62 | 62 |
63 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if | 63 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if |
64 // no Decryptor object is associated. The returned object is only guaranteed | 64 // no Decryptor object is associated. The returned object is only guaranteed |
65 // to be valid during the MediaKeys' lifetime. | 65 // to be valid during the MediaKeys' lifetime. |
66 virtual Decryptor* GetDecryptor(); | 66 virtual Decryptor* GetDecryptor(); |
67 | 67 |
68 private: | 68 private: |
69 DISALLOW_COPY_AND_ASSIGN(MediaKeys); | 69 DISALLOW_COPY_AND_ASSIGN(MediaKeys); |
70 }; | 70 }; |
71 | 71 |
72 // Key event callbacks. See the spec for details: | 72 // Key event callbacks. See the spec for details: |
73 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary | 73 // https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted- media.html#event-summary |
74 typedef base::Callback<void(uint32 reference_id, const std::string& session_id)> | 74 typedef base::Callback< |
75 void(uint32 session_id, const std::string& web_session_id)> | |
75 SessionCreatedCB; | 76 SessionCreatedCB; |
76 | 77 |
77 typedef base::Callback<void(uint32 reference_id, | 78 typedef base::Callback<void(uint32 session_id, |
78 const std::vector<uint8>& message, | 79 const std::vector<uint8>& message, |
79 const std::string& destination_url)> | 80 const std::string& destination_url)> |
80 SessionMessageCB; | 81 SessionMessageCB; |
81 | 82 |
82 typedef base::Callback<void(uint32 reference_id)> SessionReadyCB; | 83 typedef base::Callback<void(uint32 session_id)> SessionReadyCB; |
83 | 84 |
84 typedef base::Callback<void(uint32 reference_id)> SessionClosedCB; | 85 typedef base::Callback<void(uint32 session_id)> SessionClosedCB; |
85 | 86 |
86 typedef base::Callback<void(uint32 reference_id, | 87 typedef base::Callback<void(uint32 session_id, |
87 media::MediaKeys::KeyError error_code, | 88 media::MediaKeys::KeyError error_code, |
88 int system_code)> SessionErrorCB; | 89 int system_code)> SessionErrorCB; |
89 | 90 |
90 } // namespace media | 91 } // namespace media |
91 | 92 |
92 #endif // MEDIA_BASE_MEDIA_KEYS_H_ | 93 #endif // MEDIA_BASE_MEDIA_KEYS_H_ |
OLD | NEW |