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 24 matching lines...) Expand all Loading... |
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 | 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 // Creates a session with the |content_type| and |init_data| provided. |
46 // Returns true if generating key request succeeded, false otherwise. | 46 // Returns true if a session is successfully created, 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 // SessionCreatedCB is fired. |
49 // TODO(jrummell): Remove return value when prefixed API is removed. | 49 // TODO(jrummell): Remove return value when prefixed API is removed. |
| 50 // See http://crbug.com/342510 |
50 virtual bool CreateSession(uint32 session_id, | 51 virtual bool CreateSession(uint32 session_id, |
51 const std::string& type, | 52 const std::string& content_type, |
52 const uint8* init_data, | 53 const uint8* init_data, |
53 int init_data_length) = 0; | 54 int init_data_length) = 0; |
54 | 55 |
| 56 // Loads a session with the |web_session_id| provided. |
| 57 // Note: UpdateSession() and ReleaseSession() should only be called after |
| 58 // SessionCreatedCB is fired. |
| 59 virtual void LoadSession(uint32 session_id, |
| 60 const std::string& web_session_id) = 0; |
| 61 |
55 // Updates a session specified by |session_id| with |response|. | 62 // Updates a session specified by |session_id| with |response|. |
56 virtual void UpdateSession(uint32 session_id, | 63 virtual void UpdateSession(uint32 session_id, |
57 const uint8* response, | 64 const uint8* response, |
58 int response_length) = 0; | 65 int response_length) = 0; |
59 | 66 |
60 // Releases the session specified by |session_id|. | 67 // Releases the session specified by |session_id|. |
61 virtual void ReleaseSession(uint32 session_id) = 0; | 68 virtual void ReleaseSession(uint32 session_id) = 0; |
62 | 69 |
63 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if | 70 // Gets the Decryptor object associated with the MediaKeys. Returns NULL if |
64 // no Decryptor object is associated. The returned object is only guaranteed | 71 // no Decryptor object is associated. The returned object is only guaranteed |
(...skipping 19 matching lines...) Expand all Loading... |
84 | 91 |
85 typedef base::Callback<void(uint32 session_id)> SessionClosedCB; | 92 typedef base::Callback<void(uint32 session_id)> SessionClosedCB; |
86 | 93 |
87 typedef base::Callback<void(uint32 session_id, | 94 typedef base::Callback<void(uint32 session_id, |
88 media::MediaKeys::KeyError error_code, | 95 media::MediaKeys::KeyError error_code, |
89 int system_code)> SessionErrorCB; | 96 int system_code)> SessionErrorCB; |
90 | 97 |
91 } // namespace media | 98 } // namespace media |
92 | 99 |
93 #endif // MEDIA_BASE_MEDIA_KEYS_H_ | 100 #endif // MEDIA_BASE_MEDIA_KEYS_H_ |
OLD | NEW |