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 CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_MEDIA_KEYS_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_MEDIA_KEYS_H_ |
6 #define CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_MEDIA_KEYS_H_ | 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_MEDIA_KEYS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 scoped_ptr<media::SimpleCdmPromise> promise) override; | 57 scoped_ptr<media::SimpleCdmPromise> promise) override; |
58 virtual void CloseSession( | 58 virtual void CloseSession( |
59 const std::string& web_session_id, | 59 const std::string& web_session_id, |
60 scoped_ptr<media::SimpleCdmPromise> promise) override; | 60 scoped_ptr<media::SimpleCdmPromise> promise) override; |
61 virtual void RemoveSession( | 61 virtual void RemoveSession( |
62 const std::string& web_session_id, | 62 const std::string& web_session_id, |
63 scoped_ptr<media::SimpleCdmPromise> promise) override; | 63 scoped_ptr<media::SimpleCdmPromise> promise) override; |
64 virtual void GetUsableKeyIds( | 64 virtual void GetUsableKeyIds( |
65 const std::string& web_session_id, | 65 const std::string& web_session_id, |
66 scoped_ptr<media::KeyIdsPromise> promise) override; | 66 scoped_ptr<media::KeyIdsPromise> promise) override; |
| 67 virtual int GetCdmId() const override; |
67 | 68 |
68 // Callbacks. | 69 // Callbacks. |
69 void OnSessionCreated(uint32 session_id, const std::string& web_session_id); | 70 void OnSessionCreated(uint32 session_id, const std::string& web_session_id); |
70 void OnSessionMessage(uint32 session_id, | 71 void OnSessionMessage(uint32 session_id, |
71 const std::vector<uint8>& message, | 72 const std::vector<uint8>& message, |
72 const GURL& destination_url); | 73 const GURL& destination_url); |
73 void OnSessionReady(uint32 session_id); | 74 void OnSessionReady(uint32 session_id); |
74 void OnSessionClosed(uint32 session_id); | 75 void OnSessionClosed(uint32 session_id); |
75 void OnSessionError(uint32 session_id, | 76 void OnSessionError(uint32 session_id, |
76 media::MediaKeys::KeyError error_code, | 77 media::MediaKeys::KeyError error_code, |
77 uint32 system_code); | 78 uint32 system_code); |
78 | 79 |
79 int GetCdmId() const; | |
80 | |
81 private: | 80 private: |
82 // The Android-specific code that handles sessions uses integer session ids | 81 // The Android-specific code that handles sessions uses integer session ids |
83 // (basically a reference id), but media::MediaKeys bases everything on | 82 // (basically a reference id), but media::MediaKeys bases everything on |
84 // web_session_id (a string representing the actual session id as generated | 83 // web_session_id (a string representing the actual session id as generated |
85 // by the CDM). SessionIdMap is used to map between the web_session_id and | 84 // by the CDM). SessionIdMap is used to map between the web_session_id and |
86 // the session_id used by the Android-specific code. | 85 // the session_id used by the Android-specific code. |
87 typedef base::hash_map<std::string, uint32_t> SessionIdMap; | 86 typedef base::hash_map<std::string, uint32_t> SessionIdMap; |
88 | 87 |
89 // The following types keep track of Promises. The index is the | 88 // The following types keep track of Promises. The index is the |
90 // Android-specific session_id, so that returning results can be matched to | 89 // Android-specific session_id, so that returning results can be matched to |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 129 |
131 // Keep track of outstanding promises. This map owns the promise object. | 130 // Keep track of outstanding promises. This map owns the promise object. |
132 PromiseMap session_id_to_promise_map_; | 131 PromiseMap session_id_to_promise_map_; |
133 | 132 |
134 DISALLOW_COPY_AND_ASSIGN(ProxyMediaKeys); | 133 DISALLOW_COPY_AND_ASSIGN(ProxyMediaKeys); |
135 }; | 134 }; |
136 | 135 |
137 } // namespace content | 136 } // namespace content |
138 | 137 |
139 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_MEDIA_KEYS_H_ | 138 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_MEDIA_KEYS_H_ |
OLD | NEW |