Index: content/browser/media/cdm/browser_cdm_manager.cc |
diff --git a/content/browser/media/cdm/browser_cdm_manager.cc b/content/browser/media/cdm/browser_cdm_manager.cc |
index 92720d3d11f3ed81a1a9f724bd85366bb0c1da57..951566827f5086f9c7ac14a202c8b90a811e039a 100644 |
--- a/content/browser/media/cdm/browser_cdm_manager.cc |
+++ b/content/browser/media/cdm/browser_cdm_manager.cc |
@@ -250,25 +250,12 @@ void BrowserCdmManager::OnCreateSession( |
} |
GURL security_origin = iter->second; |
- RenderFrameHost* rfh = |
- RenderFrameHost::FromID(render_process_id_, render_frame_id); |
- WebContents* web_contents = WebContents::FromRenderFrameHost(rfh); |
- DCHECK(web_contents); |
- GetContentClient()->browser()->RequestPermission( |
- content::PERMISSION_PROTECTED_MEDIA, |
- web_contents, |
- 0, // bridge id |
- security_origin, |
- // Only implemented for Android infobars which do not support |
- // user gestures. |
- true, |
- base::Bind(&BrowserCdmManager::CreateSessionIfPermitted, |
- this, |
- render_frame_id, |
- cdm_id, |
- session_id, |
- mime_type, |
- init_data)); |
+ RequestSessionPermission(render_frame_id, |
+ security_origin, |
+ cdm_id, |
+ session_id, |
+ mime_type, |
+ init_data); |
} |
void BrowserCdmManager::OnUpdateSession( |
@@ -371,6 +358,49 @@ void BrowserCdmManager::RemoveCdm(uint64 id) { |
} |
} |
+void BrowserCdmManager::RequestSessionPermission( |
+ int render_frame_id, |
+ const GURL& security_origin, |
+ int cdm_id, |
+ uint32 session_id, |
+ const std::string& content_type, |
+ const std::vector<uint8>& init_data) { |
+ if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
+ BrowserThread::PostTask( |
+ BrowserThread::UI, |
+ FROM_HERE, |
+ base::Bind(&BrowserCdmManager::RequestSessionPermission, |
+ this, |
+ render_frame_id, |
+ security_origin, |
+ cdm_id, |
+ session_id, |
+ content_type, |
+ init_data)); |
+ return; |
+ } |
+ |
+ RenderFrameHost* rfh = |
+ RenderFrameHost::FromID(render_process_id_, render_frame_id); |
+ WebContents* web_contents = WebContents::FromRenderFrameHost(rfh); |
+ DCHECK(web_contents); |
+ GetContentClient()->browser()->RequestPermission( |
+ content::PERMISSION_PROTECTED_MEDIA, |
+ web_contents, |
+ 0, // bridge id |
+ security_origin, |
+ // Only implemented for Android infobars which do not support |
+ // user gestures. |
+ true, |
+ base::Bind(&BrowserCdmManager::CreateSessionIfPermitted, |
+ this, |
+ render_frame_id, |
+ cdm_id, |
+ session_id, |
+ content_type, |
+ init_data)); |
+} |
+ |
void BrowserCdmManager::CreateSessionIfPermitted( |
int render_frame_id, |
int cdm_id, |