mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
* chore: bump chromium in DEPS to 144.0.7524.0 * chore: bump chromium in DEPS to 144.0.7524.1 * chore: bump chromium in DEPS to 144.0.7526.0 * chore: bump chromium in DEPS to 144.0.7526.1 * chore: bump chromium to 144.0.7522.0 (main) (#48892) * chore: bump chromium in DEPS to 144.0.7522.0 * 7131867: Remove GenericScopedHandle::IsValid in favor of is_valid https://chromium-review.googlesource.com/c/chromium/src/+/7131867 * 7078879: [video pip] Remove old controls https://chromium-review.googlesource.com/c/chromium/src/+/7078879 * chore: fixup patch indices * 7128138: Add a pref to enable Secure DNS 'automatic mode with DoH fallback'. https://chromium-review.googlesource.com/c/chromium/src/+/7128138 * chore: fixup indices * fix: pip patch --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> (cherry picked from commit10b07deb97) * chore: bump chromium to 144.0.7526.0 (main) (#48932) * chore: bump chromium in DEPS to 144.0.7526.0 * 7138583: [Partitioned Popins Removal] IPC https://chromium-review.googlesource.com/c/chromium/src/+/7138583 * chore: fixup patch indices * 7139794: Partially remove check for global handlers in plugin mime_type code https://chromium-review.googlesource.com/c/chromium/src/+/7139794 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> (cherry picked from commit8ecd064d2c) --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
62 lines
2.0 KiB
C++
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()->GetPlugins(
|
|
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
|