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

Unified Diff: chrome/browser/extensions/api/tab_capture/offscreen_presentation.cc

Issue 1221483002: New tabCapture.captureOffscreenTab API, initially for Presentation API 1UA mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revived and refreshed after API proposal process. Moar tests. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/tab_capture/offscreen_presentation.cc
diff --git a/chrome/browser/extensions/api/tab_capture/offscreen_presentation.cc b/chrome/browser/extensions/api/tab_capture/offscreen_presentation.cc
index 2ccd614b8035321582aac9c7c12777da22d06bdf..ebd4c6be281b57621c7590c7e1a47ea39c63475e 100644
--- a/chrome/browser/extensions/api/tab_capture/offscreen_presentation.cc
+++ b/chrome/browser/extensions/api/tab_capture/offscreen_presentation.cc
@@ -381,14 +381,12 @@ void OffscreenPresentation::RequestMediaAccessPermission(
// WebContents.
content::BrowserContext* const extension_browser_context =
owner_->extension_web_contents()->GetBrowserContext();
- std::string extension_id;
- for (const ExtensionHost* host :
- ProcessManager::Get(extension_browser_context)->background_hosts()) {
- if (host->host_contents() == owner_->extension_web_contents()) {
- extension_id = host->extension_id();
- break;
- }
- }
+ const extensions::Extension* const extension =
+ ProcessManager::Get(extension_browser_context)->
+ GetExtensionForWebContents(owner_->extension_web_contents());
+ const std::string extension_id = extension ? extension->id() : "";
+ LOG_IF(DFATAL, extension_id.empty())
+ << "Extension that started this OffscreenPresentation was not found.";
// If verified, allow any tab capture audio/video devices that were requested.
extensions::TabCaptureRegistry* const tab_capture_registry =

Powered by Google App Engine
This is Rietveld 408576698