mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
chore: bump chromium to 141.0.7390.7 (main) (#48212)
* chore: bump chromium in DEPS to 141.0.7381.3 * chore: update patches * chore: bump chromium in DEPS to 141.0.7382.0 * chore: update patches * chore: bump chromium in DEPS to 141.0.7384.0 * chore: bump chromium in DEPS to 141.0.7386.0 * [Extensions] Move devtools_page and chrome_url_overrides handlers Refs https://chromium-review.googlesource.com/c/chromium/src/+/6862700 * Reland "[api] Advance deprecation of GetIsolate" Refs https://chromium-review.googlesource.com/c/v8/v8/+/6875273 * Move "system integrated UI" concept out of NativeTheme. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6867375 * chore: update patches * Reland "[PermissionOptions] Return PermissionResult in callback for requests" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6851838 * Reland "[exit-time-destructors] Enable by default" Refs https://chromium-review.googlesource.com/c/chromium/src/+/6859042 * chore: update patches * [FSA] Revoke Read access after removing file via FileSystemAccess API Refs https://chromium-review.googlesource.com/c/chromium/src/+/6677249 * chore: IWYU * [DevToolsUIBindings] Accept an object for `dispatchHttpRequest` params Refs https://chromium-review.googlesource.com/c/chromium/src/+/6877528 * chore: IWYU * Pass navigation UI parameters on EnterFullscreen in EAM Refs https://chromium-review.googlesource.com/c/chromium/src/+/6874923 * chore: rm band-aid_over_an_issue_with_using_deprecated_nsopenpanel_api.patch * Remove unused PreHandleMouseEvent Refs https://chromium-review.googlesource.com/c/chromium/src/+/6880411 * 6878583: siso: update to version 1.4.1 https://chromium-review.googlesource.com/c/chromium/src/+/6878583 * Fold native_theme_browser into native_theme. https://chromium-review.googlesource.com/c/chromium/src/+/6882627 * fixup: Reland "[exit-time-destructors] Enable by default https://chromium-review.googlesource.com/c/chromium/src/+/6859042 * chore: update filenames.libcxx.gni * chore: IWYU * fixup: chore: IWYU * fixup: Reland "[exit-time-destructors] Enable by default * fixup: Reland "[exit-time-destructors] Enable by default * Remove common_theme.*; place its method in NativeTheme instead. https://chromium-review.googlesource.com/c/chromium/src/+/6886029 * fixup: Reland "[exit-time-destructors] Enable by default * Better track when WebPreferences need updates for color-related changes. Refs https://chromium-review.googlesource.com/c/chromium/src/+/6886797 * chore: bump chromium in DEPS to 141.0.7390.7 * 6904664: Reland "Make BrowserContext::GetPath() const" https://chromium-review.googlesource.com/c/chromium/src/+/6904664 * Restore read access after certain file modification operations https://chromium-review.googlesource.com/c/chromium/src/+/6861041 * fixup: Move "system integrated UI" concept out of NativeTheme. * fixup: Reland "[exit-time-destructors] Enable by default * chore: update patches * 6906096: Remove GetSysSkColor(). https://chromium-review.googlesource.com/c/chromium/src/+/6906096 * Inline implementation of SysColorChangeListener into the lone user. https://chromium-review.googlesource.com/c/chromium/src/+/6905083 Also 6906096: Remove GetSysSkColor(). | https://chromium-review.googlesource.com/c/chromium/src/+/6906096 * fixup: 6906096: Remove GetSysSkColor() --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
committed by
GitHub
parent
1f322ebce3
commit
793565e4be
@@ -369,9 +369,6 @@ namespace electron::api {
|
||||
gin::WrapperInfo App::kWrapperInfo = {{gin::kEmbedderNativeGin},
|
||||
gin::kElectronApp};
|
||||
|
||||
// static
|
||||
cppgc::Persistent<App> App::instance_;
|
||||
|
||||
namespace {
|
||||
|
||||
IconLoader::IconSize GetIconSizeByString(const std::string& size) {
|
||||
@@ -1701,17 +1698,15 @@ void ConfigureHostResolver(v8::Isolate* isolate,
|
||||
|
||||
// static
|
||||
App* App::Get() {
|
||||
CHECK_NE(instance_, nullptr);
|
||||
return instance_.Get();
|
||||
return Create(nullptr);
|
||||
}
|
||||
|
||||
// static
|
||||
App* App::Create(v8::Isolate* isolate) {
|
||||
if (!instance_) {
|
||||
instance_ = cppgc::MakeGarbageCollected<App>(
|
||||
isolate->GetCppHeap()->GetAllocationHandle());
|
||||
}
|
||||
return instance_.Get();
|
||||
static base::NoDestructor<cppgc::Persistent<App>> instance(
|
||||
cppgc::MakeGarbageCollected<App>(
|
||||
isolate->GetCppHeap()->GetAllocationHandle()));
|
||||
return instance->Get();
|
||||
}
|
||||
|
||||
const gin::WrapperInfo* App::wrapper_info() const {
|
||||
|
||||
@@ -282,8 +282,6 @@ class App final : public gin::Wrappable<App>,
|
||||
bool watch_singleton_socket_on_ready_ = false;
|
||||
|
||||
std::unique_ptr<content::ScopedAccessibilityMode> scoped_accessibility_mode_;
|
||||
|
||||
static cppgc::Persistent<App> instance_;
|
||||
};
|
||||
|
||||
} // namespace api
|
||||
|
||||
@@ -25,6 +25,12 @@ NativeTheme::NativeTheme(v8::Isolate* isolate,
|
||||
ui::NativeTheme* web_theme)
|
||||
: ui_theme_(ui_theme), web_theme_(web_theme) {
|
||||
ui_theme_->AddObserver(this);
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
std::ignore = hkcu_themes_regkey_.Open(HKEY_CURRENT_USER,
|
||||
L"Software\\Microsoft\\Windows\\"
|
||||
L"CurrentVersion\\Themes\\Personalize",
|
||||
KEY_READ);
|
||||
#endif
|
||||
}
|
||||
|
||||
NativeTheme::~NativeTheme() {
|
||||
@@ -32,6 +38,16 @@ NativeTheme::~NativeTheme() {
|
||||
}
|
||||
|
||||
void NativeTheme::OnNativeThemeUpdatedOnUI() {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
if (hkcu_themes_regkey_.Valid()) {
|
||||
DWORD system_uses_light_theme = 1;
|
||||
hkcu_themes_regkey_.ReadValueDW(L"SystemUsesLightTheme",
|
||||
&system_uses_light_theme);
|
||||
bool system_dark_mode_enabled = (system_uses_light_theme == 0);
|
||||
should_use_dark_colors_for_system_integrated_ui_ =
|
||||
std::make_optional<bool>(system_dark_mode_enabled);
|
||||
}
|
||||
#endif
|
||||
Emit("updated");
|
||||
}
|
||||
|
||||
@@ -65,7 +81,8 @@ bool NativeTheme::ShouldUseHighContrastColors() {
|
||||
}
|
||||
|
||||
bool NativeTheme::ShouldUseDarkColorsForSystemIntegratedUI() {
|
||||
return ui_theme_->ShouldUseDarkColorsForSystemIntegratedUI();
|
||||
return should_use_dark_colors_for_system_integrated_ui_.value_or(
|
||||
ShouldUseDarkColors());
|
||||
}
|
||||
|
||||
bool NativeTheme::InForcedColorsMode() {
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
#include "ui/native_theme/native_theme.h"
|
||||
#include "ui/native_theme/native_theme_observer.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "base/win/registry.h"
|
||||
#endif
|
||||
|
||||
namespace gin_helper {
|
||||
template <typename T>
|
||||
class Handle;
|
||||
@@ -58,6 +62,11 @@ class NativeTheme final : public gin_helper::DeprecatedWrappable<NativeTheme>,
|
||||
void OnNativeThemeUpdatedOnUI();
|
||||
|
||||
private:
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
base::win::RegKey hkcu_themes_regkey_;
|
||||
#endif
|
||||
std::optional<bool> should_use_dark_colors_for_system_integrated_ui_ =
|
||||
std::nullopt;
|
||||
raw_ptr<ui::NativeTheme> ui_theme_;
|
||||
raw_ptr<ui::NativeTheme> web_theme_;
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "content/common/url_schemes.h"
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "gin/object_template_builder.h"
|
||||
@@ -28,15 +29,6 @@
|
||||
|
||||
namespace {
|
||||
|
||||
// List of registered custom standard schemes.
|
||||
std::vector<std::string> g_standard_schemes;
|
||||
|
||||
// List of registered custom streaming schemes.
|
||||
std::vector<std::string> g_streaming_schemes;
|
||||
|
||||
// Schemes that support V8 code cache.
|
||||
std::vector<std::string> g_code_cache_schemes;
|
||||
|
||||
struct SchemeOptions {
|
||||
bool standard = false;
|
||||
bool secure = false;
|
||||
@@ -89,12 +81,19 @@ namespace electron::api {
|
||||
|
||||
gin::DeprecatedWrapperInfo Protocol::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||
|
||||
const std::vector<std::string>& GetStandardSchemes() {
|
||||
return g_standard_schemes;
|
||||
std::vector<std::string>& GetStandardSchemes() {
|
||||
static base::NoDestructor<std::vector<std::string>> g_standard_schemes;
|
||||
return *g_standard_schemes;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& GetCodeCacheSchemes() {
|
||||
return g_code_cache_schemes;
|
||||
std::vector<std::string>& GetCodeCacheSchemes() {
|
||||
static base::NoDestructor<std::vector<std::string>> g_code_cache_schemes;
|
||||
return *g_code_cache_schemes;
|
||||
}
|
||||
|
||||
std::vector<std::string>& GetStreamingSchemes() {
|
||||
static base::NoDestructor<std::vector<std::string>> g_streaming_schemes;
|
||||
return *g_streaming_schemes;
|
||||
}
|
||||
|
||||
void AddServiceWorkerScheme(const std::string& scheme) {
|
||||
@@ -132,7 +131,7 @@ void RegisterSchemesAsPrivileged(gin_helper::ErrorThrower thrower,
|
||||
auto* policy = content::ChildProcessSecurityPolicy::GetInstance();
|
||||
url::AddStandardScheme(custom_scheme.scheme.c_str(),
|
||||
url::SCHEME_WITH_HOST);
|
||||
g_standard_schemes.push_back(custom_scheme.scheme);
|
||||
GetStandardSchemes().push_back(custom_scheme.scheme);
|
||||
policy->RegisterWebSafeScheme(custom_scheme.scheme);
|
||||
}
|
||||
if (custom_scheme.options.secure) {
|
||||
@@ -155,10 +154,10 @@ void RegisterSchemesAsPrivileged(gin_helper::ErrorThrower thrower,
|
||||
AddServiceWorkerScheme(custom_scheme.scheme);
|
||||
}
|
||||
if (custom_scheme.options.stream) {
|
||||
g_streaming_schemes.push_back(custom_scheme.scheme);
|
||||
GetStreamingSchemes().push_back(custom_scheme.scheme);
|
||||
}
|
||||
if (custom_scheme.options.codeCache) {
|
||||
g_code_cache_schemes.push_back(custom_scheme.scheme);
|
||||
GetCodeCacheSchemes().push_back(custom_scheme.scheme);
|
||||
url::AddCodeCacheScheme(custom_scheme.scheme.c_str());
|
||||
}
|
||||
}
|
||||
@@ -181,11 +180,11 @@ void RegisterSchemesAsPrivileged(gin_helper::ErrorThrower thrower,
|
||||
AppendSchemesToCmdLine(electron::switches::kServiceWorkerSchemes,
|
||||
service_worker_schemes);
|
||||
AppendSchemesToCmdLine(electron::switches::kStandardSchemes,
|
||||
g_standard_schemes);
|
||||
GetStandardSchemes());
|
||||
AppendSchemesToCmdLine(electron::switches::kStreamingSchemes,
|
||||
g_streaming_schemes);
|
||||
GetStreamingSchemes());
|
||||
AppendSchemesToCmdLine(electron::switches::kCodeCacheSchemes,
|
||||
g_code_cache_schemes);
|
||||
GetCodeCacheSchemes());
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -29,8 +29,8 @@ class ProtocolRegistry;
|
||||
|
||||
namespace api {
|
||||
|
||||
const std::vector<std::string>& GetStandardSchemes();
|
||||
const std::vector<std::string>& GetCodeCacheSchemes();
|
||||
std::vector<std::string>& GetStandardSchemes();
|
||||
std::vector<std::string>& GetCodeCacheSchemes();
|
||||
|
||||
void AddServiceWorkerScheme(const std::string& scheme);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/values.h"
|
||||
#include "shell/browser/event_emitter_mixin.h"
|
||||
#include "shell/common/gin_helper/wrappable.h"
|
||||
@@ -15,7 +16,7 @@
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/browser/browser_observer.h"
|
||||
#include "ui/gfx/sys_color_change_listener.h"
|
||||
#include "ui/gfx/win/singleton_hwnd_observer.h"
|
||||
#endif
|
||||
|
||||
namespace gin_helper {
|
||||
@@ -42,8 +43,7 @@ class SystemPreferences final
|
||||
public gin_helper::EventEmitterMixin<SystemPreferences>
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
,
|
||||
public BrowserObserver,
|
||||
public gfx::SysColorChangeListener
|
||||
public BrowserObserver
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
@@ -65,8 +65,8 @@ class SystemPreferences final
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
void InitializeWindow();
|
||||
|
||||
// gfx::SysColorChangeListener:
|
||||
void OnSysColorChange() override;
|
||||
// Called by `singleton_hwnd_observer_`.
|
||||
void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
// BrowserObserver:
|
||||
void OnFinishLaunching(base::Value::Dict launch_info) override;
|
||||
@@ -159,7 +159,8 @@ class SystemPreferences final
|
||||
|
||||
std::string current_color_;
|
||||
|
||||
std::unique_ptr<gfx::ScopedSysColorChangeListener> color_change_listener_;
|
||||
// Color/high contrast mode change observer.
|
||||
std::unique_ptr<gfx::SingletonHwndObserver> singleton_hwnd_observer_;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "base/apple/scoped_cftyperef.h"
|
||||
#include "base/containers/flat_map.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/values.h"
|
||||
@@ -80,7 +81,10 @@ namespace {
|
||||
int g_next_id = 0;
|
||||
|
||||
// The map to convert |id| to |int|.
|
||||
base::flat_map<int, id> g_id_map;
|
||||
auto& GetIdMap() {
|
||||
static base::NoDestructor<base::flat_map<int, id>> g_id_map;
|
||||
return *g_id_map;
|
||||
}
|
||||
|
||||
AVMediaType ParseMediaType(const std::string& media_type) {
|
||||
if (media_type == "camera") {
|
||||
@@ -214,7 +218,7 @@ int SystemPreferences::DoSubscribeNotification(
|
||||
|
||||
auto* name = maybe_name->IsNull() ? nil : base::SysUTF8ToNSString(name_str);
|
||||
|
||||
g_id_map[request_id] = [GetNotificationCenter(kind)
|
||||
GetIdMap()[request_id] = [GetNotificationCenter(kind)
|
||||
addObserverForName:name
|
||||
object:nil
|
||||
queue:nil
|
||||
@@ -240,11 +244,11 @@ int SystemPreferences::DoSubscribeNotification(
|
||||
|
||||
void SystemPreferences::DoUnsubscribeNotification(int request_id,
|
||||
NotificationCenterKind kind) {
|
||||
auto iter = g_id_map.find(request_id);
|
||||
if (iter != g_id_map.end()) {
|
||||
auto iter = GetIdMap().find(request_id);
|
||||
if (iter != GetIdMap().end()) {
|
||||
id observer = iter->second;
|
||||
[GetNotificationCenter(kind) removeObserver:observer];
|
||||
g_id_map.erase(iter);
|
||||
GetIdMap().erase(iter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "base/win/wrapped_window_proc.h"
|
||||
#include "shell/common/color_util.h"
|
||||
#include "shell/common/process_util.h"
|
||||
#include "ui/gfx/color_utils.h"
|
||||
#include "ui/gfx/win/hwnd_util.h"
|
||||
|
||||
namespace electron {
|
||||
@@ -127,7 +126,7 @@ std::string SystemPreferences::GetColor(gin_helper::ErrorThrower thrower,
|
||||
});
|
||||
|
||||
if (auto iter = Lookup.find(color); iter != Lookup.end())
|
||||
return ToRGBAHex(color_utils::GetSysSkColor(iter->second));
|
||||
return ToRGBAHex(GetSysSkColor(iter->second));
|
||||
|
||||
thrower.ThrowError("Unknown color: " + color);
|
||||
return "";
|
||||
@@ -158,8 +157,9 @@ void SystemPreferences::InitializeWindow() {
|
||||
// Creating this listener before the app is ready causes global shortcuts
|
||||
// to not fire
|
||||
if (Browser::Get()->is_ready())
|
||||
color_change_listener_ =
|
||||
std::make_unique<gfx::ScopedSysColorChangeListener>(this);
|
||||
singleton_hwnd_observer_ =
|
||||
std::make_unique<gfx::SingletonHwndObserver>(base::BindRepeating(
|
||||
&SystemPreferences::OnWndProc, base::Unretained(this)));
|
||||
else
|
||||
Browser::Get()->AddObserver(this);
|
||||
|
||||
@@ -208,13 +208,21 @@ LRESULT CALLBACK SystemPreferences::WndProc(HWND hwnd,
|
||||
return ::DefWindowProc(hwnd, message, wparam, lparam);
|
||||
}
|
||||
|
||||
void SystemPreferences::OnSysColorChange() {
|
||||
void SystemPreferences::OnWndProc(HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam) {
|
||||
if (message != WM_SYSCOLORCHANGE &&
|
||||
(message != WM_SETTINGCHANGE || wparam != SPI_SETHIGHCONTRAST)) {
|
||||
return;
|
||||
}
|
||||
Emit("color-changed");
|
||||
}
|
||||
|
||||
void SystemPreferences::OnFinishLaunching(base::Value::Dict launch_info) {
|
||||
color_change_listener_ =
|
||||
std::make_unique<gfx::ScopedSysColorChangeListener>(this);
|
||||
singleton_hwnd_observer_ =
|
||||
std::make_unique<gfx::SingletonHwndObserver>(base::BindRepeating(
|
||||
&SystemPreferences::OnWndProc, base::Unretained(this)));
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
||||
@@ -1434,7 +1434,7 @@ bool WebContents::IsFullscreen() const {
|
||||
|
||||
void WebContents::EnterFullscreen(const url::Origin& origin,
|
||||
ExclusiveAccessBubbleType bubble_type,
|
||||
const int64_t display_id) {}
|
||||
FullscreenTabParams fullscreen_tab_params) {}
|
||||
|
||||
content::WebContents* WebContents::GetWebContentsForExclusiveAccess() {
|
||||
return web_contents();
|
||||
@@ -1480,7 +1480,7 @@ void WebContents::OnEnterFullscreenModeForTab(
|
||||
owner_window()->set_fullscreen_transition_type(
|
||||
NativeWindow::FullScreenTransitionType::kHTML);
|
||||
exclusive_access_manager_.fullscreen_controller()->EnterFullscreenModeForTab(
|
||||
requesting_frame, options.display_id);
|
||||
requesting_frame, FullscreenTabParams{options.display_id});
|
||||
|
||||
SetHtmlApiFullscreen(true);
|
||||
|
||||
|
||||
@@ -697,7 +697,7 @@ class WebContents final : public ExclusiveAccessContext,
|
||||
bool IsFullscreen() const override;
|
||||
void EnterFullscreen(const url::Origin& origin,
|
||||
ExclusiveAccessBubbleType bubble_type,
|
||||
const int64_t display_id) override;
|
||||
FullscreenTabParams fullscreen_tab_params) override;
|
||||
void ExitFullscreen() override {}
|
||||
void UpdateExclusiveAccessBubble(
|
||||
const ExclusiveAccessBubbleParams& params,
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "content/public/browser/page.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
|
||||
Reference in New Issue
Block a user