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