Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: content/browser/media/cdm/browser_cdm_manager.h

Issue 1013913002: media: Fix permission request/check for EME on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/media/cdm/browser_cdm_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 int cdm_id, 137 int cdm_id,
138 const std::string& key_system, 138 const std::string& key_system,
139 const GURL& security_origin); 139 const GURL& security_origin);
140 140
141 // Removes all CDMs associated with |render_frame_id|. 141 // Removes all CDMs associated with |render_frame_id|.
142 void RemoveAllCdmForFrame(int render_frame_id); 142 void RemoveAllCdmForFrame(int render_frame_id);
143 143
144 // Removes the CDM with the specified id. 144 // Removes the CDM with the specified id.
145 void RemoveCdm(uint64 id); 145 void RemoveCdm(uint64 id);
146 146
147 // Requests permission for the given protected-media session (infobar). 147 using PermissionStatusCB = base::Callback<void(bool)>;
148 void RequestSessionPermission( 148
149 // Checks protected media identifier permission for the given
150 // |render_frame_id| and |cdm_id|.
151 void CheckPermissionStatus(int render_frame_id,
152 int cdm_id,
153 const PermissionStatusCB& permission_status_cb);
154
155 // Checks permission status on Browser UI thread. Runs |permission_status_cb|
156 // on the |task_runner_| with the permission status.
157 void CheckPermissionStatusOnUIThread(
149 int render_frame_id, 158 int render_frame_id,
150 const GURL& security_origin, 159 const GURL& security_origin,
151 int cdm_id, 160 const PermissionStatusCB& permission_status_cb);
152 media::EmeInitDataType init_data_type,
153 const std::vector<uint8>& init_data,
154 scoped_ptr<media::NewSessionCdmPromise> promise);
155 161
156 // If |permitted| is false, it does nothing but send 162 // Calls CreateSessionAndGenerateRequest() on the CDM if
157 // |CdmMsg_LegacySessionError| IPC message. 163 // |permission_was_allowed| is true. Otherwise rejects the |promise|.
158 // The primary use case is infobar permission callback, i.e., when infobar 164 void CreateSessionAndGenerateRequestIfPermitted(
159 // can decide user's intention either from interacting with the actual info
160 // bar or from the saved preference.
161 void GenerateRequestIfPermitted(
162 int render_frame_id, 165 int render_frame_id,
163 int cdm_id, 166 int cdm_id,
164 media::EmeInitDataType init_data_type, 167 media::EmeInitDataType init_data_type,
165 const std::vector<uint8>& init_data, 168 const std::vector<uint8>& init_data,
166 scoped_ptr<media::NewSessionCdmPromise> promise, 169 scoped_ptr<media::NewSessionCdmPromise> promise,
167 PermissionStatus permission); 170 bool permission_was_allowed);
168 171
169 const int render_process_id_; 172 const int render_process_id_;
170 173
171 // TaskRunner to dispatch all CDM messages to. If it's NULL, all messages are 174 // TaskRunner to dispatch all CDM messages to. If it's NULL, all messages are
172 // dispatched to the browser UI thread. 175 // dispatched to the browser UI thread.
173 scoped_refptr<base::TaskRunner> task_runner_; 176 scoped_refptr<base::TaskRunner> task_runner_;
174 177
175 // The key in the following maps is a combination of |render_frame_id| and 178 // The key in the following maps is a combination of |render_frame_id| and
176 // |cdm_id|. 179 // |cdm_id|.
177 180
178 // Map of managed BrowserCdms. 181 // Map of managed BrowserCdms.
179 typedef base::ScopedPtrHashMap<uint64, media::BrowserCdm> CdmMap; 182 typedef base::ScopedPtrHashMap<uint64, media::BrowserCdm> CdmMap;
180 CdmMap cdm_map_; 183 CdmMap cdm_map_;
181 184
182 // Map of CDM's security origin. 185 // Map of CDM's security origin.
183 std::map<uint64, GURL> cdm_security_origin_map_; 186 std::map<uint64, GURL> cdm_security_origin_map_;
184 187
185 // Map of callbacks to cancel the permission request.
186 std::map<uint64, base::Closure> cdm_cancel_permission_map_;
187
188 base::WeakPtrFactory<BrowserCdmManager> weak_ptr_factory_; 188 base::WeakPtrFactory<BrowserCdmManager> weak_ptr_factory_;
189 189
190 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager); 190 DISALLOW_COPY_AND_ASSIGN(BrowserCdmManager);
191 }; 191 };
192 192
193 } // namespace content 193 } // namespace content
194 194
195 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_ 195 #endif // CONTENT_BROWSER_MEDIA_CDM_BROWSER_CDM_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/cdm/browser_cdm_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698