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_RENDERER_CDM_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_RENDERER_CDM_MANAGER_H_ |
6 #define CONTENT_RENDERER_MEDIA_CRYPTO_RENDERER_CDM_MANAGER_H_ | 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_RENDERER_CDM_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 20 matching lines...) Expand all Loading... |
31 ~RendererCdmManager() override; | 31 ~RendererCdmManager() override; |
32 | 32 |
33 // RenderFrameObserver overrides. | 33 // RenderFrameObserver overrides. |
34 bool OnMessageReceived(const IPC::Message& msg) override; | 34 bool OnMessageReceived(const IPC::Message& msg) override; |
35 | 35 |
36 // Encrypted media related methods. | 36 // Encrypted media related methods. |
37 void InitializeCdm(int cdm_id, | 37 void InitializeCdm(int cdm_id, |
38 ProxyMediaKeys* media_keys, | 38 ProxyMediaKeys* media_keys, |
39 const std::string& key_system, | 39 const std::string& key_system, |
40 const GURL& security_origin); | 40 const GURL& security_origin); |
41 void CreateSession(int cdm_id, | 41 void SetServerCertificate(int cdm_id, |
42 uint32 session_id, | 42 uint32_t promise_id, |
43 CdmHostMsg_CreateSession_ContentType conent_type, | 43 const std::vector<uint8>& certificate); |
44 const std::vector<uint8>& init_data); | 44 void CreateSessionAndGenerateRequest( |
| 45 int cdm_id, |
| 46 uint32_t promise_id, |
| 47 CdmHostMsg_CreateSession_InitDataType init_data_type, |
| 48 const std::vector<uint8>& init_data); |
45 void UpdateSession(int cdm_id, | 49 void UpdateSession(int cdm_id, |
46 uint32 session_id, | 50 uint32_t promise_id, |
| 51 const std::string& session_id, |
47 const std::vector<uint8>& response); | 52 const std::vector<uint8>& response); |
48 void ReleaseSession(int cdm_id, uint32 session_id); | 53 void CloseSession(int cdm_id, |
| 54 uint32_t promise_id, |
| 55 const std::string& session_id); |
49 void DestroyCdm(int cdm_id); | 56 void DestroyCdm(int cdm_id); |
50 | 57 |
51 // Registers a ProxyMediaKeys object. Returns allocated CDM ID. | 58 // Registers a ProxyMediaKeys object. Returns allocated CDM ID. |
52 int RegisterMediaKeys(ProxyMediaKeys* media_keys); | 59 int RegisterMediaKeys(ProxyMediaKeys* media_keys); |
53 | 60 |
54 // Unregisters a ProxyMediaKeys object identified by |cdm_id|. | 61 // Unregisters a ProxyMediaKeys object identified by |cdm_id|. |
55 void UnregisterMediaKeys(int cdm_id); | 62 void UnregisterMediaKeys(int cdm_id); |
56 | 63 |
57 private: | 64 private: |
58 // Gets the pointer to ProxyMediaKeys given the |cdm_id|. | 65 // Gets the pointer to ProxyMediaKeys given the |cdm_id|. |
59 ProxyMediaKeys* GetMediaKeys(int cdm_id); | 66 ProxyMediaKeys* GetMediaKeys(int cdm_id); |
60 | 67 |
61 // Message handlers. | 68 // Message handlers. |
62 void OnSessionCreated(int cdm_id, | |
63 uint32 session_id, | |
64 const std::string& web_session_id); | |
65 void OnSessionMessage(int cdm_id, | 69 void OnSessionMessage(int cdm_id, |
66 uint32 session_id, | 70 const std::string& session_id, |
67 const std::vector<uint8>& message, | 71 const std::vector<uint8>& message, |
68 const GURL& destination_url); | 72 const GURL& destination_url); |
69 void OnSessionReady(int cdm_id, uint32 session_id); | 73 void OnSessionClosed(int cdm_id, const std::string& session_id); |
70 void OnSessionClosed(int cdm_id, uint32 session_id); | |
71 void OnSessionError(int cdm_id, | 74 void OnSessionError(int cdm_id, |
72 uint32 session_id, | 75 const std::string& session_id, |
73 media::MediaKeys::KeyError error_code, | 76 media::MediaKeys::Exception exception, |
74 uint32 system_code); | 77 uint32 system_code, |
| 78 const std::string& error_message); |
| 79 void OnSessionKeysChange( |
| 80 int cdm_id, |
| 81 const std::string& session_id, |
| 82 bool has_additional_usable_key, |
| 83 const std::vector<media::CdmKeyInformation>& key_info_vector); |
| 84 void OnSessionExpirationUpdate(int cdm_id, |
| 85 const std::string& session_id, |
| 86 const base::Time& new_expiry_time); |
| 87 |
| 88 void OnPromiseResolved(int cdm_id, uint32_t promise_id); |
| 89 void OnPromiseResolvedWithSession(int cdm_id, |
| 90 uint32_t promise_id, |
| 91 const std::string& session_id); |
| 92 void OnPromiseRejected(int cdm_id, |
| 93 uint32_t promise_id, |
| 94 media::MediaKeys::Exception exception, |
| 95 uint32_t system_code, |
| 96 const std::string& error_message); |
75 | 97 |
76 // CDM ID should be unique per renderer frame. | 98 // CDM ID should be unique per renderer frame. |
77 // TODO(xhwang): Use uint32 to prevent undefined overflow behavior. | 99 // TODO(xhwang): Use uint32 to prevent undefined overflow behavior. |
78 int next_cdm_id_; | 100 int next_cdm_id_; |
79 | 101 |
80 // CDM ID to ProxyMediaKeys mapping. | 102 // CDM ID to ProxyMediaKeys mapping. |
81 std::map<int, ProxyMediaKeys*> proxy_media_keys_map_; | 103 std::map<int, ProxyMediaKeys*> proxy_media_keys_map_; |
82 | 104 |
83 DISALLOW_COPY_AND_ASSIGN(RendererCdmManager); | 105 DISALLOW_COPY_AND_ASSIGN(RendererCdmManager); |
84 }; | 106 }; |
85 | 107 |
86 } // namespace content | 108 } // namespace content |
87 | 109 |
88 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_RENDERER_CDM_MANAGER_H_ | 110 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_RENDERER_CDM_MANAGER_H_ |
OLD | NEW |