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

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: Created 5 years, 6 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 1e8e2d1e9dd1fbf837afdfef61bab4bd8b52cb92..7b28ce9bd9b8262cf2765d2590ab012409d6fd92 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