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 CONTENT_RENDERER_MEDIA_ANDROID_PROXY_MEDIA_KEYS_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_PROXY_MEDIA_KEYS_H_ |
6 #define CONTENT_RENDERER_MEDIA_ANDROID_PROXY_MEDIA_KEYS_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_PROXY_MEDIA_KEYS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "media/base/media_keys.h" | 9 #include "media/base/media_keys.h" |
10 | 10 |
11 class GURL; | 11 class GURL; |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 class RendererMediaPlayerManager; | 15 class RendererMediaPlayerManager; |
16 | 16 |
17 // A MediaKeys proxy that wraps the EME part of RendererMediaPlayerManager. | 17 // A MediaKeys proxy that wraps the EME part of RendererMediaPlayerManager. |
18 // TODO(xhwang): Instead of accessing RendererMediaPlayerManager directly, let | 18 // TODO(xhwang): Instead of accessing RendererMediaPlayerManager directly, let |
19 // RendererMediaPlayerManager return a MediaKeys object that can be used by | 19 // RendererMediaPlayerManager return a MediaKeys object that can be used by |
20 // ProxyDecryptor directly. Then we can remove this class! | 20 // ProxyDecryptor directly. Then we can remove this class! |
21 class ProxyMediaKeys : public media::MediaKeys { | 21 class ProxyMediaKeys : public media::MediaKeys { |
22 public: | 22 public: |
23 ProxyMediaKeys(RendererMediaPlayerManager* proxy, | 23 ProxyMediaKeys(RendererMediaPlayerManager* proxy, |
24 int cdm_id, | |
25 const media::SessionCreatedCB& session_created_cb, | 24 const media::SessionCreatedCB& session_created_cb, |
26 const media::SessionMessageCB& session_message_cb, | 25 const media::SessionMessageCB& session_message_cb, |
27 const media::SessionReadyCB& session_ready_cb, | 26 const media::SessionReadyCB& session_ready_cb, |
28 const media::SessionClosedCB& session_closed_cb, | 27 const media::SessionClosedCB& session_closed_cb, |
29 const media::SessionErrorCB& session_error_cb); | 28 const media::SessionErrorCB& session_error_cb); |
30 virtual ~ProxyMediaKeys(); | 29 virtual ~ProxyMediaKeys(); |
31 | 30 |
32 void InitializeCdm(const std::string& key_system, const GURL& frame_url); | 31 void InitializeCdm(const std::string& key_system, const GURL& frame_url); |
33 | 32 |
34 // MediaKeys implementation. | 33 // MediaKeys implementation. |
(...skipping 12 matching lines...) Expand all Loading... |
47 void OnSessionCreated(uint32 session_id, const std::string& web_session_id); | 46 void OnSessionCreated(uint32 session_id, const std::string& web_session_id); |
48 void OnSessionMessage(uint32 session_id, | 47 void OnSessionMessage(uint32 session_id, |
49 const std::vector<uint8>& message, | 48 const std::vector<uint8>& message, |
50 const std::string& destination_url); | 49 const std::string& destination_url); |
51 void OnSessionReady(uint32 session_id); | 50 void OnSessionReady(uint32 session_id); |
52 void OnSessionClosed(uint32 session_id); | 51 void OnSessionClosed(uint32 session_id); |
53 void OnSessionError(uint32 session_id, | 52 void OnSessionError(uint32 session_id, |
54 media::MediaKeys::KeyError error_code, | 53 media::MediaKeys::KeyError error_code, |
55 uint32 system_code); | 54 uint32 system_code); |
56 | 55 |
| 56 int GetCdmId() const; |
| 57 |
57 private: | 58 private: |
| 59 // CDM ID should be unique per renderer process. |
| 60 // TODO(xhwang): Use uint32 to prevent undefined overflow behavior. |
| 61 static int next_cdm_id_; |
| 62 |
58 RendererMediaPlayerManager* manager_; | 63 RendererMediaPlayerManager* manager_; |
59 int cdm_id_; | 64 int cdm_id_; |
60 media::SessionCreatedCB session_created_cb_; | 65 media::SessionCreatedCB session_created_cb_; |
61 media::SessionMessageCB session_message_cb_; | 66 media::SessionMessageCB session_message_cb_; |
62 media::SessionReadyCB session_ready_cb_; | 67 media::SessionReadyCB session_ready_cb_; |
63 media::SessionClosedCB session_closed_cb_; | 68 media::SessionClosedCB session_closed_cb_; |
64 media::SessionErrorCB session_error_cb_; | 69 media::SessionErrorCB session_error_cb_; |
65 | 70 |
66 DISALLOW_COPY_AND_ASSIGN(ProxyMediaKeys); | 71 DISALLOW_COPY_AND_ASSIGN(ProxyMediaKeys); |
67 }; | 72 }; |
68 | 73 |
69 } // namespace content | 74 } // namespace content |
70 | 75 |
71 #endif // CONTENT_RENDERER_MEDIA_ANDROID_PROXY_MEDIA_KEYS_H_ | 76 #endif // CONTENT_RENDERER_MEDIA_ANDROID_PROXY_MEDIA_KEYS_H_ |
OLD | NEW |