| // Copyright 2025 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include <memory> |
| #include <utility> |
| |
| #include "build/build_config.h" |
| #include "chrome/browser/extensions/chrome_extension_host_delegate.h" |
| #include "chrome/browser/extensions/extension_tab_util.h" |
| #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| #include "content/public/browser/web_contents.h" |
| #include "extensions/browser/extensions_browser_client.h" |
| |
| static_assert(!BUILDFLAG(IS_ANDROID)); |
| |
| namespace extensions { |
| |
| void ChromeExtensionHostDelegate::CreateTab( |
| std::unique_ptr<content::WebContents> web_contents, |
| const ExtensionId& extension_id, |
| WindowOpenDisposition disposition, |
| const blink::mojom::WindowFeatures& window_features, |
| bool user_gesture) { |
| // Verify that the browser is not shutting down. It can be the case if the |
| // call is propagated through a posted task that was already in the queue when |
| // shutdown started. See crbug.com/625646 |
| if (ExtensionsBrowserClient::Get()->IsShuttingDown()) { |
| return; |
| } |
| |
| ExtensionTabUtil::CreateTab(std::move(web_contents), extension_id, |
| disposition, window_features, user_gesture); |
| } |
| |
| void ChromeExtensionHostDelegate::ProcessMediaAccessRequest( |
| content::WebContents* web_contents, |
| const content::MediaStreamRequest& request, |
| content::MediaResponseCallback callback, |
| const Extension* extension) { |
| MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( |
| web_contents, request, std::move(callback), extension); |
| } |
| |
| bool ChromeExtensionHostDelegate::CheckMediaAccessPermission( |
| content::RenderFrameHost* render_frame_host, |
| const url::Origin& security_origin, |
| blink::mojom::MediaStreamType type, |
| const Extension* extension) { |
| return MediaCaptureDevicesDispatcher::GetInstance() |
| ->CheckMediaAccessPermission(render_frame_host, security_origin, type, |
| extension); |
| } |
| |
| } // namespace extensions |