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_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ |
6 #define CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ | 6 #define CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/containers/scoped_ptr_hash_map.h" | 14 #include "base/containers/scoped_ptr_hash_map.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 #include "content/common/media/cdm_messages.h" | |
19 #include "content/common/media/cdm_messages_enums.h" | 18 #include "content/common/media/cdm_messages_enums.h" |
20 #include "content/public/browser/browser_message_filter.h" | 19 #include "content/public/browser/browser_message_filter.h" |
21 #include "content/public/common/permission_status.mojom.h" | 20 #include "content/public/common/permission_status.mojom.h" |
22 #include "ipc/ipc_message.h" | 21 #include "ipc/ipc_message.h" |
23 #include "media/base/cdm_promise.h" | 22 #include "media/base/cdm_promise.h" |
24 #include "media/base/eme_constants.h" | 23 #include "media/base/eme_constants.h" |
25 #include "media/base/media_keys.h" | 24 #include "media/base/media_keys.h" |
26 #include "url/gurl.h" | 25 #include "url/gurl.h" |
27 | 26 |
28 namespace media { | 27 namespace media { |
29 class BrowserCdm; | 28 class BrowserCdm; |
30 } | 29 } |
31 | 30 |
32 namespace content { | 31 namespace content { |
33 | 32 |
34 struct InitializeCdmParameters; | |
35 | |
36 // This class manages all CDM objects. It receives control operations from the | 33 // This class manages all CDM objects. It receives control operations from the |
37 // the render process, and forwards them to corresponding CDM object. Callbacks | 34 // the render process, and forwards them to corresponding CDM object. Callbacks |
38 // from CDM objects are converted to IPCs and then sent to the render process. | 35 // from CDM objects are converted to IPCs and then sent to the render process. |
39 class CONTENT_EXPORT BrowserCdmManager : public BrowserMessageFilter { | 36 class CONTENT_EXPORT BrowserCdmManager : public BrowserMessageFilter { |
40 public: | 37 public: |
41 // Returns the BrowserCdmManager associated with the |render_process_id|. | 38 // Returns the BrowserCdmManager associated with the |render_process_id|. |
42 // Returns NULL if no BrowserCdmManager is associated. | 39 // Returns NULL if no BrowserCdmManager is associated. |
43 static BrowserCdmManager* FromProcess(int render_process_id); | 40 static BrowserCdmManager* FromProcess(int render_process_id); |
44 | 41 |
45 // Constructs the BrowserCdmManager for |render_process_id| which runs on | 42 // Constructs the BrowserCdmManager for |render_process_id| which runs on |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 media::CdmKeysInfo keys_info); | 102 media::CdmKeysInfo keys_info); |
106 void OnSessionExpirationUpdate(int render_frame_id, | 103 void OnSessionExpirationUpdate(int render_frame_id, |
107 int cdm_id, | 104 int cdm_id, |
108 const std::string& session_id, | 105 const std::string& session_id, |
109 const base::Time& new_expiry_time); | 106 const base::Time& new_expiry_time); |
110 | 107 |
111 // Message handlers. | 108 // Message handlers. |
112 void OnInitializeCdm(int render_frame_id, | 109 void OnInitializeCdm(int render_frame_id, |
113 int cdm_id, | 110 int cdm_id, |
114 uint32_t promise_id, | 111 uint32_t promise_id, |
115 const CdmHostMsg_InitializeCdm_Params& params); | 112 const std::string& key_system, |
| 113 const GURL& frame_url); |
116 void OnSetServerCertificate(int render_frame_id, | 114 void OnSetServerCertificate(int render_frame_id, |
117 int cdm_id, | 115 int cdm_id, |
118 uint32_t promise_id, | 116 uint32_t promise_id, |
119 const std::vector<uint8_t>& certificate); | 117 const std::vector<uint8_t>& certificate); |
120 void OnCreateSessionAndGenerateRequest( | 118 void OnCreateSessionAndGenerateRequest( |
121 int render_frame_id, | 119 int render_frame_id, |
122 int cdm_id, | 120 int cdm_id, |
123 uint32_t promise_id, | 121 uint32_t promise_id, |
124 CdmHostMsg_CreateSession_InitDataType init_data_type, | 122 CdmHostMsg_CreateSession_InitDataType init_data_type, |
125 const std::vector<uint8>& init_data); | 123 const std::vector<uint8>& init_data); |
126 void OnUpdateSession(int render_frame_id, | 124 void OnUpdateSession(int render_frame_id, |
127 int cdm_id, | 125 int cdm_id, |
128 uint32_t promise_id, | 126 uint32_t promise_id, |
129 const std::string& session_id, | 127 const std::string& session_id, |
130 const std::vector<uint8>& response); | 128 const std::vector<uint8>& response); |
131 void OnCloseSession(int render_frame_id, | 129 void OnCloseSession(int render_frame_id, |
132 int cdm_id, | 130 int cdm_id, |
133 uint32_t promise_id, | 131 uint32_t promise_id, |
134 const std::string& session_id); | 132 const std::string& session_id); |
135 void OnDestroyCdm(int render_frame_id, int cdm_id); | 133 void OnDestroyCdm(int render_frame_id, int cdm_id); |
136 | 134 |
137 // Adds a new CDM identified by |cdm_id| for the given |key_system| and | 135 // Adds a new CDM identified by |cdm_id| for the given |key_system| and |
138 // |security_origin|. | 136 // |security_origin|. |
139 void AddCdm(int render_frame_id, | 137 void AddCdm(int render_frame_id, |
140 int cdm_id, | 138 int cdm_id, |
141 uint32_t promise_id, | 139 uint32_t promise_id, |
142 const std::string& key_system, | 140 const std::string& key_system, |
143 const GURL& security_origin, | 141 const GURL& security_origin); |
144 bool use_hw_secure_codecs); | |
145 | 142 |
146 // Removes all CDMs associated with |render_frame_id|. | 143 // Removes all CDMs associated with |render_frame_id|. |
147 void RemoveAllCdmForFrame(int render_frame_id); | 144 void RemoveAllCdmForFrame(int render_frame_id); |
148 | 145 |
149 // Removes the CDM with the specified id. | 146 // Removes the CDM with the specified id. |
150 void RemoveCdm(uint64 id); | 147 void RemoveCdm(uint64 id); |
151 | 148 |
152 using PermissionStatusCB = base::Callback<void(bool)>; | 149 using PermissionStatusCB = base::Callback<void(bool)>; |
153 | 150 |
154 // Checks protected media identifier permission for the given | 151 // Checks protected media identifier permission for the given |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 std::map<uint64, GURL> cdm_security_origin_map_; | 188 std::map<uint64, GURL> cdm_security_origin_map_; |
192 | 189 |
193 base::WeakPtrFactory<BrowserCdmManager> weak_ptr_factory_; | 190 base::WeakPtrFactory<BrowserCdmManager> weak_ptr_factory_; |
194 | 191 |
195 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager); | 192 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager); |
196 }; | 193 }; |
197 | 194 |
198 } // namespace content | 195 } // namespace content |
199 | 196 |
200 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ | 197 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ |
OLD | NEW |