electron/shell/browser/extensions/electron_extension_host_delegate.cc
Charles Kerr 23bcca3ffc
refactor: put empty virtual function definitions in header (#43285)
* refactor: in FramelessView, move empty function decls to header

* refactor: in electron::api::WebContents, move empty function decls to header

* refactor: in electron::api::NativeWindow, move empty function decls to header

* refactor: in electron::OffScreenWebContentsView, move empty function decls to header

* refactor: in electron::OffScreenRenderWidgetHostView, move empty function decls to header

* refactor: in auto_updater::AutoUpdater, move empty function decls to header

* refactor: in electorn::api::FrameSubscriber, move empty function decls to header

* refactor: in electorn::api::SimpleURLLoaderWrapper, move empty function decls to header

* refactor: in electorn::InspectableWebContents, move empty function decls to header

* refactor: in electorn::OffScreenVideoConsumer, move empty function decls to header

* refactor: in electron::OffScreenWebContentsView, move empty function decls to header

* refactor: in electron::TrayIcon, move empty function decls to header

* refactor: in electron::ViewsDelegate, move empty function decls to header

* refactor: in electron::MediaCaptureDevicesDispatcher, move empty function decls to header

* refactor: in electron::UsbChooserContext::DeviceObserver, move empty function decls to header

* refactor: in electron::ProxyingWebSocket, move empty function decls to header

* refactor: in electron::Notification, move empty function decls to header

* refactor: in electron::PlatformNotificationService, move empty function decls to header

* Revert "refactor: in electron::PlatformNotificationService, move empty function decls to header"

This reverts commit 9103750d03b9ba1ceccba43d11dfdc2404ff6191.

* refactor: in electron::ElectronPDFDocumentHelperClient, move empty function decls to header

* refactor: in electron::api::SpellCheckClient, move empty function decls to header

* refactor: in electron::ElectronExtensionHostDelegate, move empty function decls to header

* refactor: in electron::PlatformNotificationService, move empty function decls to header

* refactor: in electron::NativeWindowViews, move empty function decls to header

* chore: move SetTouchBar() back to cc

* Revert "refactor: in auto_updater::AutoUpdater, move empty function decls to header"

This reverts commit c43d6862d32c74f63f82700a7546a732ac05ecb8.
2024-08-12 09:56:51 +02:00

77 lines
2.5 KiB
C++

// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "shell/browser/extensions/electron_extension_host_delegate.h"
#include <memory>
#include <string>
#include <utility>
#include "base/logging.h"
#include "extensions/browser/media_capture_util.h"
#include "shell/browser/api/electron_api_web_contents.h"
#include "shell/browser/extensions/electron_extension_web_contents_observer.h"
#include "v8/include/v8.h"
namespace extensions {
ElectronExtensionHostDelegate::ElectronExtensionHostDelegate() = default;
ElectronExtensionHostDelegate::~ElectronExtensionHostDelegate() = default;
void ElectronExtensionHostDelegate::OnExtensionHostCreated(
content::WebContents* web_contents) {
ElectronExtensionWebContentsObserver::CreateForWebContents(web_contents);
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
electron::api::WebContents::FromOrCreate(isolate, web_contents);
}
content::JavaScriptDialogManager*
ElectronExtensionHostDelegate::GetJavaScriptDialogManager() {
// TODO(jamescook): Create a JavaScriptDialogManager or reuse the one from
// content_shell.
NOTREACHED();
}
void ElectronExtensionHostDelegate::CreateTab(
std::unique_ptr<content::WebContents> web_contents,
const std::string& extension_id,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& window_features,
bool user_gesture) {
// TODO(jamescook): Should app_shell support opening popup windows?
NOTREACHED();
}
void ElectronExtensionHostDelegate::ProcessMediaAccessRequest(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback,
const Extension* extension) {
// Allow access to the microphone and/or camera.
media_capture_util::GrantMediaStreamRequest(web_contents, request,
std::move(callback), extension);
}
bool ElectronExtensionHostDelegate::CheckMediaAccessPermission(
content::RenderFrameHost* render_frame_host,
const url::Origin& security_origin,
blink::mojom::MediaStreamType type,
const Extension* extension) {
media_capture_util::VerifyMediaAccessPermission(type, extension);
return true;
}
content::PictureInPictureResult
ElectronExtensionHostDelegate::EnterPictureInPicture(
content::WebContents* web_contents) {
NOTREACHED();
}
void ElectronExtensionHostDelegate::ExitPictureInPicture() {
NOTREACHED();
}
} // namespace extensions