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 "ipc/ipc_message.h" | 20 #include "ipc/ipc_message.h" |
21 #include "media/base/cdm_promise.h" | 21 #include "media/base/cdm_promise.h" |
| 22 #include "media/base/eme_constants.h" |
22 #include "media/base/media_keys.h" | 23 #include "media/base/media_keys.h" |
23 #include "url/gurl.h" | 24 #include "url/gurl.h" |
24 | 25 |
25 namespace media { | 26 namespace media { |
26 class BrowserCdm; | 27 class BrowserCdm; |
27 } | 28 } |
28 | 29 |
29 namespace content { | 30 namespace content { |
30 | 31 |
31 // This class manages all CDM objects. It receives control operations from the | 32 // This class manages all CDM objects. It receives control operations from the |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void RemoveAllCdmForFrame(int render_frame_id); | 141 void RemoveAllCdmForFrame(int render_frame_id); |
141 | 142 |
142 // Removes the CDM with the specified id. | 143 // Removes the CDM with the specified id. |
143 void RemoveCdm(uint64 id); | 144 void RemoveCdm(uint64 id); |
144 | 145 |
145 // Requests permission for the given protected-media session (infobar). | 146 // Requests permission for the given protected-media session (infobar). |
146 void RequestSessionPermission( | 147 void RequestSessionPermission( |
147 int render_frame_id, | 148 int render_frame_id, |
148 const GURL& security_origin, | 149 const GURL& security_origin, |
149 int cdm_id, | 150 int cdm_id, |
150 const std::string& init_data_type, | 151 media::EmeInitDataType init_data_type, |
151 const std::vector<uint8>& init_data, | 152 const std::vector<uint8>& init_data, |
152 scoped_ptr<media::NewSessionCdmPromise> promise); | 153 scoped_ptr<media::NewSessionCdmPromise> promise); |
153 | 154 |
154 // If |permitted| is false, it does nothing but send | 155 // If |permitted| is false, it does nothing but send |
155 // |CdmMsg_LegacySessionError| IPC message. | 156 // |CdmMsg_LegacySessionError| IPC message. |
156 // The primary use case is infobar permission callback, i.e., when infobar | 157 // The primary use case is infobar permission callback, i.e., when infobar |
157 // can decide user's intention either from interacting with the actual info | 158 // can decide user's intention either from interacting with the actual info |
158 // bar or from the saved preference. | 159 // bar or from the saved preference. |
159 void GenerateRequestIfPermitted( | 160 void GenerateRequestIfPermitted( |
160 int render_frame_id, | 161 int render_frame_id, |
161 int cdm_id, | 162 int cdm_id, |
162 const std::string& init_data_type, | 163 media::EmeInitDataType init_data_type, |
163 const std::vector<uint8>& init_data, | 164 const std::vector<uint8>& init_data, |
164 scoped_ptr<media::NewSessionCdmPromise> promise, | 165 scoped_ptr<media::NewSessionCdmPromise> promise, |
165 bool permitted); | 166 bool permitted); |
166 | 167 |
167 const int render_process_id_; | 168 const int render_process_id_; |
168 | 169 |
169 // TaskRunner to dispatch all CDM messages to. If it's NULL, all messages are | 170 // TaskRunner to dispatch all CDM messages to. If it's NULL, all messages are |
170 // dispatched to the browser UI thread. | 171 // dispatched to the browser UI thread. |
171 scoped_refptr<base::TaskRunner> task_runner_; | 172 scoped_refptr<base::TaskRunner> task_runner_; |
172 | 173 |
(...skipping 11 matching lines...) Expand all Loading... |
184 std::map<uint64, base::Closure> cdm_cancel_permission_map_; | 185 std::map<uint64, base::Closure> cdm_cancel_permission_map_; |
185 | 186 |
186 base::WeakPtrFactory<BrowserCdmManager> weak_ptr_factory_; | 187 base::WeakPtrFactory<BrowserCdmManager> weak_ptr_factory_; |
187 | 188 |
188 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager); | 189 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager); |
189 }; | 190 }; |
190 | 191 |
191 } // namespace content | 192 } // namespace content |
192 | 193 |
193 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ | 194 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ |
OLD | NEW |