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.h" |
19 #include "content/common/media/cdm_messages_enums.h" | 19 #include "content/common/media/cdm_messages_enums.h" |
20 #include "content/public/browser/browser_message_filter.h" | 20 #include "content/public/browser/browser_message_filter.h" |
21 #include "content/public/common/permission_status.mojom.h" | 21 #include "content/public/common/permission_status.mojom.h" |
22 #include "ipc/ipc_message.h" | 22 #include "ipc/ipc_message.h" |
| 23 #include "media/base/browser_cdm.h" |
23 #include "media/base/cdm_promise.h" | 24 #include "media/base/cdm_promise.h" |
24 #include "media/base/eme_constants.h" | 25 #include "media/base/eme_constants.h" |
25 #include "media/base/media_keys.h" | 26 #include "media/base/media_keys.h" |
26 #include "url/gurl.h" | 27 #include "url/gurl.h" |
27 | 28 |
28 struct CdmHostMsg_CreateSessionAndGenerateRequest_Params; | 29 struct CdmHostMsg_CreateSessionAndGenerateRequest_Params; |
29 | 30 |
30 namespace media { | |
31 class BrowserCdm; | |
32 } | |
33 | |
34 namespace content { | 31 namespace content { |
35 | 32 |
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); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 const int render_process_id_; | 190 const int render_process_id_; |
194 | 191 |
195 // TaskRunner to dispatch all CDM messages to. If it's NULL, all messages are | 192 // TaskRunner to dispatch all CDM messages to. If it's NULL, all messages are |
196 // dispatched to the browser UI thread. | 193 // dispatched to the browser UI thread. |
197 scoped_refptr<base::TaskRunner> task_runner_; | 194 scoped_refptr<base::TaskRunner> task_runner_; |
198 | 195 |
199 // The key in the following maps is a combination of |render_frame_id| and | 196 // The key in the following maps is a combination of |render_frame_id| and |
200 // |cdm_id|. | 197 // |cdm_id|. |
201 | 198 |
202 // Map of managed BrowserCdms. | 199 // Map of managed BrowserCdms. |
203 typedef base::ScopedPtrHashMap<uint64, scoped_ptr<media::BrowserCdm>> CdmMap; | 200 typedef base::ScopedPtrHashMap<uint64, media::BrowserCdmPtr> CdmMap; |
204 CdmMap cdm_map_; | 201 CdmMap cdm_map_; |
205 | 202 |
206 // Map of CDM's security origin. | 203 // Map of CDM's security origin. |
207 std::map<uint64, GURL> cdm_security_origin_map_; | 204 std::map<uint64, GURL> cdm_security_origin_map_; |
208 | 205 |
209 base::WeakPtrFactory<BrowserCdmManager> weak_ptr_factory_; | 206 base::WeakPtrFactory<BrowserCdmManager> weak_ptr_factory_; |
210 | 207 |
211 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager); | 208 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager); |
212 }; | 209 }; |
213 | 210 |
214 } // namespace content | 211 } // namespace content |
215 | 212 |
216 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ | 213 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ |
OLD | NEW |