Chromium Code Reviews| Index: content/renderer/media/android/renderer_cdm_manager.h |
| diff --git a/content/renderer/media/android/renderer_cdm_manager.h b/content/renderer/media/android/renderer_cdm_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ed51384b84d4171d092cfa784f6ace479803bf43 |
| --- /dev/null |
| +++ b/content/renderer/media/android/renderer_cdm_manager.h |
| @@ -0,0 +1,88 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_RENDERER_MEDIA_ANDROID_RENDERER_CDM_MANAGER_H_ |
|
damienv1
2014/05/27 04:53:09
Shouldn't it be part of content/renderer/media/cry
xhwang
2014/05/27 22:57:41
Done.
|
| +#define CONTENT_RENDERER_MEDIA_ANDROID_RENDERER_CDM_MANAGER_H_ |
| + |
| +#include <map> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/basictypes.h" |
| +#include "content/common/media/cdm_messages_enums.h" |
| +#include "content/public/renderer/render_frame_observer.h" |
| +#include "media/base/media_keys.h" |
| +#include "url/gurl.h" |
| + |
| +namespace blink { |
| +class WebFrame; |
| +} |
| + |
| +namespace content { |
| + |
| +class ProxyMediaKeys; |
| + |
| +// Class for managing all the WebMediaPlayerAndroid objects in the same |
| +// RenderView. |
| +class RendererCdmManager : public RenderFrameObserver { |
| + public: |
| + static const int kInvalidCdmId = 0; |
| + |
| + // Constructs a RendererCdmManager object for the |render_frame|. |
| + explicit RendererCdmManager(RenderFrame* render_frame); |
| + virtual ~RendererCdmManager(); |
| + |
| + // RenderFrameObserver overrides. |
| + virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| + |
| + // Encrypted media related methods. |
| + void InitializeCdm(int cdm_id, |
| + ProxyMediaKeys* media_keys, |
| + const std::string& key_system, |
| + const GURL& security_origin); |
| + void CreateSession(int cdm_id, |
| + uint32 session_id, |
| + CdmHostMsg_CreateSession_ContentType conent_type, |
| + const std::vector<uint8>& init_data); |
| + void UpdateSession(int cdm_id, |
| + uint32 session_id, |
| + const std::vector<uint8>& response); |
| + void ReleaseSession(int cdm_id, uint32 session_id); |
| + void DestroyCdm(int cdm_id); |
| + |
| + // Registers a ProxyMediaKeys object. There must be a WebMediaPlayerAndroid |
| + // object already registered for this id, and it is unregistered when the |
| + // player is unregistered. For now |cdm_id| is the same as player_id |
| + // used in other methods. |
| + void RegisterMediaKeys(int cdm_id, ProxyMediaKeys* media_keys); |
| + |
| + // Gets the pointer to ProxyMediaKeys given the |cdm_id|. |
| + ProxyMediaKeys* GetMediaKeys(int cdm_id); |
| + |
| + private: |
| + // Message handlers. |
| + void OnSessionCreated(int cdm_id, |
| + uint32 session_id, |
| + const std::string& web_session_id); |
| + void OnSessionMessage(int cdm_id, |
| + uint32 session_id, |
| + const std::vector<uint8>& message, |
| + const GURL& destination_url); |
| + void OnSessionReady(int cdm_id, uint32 session_id); |
| + void OnSessionClosed(int cdm_id, uint32 session_id); |
| + void OnSessionError(int cdm_id, |
| + uint32 session_id, |
| + media::MediaKeys::KeyError error_code, |
| + uint32 system_code); |
| + |
| + // Info for all available ProxyMediaKeys. There must be at most one |
| + // ProxyMediaKeys for each available WebMediaPlayerAndroid. |
| + std::map<int, ProxyMediaKeys*> media_keys_; |
|
ddorwin
2014/05/23 23:28:37
In a future CL, it'd be nice to rename this. When
xhwang
2014/05/27 22:57:41
Yeah, this is bad naming. Done in this CL.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(RendererCdmManager); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_MEDIA_ANDROID_RENDERER_CDM_MANAGER_H_ |