Files
electron/shell/browser/electron_plugin_info_host_impl.cc
electron-roller[bot] 66367e9db4 chore: bump chromium to 144.0.7527.0 (main) (#48959)
* chore: bump chromium in DEPS to 144.0.7527.0

* 7106405: [video pip] Fix gesture handling issues

https://chromium-review.googlesource.com/c/chromium/src/+/7106405

* 7130938: Reland "Remove some dependencies from the custom_handlers component"

https://chromium-review.googlesource.com/c/chromium/src/+/7130938

* 7139361: Rename PluginService's GetPlugins methods

https://chromium-review.googlesource.com/c/chromium/src/+/7139361

* chore: fixup patch indices

* test: fix macos webgl test | 7128438: Reland "Flip SwiftShader deprecation to launched." | https://chromium-review.googlesource.com/c/chromium/src/+/7128438

* test: update webgl test to skip on fallback adapters

* Fixup spec runner to properly fail on linux when tests fail

* test: fixup dbus tests

* test: convert shared-texture-spec from old done callback to async

Fixes Error: done() called multiple times in test <sharedTexture module import shared texture produced by osr successfully imported and rendered with subtle api> of file /__w/electron/electron/src/electron/spec/api-shared-texture-spec.ts

* test: fixup shared texture spec

* Revert "test: fixup dbus tests"

This reverts commit 3e2e720003.

* test: fixup dbus tests

* test: disable context menu spellcheck tests on linux

https://github.com/electron/electron/pull/48657 broke those tests

* disable sharedTexture tests on platforms other than macOS arm64

They were not working on other platforms previously but now they error out.

Also removed extraneous debugging.

* fix: use github.sha for yarn cache key to avoid hashFiles() composite action bug

* Use --immutable-cache to allow native module builds

* fix: wait for devtools blur event in focus test to avoid race condition

* fix: wait for devtools blur event in focus test to avoid race condition

* fix allow native module builds in spec workspace

* test:rebuild native modules

* Revert "fix allow native module builds in spec workspace"

This reverts commit ffda3be98c.

* Revert "Use --immutable-cache to allow native module builds"

This reverts commit 2e6eea4348.

* Revert "fix: use github.sha for yarn cache key to avoid hashFiles() composite action bug"

This reverts commit 33560ba0de.

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Alice Zhao <alicelovescake@anthropic.com>
2025-11-24 12:30:57 -05:00

62 lines
2.0 KiB
C++

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "shell/browser/electron_plugin_info_host_impl.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/common/content_constants.h"
#include "url/gurl.h"
#include "url/origin.h"
using content::PluginService;
using content::WebPluginInfo;
namespace electron {
ElectronPluginInfoHostImpl::ElectronPluginInfoHostImpl() = default;
ElectronPluginInfoHostImpl::~ElectronPluginInfoHostImpl() = default;
struct ElectronPluginInfoHostImpl::GetPluginInfo_Params {
GURL url;
url::Origin main_frame_origin;
std::string mime_type;
};
void ElectronPluginInfoHostImpl::GetPluginInfo(const GURL& url,
const url::Origin& origin,
const std::string& mime_type,
GetPluginInfoCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
GetPluginInfo_Params params = {url, origin, mime_type};
PluginService::GetInstance()->GetPluginsAsync(
base::BindOnce(&ElectronPluginInfoHostImpl::PluginsLoaded,
weak_factory_.GetWeakPtr(), params, std::move(callback)));
}
void ElectronPluginInfoHostImpl::PluginsLoaded(
const GetPluginInfo_Params& params,
GetPluginInfoCallback callback,
const std::vector<WebPluginInfo>& plugins) {
mojom::PluginInfoPtr output = mojom::PluginInfo::New();
std::vector<WebPluginInfo> matching_plugins;
std::vector<std::string> mime_types;
PluginService::GetInstance()->GetPluginInfoArray(
params.url, params.mime_type, &matching_plugins, &mime_types);
if (!matching_plugins.empty()) {
output->plugin = matching_plugins[0];
output->actual_mime_type = mime_types[0];
}
std::move(callback).Run(std::move(output));
}
} // namespace electron