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 #include "content/browser/media/cdm/browser_cdm_manager.h" | 5 #include "content/browser/media/cdm/browser_cdm_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 NOTREACHED(); | 245 NOTREACHED(); |
246 SendSessionError(render_frame_id, cdm_id, session_id); | 246 SendSessionError(render_frame_id, cdm_id, session_id); |
247 return; | 247 return; |
248 } | 248 } |
249 GURL security_origin = iter->second; | 249 GURL security_origin = iter->second; |
250 | 250 |
251 RenderFrameHost* rfh = | 251 RenderFrameHost* rfh = |
252 RenderFrameHost::FromID(render_process_id_, render_frame_id); | 252 RenderFrameHost::FromID(render_process_id_, render_frame_id); |
253 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh); | 253 WebContents* web_contents = WebContents::FromRenderFrameHost(rfh); |
254 DCHECK(web_contents); | 254 DCHECK(web_contents); |
255 | 255 GetContentClient()->browser()->RequestPermission( |
256 base::Closure cancel_callback; | 256 content::PERMISSION_PROTECTED_MEDIA, |
257 GetContentClient()->browser()->RequestProtectedMediaIdentifierPermission( | |
258 web_contents, | 257 web_contents, |
258 0 /* bridge id */, | |
259 security_origin, | 259 security_origin, |
260 /* only implemented for android infobars which do not support | |
261 user gesture */ | |
262 true, | |
Bernhard Bauer
2014/10/20 14:57:24
You could extract this to a local variable and put
Bernhard Bauer
2014/10/23 08:38:01
^^^
Miguel Garcia
2014/10/23 12:48:11
I thought it was just a suggestion and decided not
Bernhard Bauer
2014/10/23 12:54:53
Fair enough. I wasn't sure whether you had seen it
| |
260 base::Bind(&BrowserCdmManager::CreateSessionIfPermitted, | 263 base::Bind(&BrowserCdmManager::CreateSessionIfPermitted, |
261 this, | 264 this, |
262 render_frame_id, cdm_id, session_id, | 265 render_frame_id, cdm_id, session_id, |
263 mime_type, init_data), | 266 mime_type, init_data)); |
264 &cancel_callback); | |
265 | |
266 if (cancel_callback.is_null()) | |
267 return; | |
268 cdm_cancel_permission_map_[GetId(render_frame_id, cdm_id)] = cancel_callback; | |
269 } | 267 } |
270 | 268 |
271 void BrowserCdmManager::OnUpdateSession( | 269 void BrowserCdmManager::OnUpdateSession( |
272 int render_frame_id, | 270 int render_frame_id, |
273 int cdm_id, | 271 int cdm_id, |
274 uint32 session_id, | 272 uint32 session_id, |
275 const std::vector<uint8>& response) { | 273 const std::vector<uint8>& response) { |
276 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); | 274 BrowserCdm* cdm = GetCdm(render_frame_id, cdm_id); |
277 if (!cdm) { | 275 if (!cdm) { |
278 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id; | 276 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id; | 371 DLOG(WARNING) << "No CDM found for: " << render_frame_id << ", " << cdm_id; |
374 SendSessionError(render_frame_id, cdm_id, session_id); | 372 SendSessionError(render_frame_id, cdm_id, session_id); |
375 return; | 373 return; |
376 } | 374 } |
377 | 375 |
378 // This could fail, in which case a SessionError will be fired. | 376 // This could fail, in which case a SessionError will be fired. |
379 cdm->CreateSession(session_id, content_type, &init_data[0], init_data.size()); | 377 cdm->CreateSession(session_id, content_type, &init_data[0], init_data.size()); |
380 } | 378 } |
381 | 379 |
382 } // namespace content | 380 } // namespace content |
OLD | NEW |