Files
electron/shell/browser/browser_process_impl.h
trop[bot] e3cabb6119 chore: bump chromium to 144.0.7547.0 (40-x-y) (#49146)
* chore: bump chromium in DEPS to 144.0.7543.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* Pass PipScreenCaptureCoordinatorProxy to ScreenCaptureKitDeviceMac

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

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* chore: update patches

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* chore: update filenames.libcxx.gni

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* 7142359: Spanification of process_singleton_posix.cc

https: //chromium-review.googlesource.com/c/chromium/src/+/7142359
Co-Authored-By: Charles Kerr <70381+ckerr@users.noreply.github.com>

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* Move logging::LoggingSettings to base/logging/logging_settings.h

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

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* chore: bump chromium in DEPS to 144.0.7545.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* 7159368: update PluginService API for sync GetPlugins

Upstream removed async PluginService APIs:
- GetPluginsAsync() removed, use synchronous GetPlugins()
- RegisterInternalPlugin() now takes single argument (remove add_at_beginning)
- RefreshPlugins() removed entirely

Updated ElectronPluginInfoHostImpl to use synchronous plugin loading and
simplified ElectronBrowserMainParts internal plugin registration.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159368
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159328
Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159056
(cherry picked from commit 88cdf50b0a)

Co-authored-by: Samuel Attard <sattard@anthropic.com>

* 7159184: add missing base/files/file_path.h include

Add explicit include for base/files/file_path.h in electron_browser_context.h.
After removal of superfluous Mojo includes from content headers, base::FilePath
is no longer transitively included via content/public/browser/browser_context.h.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159184
(cherry picked from commit 6ca8ea03ec)

Co-authored-by: Samuel Attard <sattard@anthropic.com>

* 7126479: add ShouldForceRefreshTextCheckService parameter to SpellCheckClient

Upstream added a force-refresh parameter to WebTextCheckClient::RequestCheckingOfText
to bypass spell check cache. Add the new ShouldForceRefreshTextCheckService
parameter to SpellCheckClient's override (currently unused in Electron).

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7126479
(cherry picked from commit 879c0401c4)

Co-authored-by: Samuel Attard <sattard@anthropic.com>

* 7083663: remove fingerprinting_protection_ruleset_service override

Upstream deleted external references to Fingerprinting Protection Filter (FPF)
component. Remove the fingerprinting_protection_ruleset_service() override
from BrowserProcessImpl as the method no longer exists in the base class.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7083663
(cherry picked from commit 8350d152f9)

Co-authored-by: Samuel Attard <sattard@anthropic.com>

* 7155287: implement WebContentsView::GetSize and Resize

Upstream delegated WebContents::GetSize() and Resize() to WebContentsView,
making them pure virtual. Add const qualifier to GetSize() and implement
the Resize() override in OffScreenWebContentsView (no-op for offscreen).

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7155287
(cherry picked from commit 084eaa568e)

Co-authored-by: Samuel Attard <sattard@anthropic.com>

* 7184238: add OnUnconfirmedTapConvertedToTap override

Upstream added OnUnconfirmedTapConvertedToTap as a pure virtual method
to RenderWidgetHostViewBase to inform root view when child frame converts
an unconfirmed tap. Add empty override for offscreen rendering.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7184238
(cherry picked from commit ef03400d9a)

Co-authored-by: Samuel Attard <sattard@anthropic.com>

* 7143586: add widget parameter to OnCommandsChanged

GlobalAcceleratorListener::OnCommandsChanged gained a gfx::AcceleratedWidget
parameter for window association in the GlobalShortcutListenerLinux
implementation. Pass gfx::kNullAcceleratedWidget for Electron's usage.

Ref: : Pass parent handle to GlobalAcceleratorListenerLinux::BindShortcuts | https://chromium-review.googlesource.com/c/chromium/src/+/7143586
(cherry picked from commit 38306e2bfc)
Co-Authored-By: Samuel Attard <MarshallOfSound@users.noreply.github.com>

Co-authored-by: Samuel Attard <sattard@anthropic.com>

* chore: update patches

Co-Authored-By: Samuel Attard <MarshallOfSound@users.noreply.github.com>

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* chore: bump chromium in DEPS to 144.0.7547.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* chore: update patches

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* 7189232: Add support for UnownedUserData in GlobalFeatures

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

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* Refactor: Use std::u16string for extension load error messages

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

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* fixup Add support for UnownedUserData in GlobalFeatures

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* 7165650: Remove ResourceContext

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

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* fixup BUILD.gn for lint

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* 7202164: Reland "Reland "Remove GenericScopedHandle:IsValid""

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

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* advance deprecation of v8::ReturnValue<void>::Set(Local<S>).

7168624: [runtime][api] Relax requirements for setter/definer/deleter callbacks | https://chromium-review.googlesource.com/c/v8/v8/+/7168624

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* fixup advance deprecation of v8::ReturnValue<void>::Set(Local<S>)

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* chore: skip setting LPAC ACLs

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>

* Revert "chore: skip setting LPAC ACLs"

This reverts commit e187aec488.

Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>

* chore: revert Convert to UNSAFE_TODO in sandbox

revert https://chromium-review.googlesource.com/c/chromium/src/+/7131661 to see if it fixes the Windows sandbox issue.

Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>

* Revert "chore: revert Convert to UNSAFE_TODO in sandbox"

This reverts commit 57afbfefe5.

Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>

* chore: Revert "Enable network sandbox by default on Windows"

see if this fixes the Windows sandbox issue

Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>

* Enable network sandbox by default on Windows

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

Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>

* Revert "chore: Revert "Enable network sandbox by default on Windows""

This reverts commit 530ab6af82.

Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>

* fixup! Enable network sandbox by default on Windows | https://chromium-review.googlesource.com/c/chromium/src/+/7204292

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* fixup!: Correct flag name, add kLocalNetworkAccessChecks to all platforms

Co-authored-by: Keeley Hammond <khammond@slack-corp.com>

* chore: remove patch that hasn't been backported

See https://github.com/electron/electron/pull/48675

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Samuel Attard <sattard@anthropic.com>
Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Niklas Wenzel <dev@nikwen.de>
2025-12-05 12:18:13 -05:00

171 lines
6.8 KiB
C++

// Copyright (c) 2012 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.
// This interface is for managing the global services of the application. Each
// service is lazily created when requested the first time. The service getters
// will return nullptr if the service is not available, so callers must check
// for this condition.
#ifndef ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_
#define ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_
#include <memory>
#include <string>
#include "chrome/browser/browser_process.h"
#include "components/embedder_support/origin_trials/origin_trials_settings_storage.h"
#include "components/prefs/value_map_pref_store.h"
#include "printing/buildflags/buildflags.h"
#include "services/network/public/cpp/network_quality_tracker.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "shell/browser/net/system_network_context_manager.h"
#include "ui/base/unowned_user_data/unowned_user_data_host.h"
#if BUILDFLAG(IS_LINUX)
#include "components/os_crypt/sync/key_storage_util_linux.h"
#endif
class PrefService;
namespace printing {
class PrintJobManager;
}
namespace electron {
class ResolveProxyHelper;
}
// Empty definition for std::unique_ptr, rather than a forward declaration
class BackgroundModeManager {};
// NOT THREAD SAFE, call only from the main thread.
// These functions shouldn't return nullptr unless otherwise noted.
class BrowserProcessImpl : public BrowserProcess {
public:
BrowserProcessImpl();
~BrowserProcessImpl() override;
// disable copy
BrowserProcessImpl(const BrowserProcessImpl&) = delete;
BrowserProcessImpl& operator=(const BrowserProcessImpl&) = delete;
static void ApplyProxyModeFromCommandLine(ValueMapPrefStore* pref_store);
void PostEarlyInitialization();
void PreCreateThreads();
void PreMainMessageLoopRun();
void PostDestroyThreads() {}
void PostMainMessageLoopRun();
void SetSystemLocale(const std::string& locale);
const std::string& GetSystemLocale() const;
electron::ResolveProxyHelper* GetResolveProxyHelper();
#if BUILDFLAG(IS_LINUX)
void SetLinuxStorageBackend(os_crypt::SelectedLinuxBackend selected_backend);
[[nodiscard]] const std::string& linux_storage_backend() const {
return selected_linux_storage_backend_;
}
#endif
// BrowserProcess
BuildState* GetBuildState() override;
GlobalFeatures* GetFeatures() override;
void CreateGlobalFeaturesForTesting() override {}
void EndSession() override {}
void FlushLocalStateAndReply(base::OnceClosure reply) override {}
bool IsShuttingDown() override;
ui::UnownedUserDataHost& GetUnownedUserDataHost() override;
const ui::UnownedUserDataHost& GetUnownedUserDataHost() const override;
metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager()
override;
metrics::MetricsService* metrics_service() override;
ProfileManager* profile_manager() override;
PrefService* local_state() override;
signin::ActivePrimaryAccountsMetricsRecorder*
active_primary_accounts_metrics_recorder() override;
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
override;
variations::VariationsService* variations_service() override;
BrowserProcessPlatformPart* platform_part() override;
NotificationUIManager* notification_ui_manager() override;
NotificationPlatformBridge* notification_platform_bridge() override;
SystemNetworkContextManager* system_network_context_manager() override;
network::NetworkQualityTracker* network_quality_tracker() override;
embedder_support::OriginTrialsSettingsStorage*
GetOriginTrialsSettingsStorage() override;
policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
policy::PolicyService* policy_service() override;
IconManager* icon_manager() override;
GpuModeManager* gpu_mode_manager() override;
printing::PrintPreviewDialogController* print_preview_dialog_controller()
override;
printing::BackgroundPrintingManager* background_printing_manager() override;
IntranetRedirectDetector* intranet_redirect_detector() override;
DownloadStatusUpdater* download_status_updater() override;
DownloadRequestLimiter* download_request_limiter() override;
BackgroundModeManager* background_mode_manager() override;
StatusTray* status_tray() override;
safe_browsing::SafeBrowsingService* safe_browsing_service() override;
subresource_filter::RulesetService* subresource_filter_ruleset_service()
override;
component_updater::ComponentUpdateService* component_updater() override;
MediaFileSystemRegistry* media_file_system_registry() override;
WebRtcLogUploader* webrtc_log_uploader() override;
network_time::NetworkTimeTracker* network_time_tracker() override;
gcm::GCMDriver* gcm_driver() override;
resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
override;
resource_coordinator::TabManager* GetTabManager() override;
SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
HidSystemTrayIcon* hid_system_tray_icon() override;
UsbSystemTrayIcon* usb_system_tray_icon() override;
os_crypt_async::OSCryptAsync* os_crypt_async() override;
void set_additional_os_crypt_async_provider_for_test(
size_t precedence,
std::unique_ptr<os_crypt_async::KeyProvider> provider) override;
void CreateDevToolsProtocolHandler() override {}
void CreateDevToolsAutoOpener() override {}
void set_background_mode_manager_for_test(
std::unique_ptr<BackgroundModeManager> manager) override {}
#if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX))
void StartAutoupdateTimer() override {}
#endif
void SetApplicationLocale(const std::string& locale) override;
const std::string& GetApplicationLocale() override;
printing::PrintJobManager* print_job_manager() override;
StartupData* startup_data() override;
ValueMapPrefStore* in_memory_pref_store() const {
return in_memory_pref_store_.get();
}
private:
void CreateNetworkQualityObserver();
void CreateOSCryptAsync();
network::NetworkQualityTracker* GetNetworkQualityTracker();
#if BUILDFLAG(ENABLE_PRINTING)
std::unique_ptr<printing::PrintJobManager> print_job_manager_;
#endif
std::unique_ptr<PrefService> local_state_;
std::string locale_;
std::string system_locale_;
#if BUILDFLAG(IS_LINUX)
std::string selected_linux_storage_backend_;
#endif
embedder_support::OriginTrialsSettingsStorage origin_trials_settings_storage_;
scoped_refptr<ValueMapPrefStore> in_memory_pref_store_;
scoped_refptr<electron::ResolveProxyHelper> resolve_proxy_helper_;
std::unique_ptr<network::NetworkQualityTracker> network_quality_tracker_;
std::unique_ptr<
network::NetworkQualityTracker::RTTAndThroughputEstimatesObserver>
network_quality_observer_;
std::unique_ptr<os_crypt_async::OSCryptAsync> os_crypt_async_;
};
#endif // ELECTRON_SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_