Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_RENDERER_CDM_MANAGER_H_ | |
| 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_RENDERER_CDM_MANAGER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/basictypes.h" | |
| 13 #include "content/common/media/cdm_messages_enums.h" | |
| 14 #include "content/public/renderer/render_frame_observer.h" | |
| 15 #include "media/base/media_keys.h" | |
| 16 #include "url/gurl.h" | |
| 17 | |
| 18 namespace blink { | |
| 19 class WebFrame; | |
| 20 } | |
| 21 | |
| 22 namespace content { | |
| 23 | |
| 24 class ProxyMediaKeys; | |
| 25 | |
| 26 // Class for managing all the WebMediaPlayerAndroid objects in the same | |
|
damienv1
2014/05/28 13:26:03
Comment should be updated.
xhwang
2014/05/28 21:17:09
Done.
| |
| 27 // RenderView. | |
| 28 class RendererCdmManager : public RenderFrameObserver { | |
| 29 public: | |
| 30 static const int kInvalidCdmId = 0; | |
| 31 | |
| 32 // Constructs a RendererCdmManager object for the |render_frame|. | |
| 33 explicit RendererCdmManager(RenderFrame* render_frame); | |
| 34 virtual ~RendererCdmManager(); | |
| 35 | |
| 36 // RenderFrameObserver overrides. | |
| 37 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | |
| 38 | |
| 39 // Encrypted media related methods. | |
| 40 void InitializeCdm(int cdm_id, | |
| 41 ProxyMediaKeys* media_keys, | |
| 42 const std::string& key_system, | |
| 43 const GURL& security_origin); | |
| 44 void CreateSession(int cdm_id, | |
| 45 uint32 session_id, | |
| 46 CdmHostMsg_CreateSession_ContentType conent_type, | |
| 47 const std::vector<uint8>& init_data); | |
| 48 void UpdateSession(int cdm_id, | |
| 49 uint32 session_id, | |
| 50 const std::vector<uint8>& response); | |
| 51 void ReleaseSession(int cdm_id, uint32 session_id); | |
| 52 void DestroyCdm(int cdm_id); | |
| 53 | |
| 54 // Registers a ProxyMediaKeys object. There must be a WebMediaPlayerAndroid | |
|
damienv1
2014/05/28 13:26:03
Comment should be updated.
xhwang
2014/05/28 21:17:09
Done.
| |
| 55 // object already registered for this id, and it is unregistered when the | |
| 56 // player is unregistered. For now |cdm_id| is the same as player_id | |
| 57 // used in other methods. | |
| 58 void RegisterMediaKeys(int cdm_id, ProxyMediaKeys* media_keys); | |
| 59 | |
| 60 // Gets the pointer to ProxyMediaKeys given the |cdm_id|. | |
| 61 ProxyMediaKeys* GetMediaKeys(int cdm_id); | |
| 62 | |
| 63 private: | |
| 64 // Message handlers. | |
| 65 void OnSessionCreated(int cdm_id, | |
| 66 uint32 session_id, | |
| 67 const std::string& web_session_id); | |
| 68 void OnSessionMessage(int cdm_id, | |
| 69 uint32 session_id, | |
| 70 const std::vector<uint8>& message, | |
| 71 const GURL& destination_url); | |
| 72 void OnSessionReady(int cdm_id, uint32 session_id); | |
| 73 void OnSessionClosed(int cdm_id, uint32 session_id); | |
| 74 void OnSessionError(int cdm_id, | |
| 75 uint32 session_id, | |
| 76 media::MediaKeys::KeyError error_code, | |
| 77 uint32 system_code); | |
| 78 | |
| 79 // Info for all available ProxyMediaKeys. There must be at most one | |
| 80 // ProxyMediaKeys for each available WebMediaPlayerAndroid. | |
|
damienv1
2014/05/28 14:16:06
ditto.
xhwang
2014/05/28 21:17:09
Done.
| |
| 81 std::map<int, ProxyMediaKeys*> proxy_media_keys_map_; | |
| 82 | |
| 83 DISALLOW_COPY_AND_ASSIGN(RendererCdmManager); | |
| 84 }; | |
| 85 | |
| 86 } // namespace content | |
| 87 | |
| 88 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_RENDERER_CDM_MANAGER_H_ | |
| OLD | NEW |