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_enums.h" | 18 #include "content/common/media/cdm_messages_enums.h" |
19 #include "content/public/browser/browser_message_filter.h" | 19 #include "content/public/browser/browser_message_filter.h" |
| 20 #include "content/public/common/permission_status.mojom.h" |
20 #include "ipc/ipc_message.h" | 21 #include "ipc/ipc_message.h" |
21 #include "media/base/cdm_promise.h" | 22 #include "media/base/cdm_promise.h" |
22 #include "media/base/eme_constants.h" | 23 #include "media/base/eme_constants.h" |
23 #include "media/base/media_keys.h" | 24 #include "media/base/media_keys.h" |
24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
25 | 26 |
26 namespace media { | 27 namespace media { |
27 class BrowserCdm; | 28 class BrowserCdm; |
28 } | 29 } |
29 | 30 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // |CdmMsg_LegacySessionError| IPC message. | 157 // |CdmMsg_LegacySessionError| IPC message. |
157 // The primary use case is infobar permission callback, i.e., when infobar | 158 // The primary use case is infobar permission callback, i.e., when infobar |
158 // can decide user's intention either from interacting with the actual info | 159 // can decide user's intention either from interacting with the actual info |
159 // bar or from the saved preference. | 160 // bar or from the saved preference. |
160 void GenerateRequestIfPermitted( | 161 void GenerateRequestIfPermitted( |
161 int render_frame_id, | 162 int render_frame_id, |
162 int cdm_id, | 163 int cdm_id, |
163 media::EmeInitDataType init_data_type, | 164 media::EmeInitDataType init_data_type, |
164 const std::vector<uint8>& init_data, | 165 const std::vector<uint8>& init_data, |
165 scoped_ptr<media::NewSessionCdmPromise> promise, | 166 scoped_ptr<media::NewSessionCdmPromise> promise, |
166 bool permitted); | 167 PermissionStatus permission); |
167 | 168 |
168 const int render_process_id_; | 169 const int render_process_id_; |
169 | 170 |
170 // TaskRunner to dispatch all CDM messages to. If it's NULL, all messages are | 171 // TaskRunner to dispatch all CDM messages to. If it's NULL, all messages are |
171 // dispatched to the browser UI thread. | 172 // dispatched to the browser UI thread. |
172 scoped_refptr<base::TaskRunner> task_runner_; | 173 scoped_refptr<base::TaskRunner> task_runner_; |
173 | 174 |
174 // The key in the following maps is a combination of |render_frame_id| and | 175 // The key in the following maps is a combination of |render_frame_id| and |
175 // |cdm_id|. | 176 // |cdm_id|. |
176 | 177 |
177 // Map of managed BrowserCdms. | 178 // Map of managed BrowserCdms. |
178 typedef base::ScopedPtrHashMap<uint64, media::BrowserCdm> CdmMap; | 179 typedef base::ScopedPtrHashMap<uint64, media::BrowserCdm> CdmMap; |
179 CdmMap cdm_map_; | 180 CdmMap cdm_map_; |
180 | 181 |
181 // Map of CDM's security origin. | 182 // Map of CDM's security origin. |
182 std::map<uint64, GURL> cdm_security_origin_map_; | 183 std::map<uint64, GURL> cdm_security_origin_map_; |
183 | 184 |
184 // Map of callbacks to cancel the permission request. | 185 // Map of callbacks to cancel the permission request. |
185 std::map<uint64, base::Closure> cdm_cancel_permission_map_; | 186 std::map<uint64, base::Closure> cdm_cancel_permission_map_; |
186 | 187 |
187 base::WeakPtrFactory<BrowserCdmManager> weak_ptr_factory_; | 188 base::WeakPtrFactory<BrowserCdmManager> weak_ptr_factory_; |
188 | 189 |
189 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager); | 190 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager); |
190 }; | 191 }; |
191 | 192 |
192 } // namespace content | 193 } // namespace content |
193 | 194 |
194 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ | 195 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ |
OLD | NEW |