| 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 RendererCdmManager; |
| 16 | 16 |
| 17 // A MediaKeys proxy that wraps the EME part of RendererMediaPlayerManager. | 17 // A MediaKeys proxy that wraps the EME part of RendererCdmManager. |
| 18 // TODO(xhwang): Instead of accessing RendererMediaPlayerManager directly, let | 18 // TODO(xhwang): Instead of accessing RendererCdmManager directly, let |
| 19 // RendererMediaPlayerManager return a MediaKeys object that can be used by | 19 // RendererCdmManager 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 static scoped_ptr<ProxyMediaKeys> Create( | 23 static scoped_ptr<ProxyMediaKeys> Create( |
| 24 const std::string& key_system, | 24 const std::string& key_system, |
| 25 const GURL& security_origin, | 25 const GURL& security_origin, |
| 26 RendererMediaPlayerManager* manager, | 26 RendererCdmManager* manager, |
| 27 const media::SessionCreatedCB& session_created_cb, | 27 const media::SessionCreatedCB& session_created_cb, |
| 28 const media::SessionMessageCB& session_message_cb, | 28 const media::SessionMessageCB& session_message_cb, |
| 29 const media::SessionReadyCB& session_ready_cb, | 29 const media::SessionReadyCB& session_ready_cb, |
| 30 const media::SessionClosedCB& session_closed_cb, | 30 const media::SessionClosedCB& session_closed_cb, |
| 31 const media::SessionErrorCB& session_error_cb); | 31 const media::SessionErrorCB& session_error_cb); |
| 32 | 32 |
| 33 virtual ~ProxyMediaKeys(); | 33 virtual ~ProxyMediaKeys(); |
| 34 | 34 |
| 35 // MediaKeys implementation. | 35 // MediaKeys implementation. |
| 36 virtual bool CreateSession(uint32 session_id, | 36 virtual bool CreateSession(uint32 session_id, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 51 const std::string& destination_url); | 51 const std::string& destination_url); |
| 52 void OnSessionReady(uint32 session_id); | 52 void OnSessionReady(uint32 session_id); |
| 53 void OnSessionClosed(uint32 session_id); | 53 void OnSessionClosed(uint32 session_id); |
| 54 void OnSessionError(uint32 session_id, | 54 void OnSessionError(uint32 session_id, |
| 55 media::MediaKeys::KeyError error_code, | 55 media::MediaKeys::KeyError error_code, |
| 56 uint32 system_code); | 56 uint32 system_code); |
| 57 | 57 |
| 58 int GetCdmId() const; | 58 int GetCdmId() const; |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 ProxyMediaKeys(RendererMediaPlayerManager* manager, | 61 ProxyMediaKeys(RendererCdmManager* manager, |
| 62 const media::SessionCreatedCB& session_created_cb, | 62 const media::SessionCreatedCB& session_created_cb, |
| 63 const media::SessionMessageCB& session_message_cb, | 63 const media::SessionMessageCB& session_message_cb, |
| 64 const media::SessionReadyCB& session_ready_cb, | 64 const media::SessionReadyCB& session_ready_cb, |
| 65 const media::SessionClosedCB& session_closed_cb, | 65 const media::SessionClosedCB& session_closed_cb, |
| 66 const media::SessionErrorCB& session_error_cb); | 66 const media::SessionErrorCB& session_error_cb); |
| 67 | 67 |
| 68 void InitializeCdm(const std::string& key_system, | 68 void InitializeCdm(const std::string& key_system, |
| 69 const GURL& security_origin); | 69 const GURL& security_origin); |
| 70 | 70 |
| 71 // CDM ID should be unique per renderer process. | 71 // CDM ID should be unique per renderer process. |
| 72 // TODO(xhwang): Use uint32 to prevent undefined overflow behavior. | 72 // TODO(xhwang): Use uint32 to prevent undefined overflow behavior. |
| 73 static int next_cdm_id_; | 73 static int next_cdm_id_; |
| 74 | 74 |
| 75 RendererMediaPlayerManager* manager_; | 75 RendererCdmManager* manager_; |
| 76 int cdm_id_; | 76 int cdm_id_; |
| 77 media::SessionCreatedCB session_created_cb_; | 77 media::SessionCreatedCB session_created_cb_; |
| 78 media::SessionMessageCB session_message_cb_; | 78 media::SessionMessageCB session_message_cb_; |
| 79 media::SessionReadyCB session_ready_cb_; | 79 media::SessionReadyCB session_ready_cb_; |
| 80 media::SessionClosedCB session_closed_cb_; | 80 media::SessionClosedCB session_closed_cb_; |
| 81 media::SessionErrorCB session_error_cb_; | 81 media::SessionErrorCB session_error_cb_; |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(ProxyMediaKeys); | 83 DISALLOW_COPY_AND_ASSIGN(ProxyMediaKeys); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace content | 86 } // namespace content |
| 87 | 87 |
| 88 #endif // CONTENT_RENDERER_MEDIA_ANDROID_PROXY_MEDIA_KEYS_H_ | 88 #endif // CONTENT_RENDERER_MEDIA_ANDROID_PROXY_MEDIA_KEYS_H_ |
| OLD | NEW |