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

Unified Diff: content/browser/media/cdm/browser_cdm_manager.cc

Issue 730453004: BrowserCdmManager: gets RenderFrameHost instance on the correct thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moves UI-thread trampoline inside RequestSessionPermission Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/media/cdm/browser_cdm_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « content/browser/media/cdm/browser_cdm_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698