mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
* chore: bump chromium in DEPS to 149.0.7779.0 * chore: bump chromium in DEPS to 149.0.7781.0 * 7726883: Add secondary label support to SimpleMenuModel and update views_examples Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7726883 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * chore: update patches (trivial only) Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * fix: IWYU for base/logging.h Upstream is removing transitive includes of base/logging.h as part of crbug.com/499476145. Several CLs landed in this roll that required adding explicit includes across Electron source and patches. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7732103 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7735571 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 7732482: [bedrock] Create BrowserProcess setters for system tray icons Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7732482 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * chore: update patches (trivial only) Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * 7739543: Add RenderWidgetHostView::HasSavedFrame Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7739543 Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com> * chore: bump chromium in DEPS to 149.0.7783.0 * chore: bump chromium in DEPS to 149.0.7789.0 * chore: update patches (trivial only) * 7703728: DedicatedWorker: Enforce same-origin check for main script fetch. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7703728 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 7720140: Remove GetPrefServiceForContext from ExtensionsBrowserClient Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7720140 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: update patches (trivial only) * 7728375: Disable reentrancy by default except for Android and iOS Upstream changed the default ObserverList reentrancy policy from kAllowReentrancy to kDisallowReentrancy. Electron's observer lists are re-entered when macOS AppKit delivers synchronous window notifications (e.g. windowDidResignMain: during windowDidChangeOcclusionState:) because JS event handlers can trigger window state changes mid-iteration. Explicitly opt into kAllowReentrancy for now. A follow-up should convert synchronous Emit calls in window observer callbacks to EmitEventSoon to eliminate the reentrancy. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7728375 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: bump chromium in DEPS to 149.0.7791.1 * chore: update patches (trivial only) * 7696481: [pdf] Rename PdfViewerStreamManager to MimeHandlerStreamManager Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7696481 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 7745796: Printing: Remove parameter from ShowScriptedPrintPreview() interface Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7745796 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 7688714: [Lens / Cookies] Grant secure cookie exemptions for Lens side panel Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7688714 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 7752609: don't show glic button for non-normal BWIs. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7752609 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * 7749860: [media] Remove VideoFrame::WrapSharedImage with coded_size Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7749860 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: bump chromium in DEPS to 149.0.7793.0 * chore: bump chromium in DEPS to 149.0.7795.0 * chore: bump chromium in DEPS to 149.0.7797.0 * chore: update patches * chore: remove upstreamed patches - fix_pass_trigger_for_global_shortcuts_on_wayland.patch: https://chromium-review.googlesource.com/c/chromium/src/+/7620219 - gin_mark_argumentholder_as_cppgc_stack_allocated.patch: https://chromium-review.googlesource.com/c/chromium/src/+/7728865 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: bump chromium in DEPS to 149.0.7798.0 * chore: update filenames.libcxx.gni * 7760061: Reland Reland Add a client-side decorated frame view for non-browser widgets on Linux Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7760061 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 7760945: Rename WebString::UTF8ConversionMode to Utf8ConversionMode Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7760945 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: update patches * chore: remove upstreamed patches - patches/devtools_frontend/fix_context_selector_not_showing_execution_contexts.patch: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7761316 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 7719004: [extensions] Gate dict-format mime_types_handler parsing Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7719004 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 7716681: [pdf] Introduce MimeHandlerStreamDelegate and plumb ownership Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7716681 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 7725342: Rename WebString::FromUTF8 to FromUtf8 in Blink Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7725342 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 7615475: Add a native frame view for non-browser widgets on Linux Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7615475 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 7735248: Move ManifestV2ExperimentManager to //extensions Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7735248 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 7725187: linux: set env FC_FONTATIONS and EGL_PLATFORM early Move Ozone pre-init from ElectronBrowserMainParts::PreEarlyInitialization() to ElectronMainDelegate::PreSandboxStartup() to match upstream's rename and relocation. The call has to run before threads are created. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7725187 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 7743280: Introduce client ID for network throttling conditions. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7743280 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: disable ml-kem node test incompatible with BoringSSL test-crypto-pqc-key-objects-ml-kem: BoringSSL's ML-KEM support is inconsistent with the test's OpenSSL-version-based assumptions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test: update V8 serialization wire format version to 16 V8 14.9 (Chromium 149) bumped the serialization wire format from version 15 to 16. Update the hardcoded expected bytes in the test-v8-serdes.js test. Remove this patch once upstream Node.js catches up via its next V8 roll. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Samuel Maddock <samuelmaddock@electronjs.org> Co-authored-by: Claude <svc-devxp-claude@slack-corp.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: clavin <clavin@electronjs.org>
65 lines
2.1 KiB
C++
65 lines
2.1 KiB
C++
// Copyright 2016 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/plugins/plugin_utils.h"
|
|
|
|
#include <vector>
|
|
|
|
#include "content/public/common/webplugininfo.h"
|
|
#include "electron/buildflags/buildflags.h"
|
|
#include "url/gurl.h"
|
|
#include "url/origin.h"
|
|
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
#include "extensions/browser/extension_registry.h"
|
|
#include "extensions/browser/extension_util.h"
|
|
#include "extensions/common/constants.h"
|
|
#include "extensions/common/extension.h"
|
|
#include "extensions/common/manifest_handlers/mime_types_handler.h"
|
|
#endif
|
|
|
|
// static
|
|
std::string PluginUtils::GetExtensionIdForMimeType(
|
|
content::BrowserContext* browser_context,
|
|
const std::string& mime_type) {
|
|
auto map = GetMimeTypeToExtensionIdMap(browser_context);
|
|
auto it = map.find(mime_type);
|
|
if (it != map.end())
|
|
return it->second;
|
|
return {};
|
|
}
|
|
|
|
base::flat_map<std::string, std::string>
|
|
PluginUtils::GetMimeTypeToExtensionIdMap(
|
|
content::BrowserContext* browser_context) {
|
|
base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
|
|
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
|
const auto& allowed_extension_ids = MimeTypesHandler::GetMIMETypeAllowlist();
|
|
if (allowed_extension_ids.empty())
|
|
return {};
|
|
|
|
const extensions::ExtensionSet& enabled_extensions =
|
|
extensions::ExtensionRegistry::Get(browser_context)->enabled_extensions();
|
|
|
|
// Go through the white-listed extensions and try to use them to intercept
|
|
// the URL request.
|
|
for (const std::string& id : allowed_extension_ids) {
|
|
const extensions::Extension* extension = enabled_extensions.GetByID(id);
|
|
if (!extension) // extension might not be installed, so check for nullptr
|
|
continue;
|
|
|
|
if (const MimeTypesHandler* handler =
|
|
MimeTypesHandler::GetHandler(extension)) {
|
|
for (const std::string& mime_type : handler->GetSupportedMimeTypes()) {
|
|
const auto [_, inserted] =
|
|
mime_type_to_extension_id_map.insert_or_assign(mime_type, id);
|
|
DCHECK(inserted);
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
return mime_type_to_extension_id_map;
|
|
}
|