chore: bump chromium to 96.0.4647.0 (main) (#31302)

* chore: bump chromium in DEPS to 95.0.4630.0

* 3133701: Fix chrome root store codegen for cross-compile builds.

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

* 49125: Include SHA512-256 in EVP_get_digestbyname and EVP_MD_do_all.

https://boringssl-review.googlesource.com/c/boringssl/+/49125

* chore: fixup patch indices

* 3131662: [Code Health] Remove ListValue::Append(Integer|Boolean)

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

* chore: bump chromium in DEPS to 95.0.4631.0

* chore: update patches

* chore: bump chromium in DEPS to 95.0.4635.0

* chore: update patches

* chore: bump chromium in DEPS to 95.0.4636.0

* chore: bump chromium in DEPS to 95.0.4637.0

* chore: update patches

* refactor: move PlatformNotificationService into BrowserContext

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

* refactor: ListValue::GetSize and ListValue::AppendString were removed

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

* chore: bump chromium in DEPS to 95.0.4638.0

* chore: bump chromium in DEPS to 95.0.4638.4

* chore: bump chromium in DEPS to 96.0.4640.0

* chore: bump chromium in DEPS to 96.0.4641.0

* chore: bump chromium in DEPS to 96.0.4642.0

* chore: update patches

Co-authored-by: Michaela Laurencin <mlaurencin@electronjs.org>

* 3134756: Move extensions/browser/value_store to components/value_store.

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

* 3150092: [Autofill] Allow aligning Autofill suggestions to the field's center

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

* chore: bump chromium in DEPS to 96.0.4643.0

* chore: update patches

* chore: bump chromium in DEPS to 96.0.4644.0

* chore: update patches

* chore: bump chromium in DEPS to 96.0.4645.0

* chore: update patches

* chore: bump chromium in DEPS to 96.0.4646.0

* chore: bump chromium in DEPS to 96.0.4647.0

* chore: update patches

Ref (for chromium): https://chromium-review.googlesource.com/c/chromium/src/+/3165772

* 3162087: Reland "Ensure Branch Target Identification is enabled for executable pages."

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

* chore: update evert_add_inline_and_inline_origin_records_to_symbol_file.patch

Xref: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3166678

Xref: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3166674

* chore: update Allocator construction

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

Change RefCount::kAllowed/Disallowed semantics into BackupRefPtr::kEnabled/Disabled

* chore: add UseConfigurablePool to v8::ArrayBuffer::Allocator invocation

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

* chore: do not set network_context_params.context_name

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

Remove name field from mojom::NetworkContext

* fix: use ForEachRenderFrameHost to iterate frames.

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

New implementation partially cribbed from
https://source.chromium.org/chromium/chromium/src/+/main:extensions/browser/script_executor.cc;drc=f894f106c6d5fac8e0b75158f622256e0f34f593;l=109

* Remove WebLocalFrame::RequestExecuteScriptAndReturnValue()

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

ExecuteJavaScript's RequestExecuteScript() new params are cribbed from
https://chromium-review.googlesource.com/c/chromium/src/+/3149699/4/third_party/blink/renderer/core/frame/web_local_frame_impl.cc

* Remove IsDescendantOf API on RenderFrameHost.

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

function is trivial to implement, so make a local copy in anon namespace

* Rewrite IsDescendantOf check to check GetParentOrOuterDocument.

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

* Remove GetFramesInSubtree from RenderFrameHost

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

* fix: dump_syms for macOS

* chore: update patches

* Remove ListValue::AppendString and ListValue::GetSize

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

* fix: gn check

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

* fix: crash with Isolate::GetHeapCodeAndMetadataStatistics

https://chromium-review.googlesource.com/c/v8/v8/+/3175820

* chore: update patches

* chore: fix windows build

* Add kPrintWithPostScriptType42Fonts feature.

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

* chore: update patches

* chore: fix tests

* ozone/x11: fix VA-API.

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

* Revert "ozone/x11: fix VA-API."

This reverts commit 23e742acb1.

* Reland "Make Ozone/X11 default."

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

* fixup Reland "Make Ozone/X11 default."

* fixup Reland "Make Ozone/X11 default." for clipboard

* test: unflake contentTracing test

* Revert "test: unflake contentTracing test"

This reverts commit 62a6525235.

* chore: debug large contentTracing file

* fixup debug patch

* Revert "fixup debug patch"

* Roll Perfetto Trace Processor Linux from b852166f90d5 to e90b9fb93385

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

* update patch after merge

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: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: VerteDinde <khammond@slack-corp.com>
Co-authored-by: Michaela Laurencin <mlaurencin@electronjs.org>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
This commit is contained in:
trop[bot]
2021-10-12 13:56:37 -04:00
committed by GitHub
parent f2696fb431
commit b1366421d1
111 changed files with 687 additions and 2280 deletions

View File

@@ -11,7 +11,7 @@ namespace {
v8::Local<v8::Object> CreateWithSender(v8::Isolate* isolate,
v8::Local<v8::Object> sender) {
return gin_helper::internal::CreateEvent(isolate, sender);
return gin_helper::internal::CreateCustomEvent(isolate, sender);
}
void Initialize(v8::Local<v8::Object> exports,

View File

@@ -994,7 +994,7 @@ void Session::SetSpellCheckerLanguages(
"\" is not a valid language code");
return;
}
language_codes.AppendString(code);
language_codes.Append(code);
}
browser_context_->prefs()->Set(spellcheck::prefs::kSpellCheckDictionaries,
language_codes);

View File

@@ -3674,7 +3674,7 @@ void WebContents::OnDevToolsSearchCompleted(
const std::vector<std::string>& file_paths) {
base::ListValue file_paths_value;
for (const auto& file_path : file_paths) {
file_paths_value.AppendString(file_path);
file_paths_value.Append(file_path);
}
base::Value request_id_value(request_id);
base::Value file_system_path_value(file_system_path);

View File

@@ -290,10 +290,14 @@ std::vector<content::RenderFrameHost*> WebFrameMain::Frames() const {
if (!CheckRenderFrame())
return frame_hosts;
for (auto* rfh : render_frame_->GetFramesInSubtree()) {
if (rfh->GetParent() == render_frame_)
frame_hosts.push_back(rfh);
}
render_frame_->ForEachRenderFrameHost(base::BindRepeating(
[](std::vector<content::RenderFrameHost*>* frame_hosts,
content::RenderFrameHost* current_frame,
content::RenderFrameHost* rfh) {
if (rfh->GetParent() == current_frame)
frame_hosts->push_back(rfh);
},
&frame_hosts, render_frame_));
return frame_hosts;
}
@@ -303,9 +307,10 @@ std::vector<content::RenderFrameHost*> WebFrameMain::FramesInSubtree() const {
if (!CheckRenderFrame())
return frame_hosts;
for (auto* rfh : render_frame_->GetFramesInSubtree()) {
frame_hosts.push_back(rfh);
}
render_frame_->ForEachRenderFrameHost(base::BindRepeating(
[](std::vector<content::RenderFrameHost*>* frame_hosts,
content::RenderFrameHost* rfh) { frame_hosts->push_back(rfh); },
&frame_hosts));
return frame_hosts;
}

View File

@@ -1041,8 +1041,7 @@ NotificationPresenter* ElectronBrowserClient::GetNotificationPresenter() {
}
content::PlatformNotificationService*
ElectronBrowserClient::GetPlatformNotificationService(
content::BrowserContext* browser_context) {
ElectronBrowserClient::GetPlatformNotificationService() {
if (!notification_service_) {
notification_service_ = std::make_unique<PlatformNotificationService>(this);
}

View File

@@ -101,6 +101,8 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
device::GeolocationManager* GetGeolocationManager() override;
content::PlatformNotificationService* GetPlatformNotificationService();
protected:
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
content::SpeechRecognitionManagerDelegate*
@@ -173,8 +175,6 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
content::MediaObserver* GetMediaObserver() override;
std::unique_ptr<content::DevToolsManagerDelegate>
CreateDevToolsManagerDelegate() override;
content::PlatformNotificationService* GetPlatformNotificationService(
content::BrowserContext* browser_context) override;
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
const content::MainFunctionParams&) override;
base::FilePath GetDefaultDownloadDirectory() override;

View File

@@ -223,7 +223,7 @@ void ElectronBrowserContext::InitPrefs() {
base::i18n::GetConfiguredLocale());
if (!default_code.empty()) {
base::ListValue language_codes;
language_codes.AppendString(default_code);
language_codes.Append(default_code);
prefs()->Set(spellcheck::prefs::kSpellCheckDictionaries, language_codes);
}
}
@@ -287,6 +287,11 @@ content::BrowserPluginGuestManager* ElectronBrowserContext::GetGuestManager() {
return guest_manager_.get();
}
content::PlatformNotificationService*
ElectronBrowserContext::GetPlatformNotificationService() {
return ElectronBrowserClient::Get()->GetPlatformNotificationService();
}
content::PermissionControllerDelegate*
ElectronBrowserContext::GetPermissionControllerDelegate() {
if (!permission_manager_.get())

View File

@@ -102,6 +102,8 @@ class ElectronBrowserContext : public content::BrowserContext {
std::string GetMediaDeviceIDSalt() override;
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
content::BrowserPluginGuestManager* GetGuestManager() override;
content::PlatformNotificationService* GetPlatformNotificationService()
override;
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
override;
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;

View File

@@ -431,8 +431,7 @@ int ElectronBrowserMainParts::PreMainMessageLoopRun() {
#endif
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform())
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
#endif
content::WebUIControllerFactory::RegisterFactory(

View File

@@ -30,7 +30,7 @@ class EventEmitterMixin {
v8::Local<v8::Object> wrapper;
if (!static_cast<T*>(this)->GetWrapper(isolate).ToLocal(&wrapper))
return false;
v8::Local<v8::Object> event = internal::CreateEvent(isolate, wrapper);
v8::Local<v8::Object> event = internal::CreateCustomEvent(isolate, wrapper);
return EmitWithEvent(isolate, wrapper, name, event,
std::forward<Args>(args)...);
}

View File

@@ -15,6 +15,7 @@
#include "base/path_service.h"
#include "base/task/post_task.h"
#include "chrome/common/chrome_paths.h"
#include "components/value_store/value_store_factory_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
@@ -33,7 +34,6 @@
#include "extensions/browser/runtime_data.h"
#include "extensions/browser/service_worker_manager.h"
#include "extensions/browser/user_script_manager.h"
#include "extensions/browser/value_store/value_store_factory_impl.h"
#include "extensions/common/constants.h"
#include "extensions/common/file_util.h"
#include "shell/browser/extensions/electron_extension_loader.h"
@@ -63,7 +63,7 @@ std::string GetCryptoTokenManifest() {
ElectronExtensionSystem::ElectronExtensionSystem(
BrowserContext* browser_context)
: browser_context_(browser_context),
store_factory_(base::MakeRefCounted<ValueStoreFactoryImpl>(
store_factory_(base::MakeRefCounted<value_store::ValueStoreFactoryImpl>(
browser_context->GetPath())) {}
ElectronExtensionSystem::~ElectronExtensionSystem() = default;
@@ -185,7 +185,8 @@ StateStore* ElectronExtensionSystem::rules_store() {
return nullptr;
}
scoped_refptr<ValueStoreFactory> ElectronExtensionSystem::store_factory() {
scoped_refptr<value_store::ValueStoreFactory>
ElectronExtensionSystem::store_factory() {
return store_factory_;
}

View File

@@ -13,6 +13,8 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/one_shot_event.h"
#include "components/value_store/value_store_factory.h"
#include "components/value_store/value_store_factory_impl.h"
#include "extensions/browser/extension_system.h"
namespace base {
@@ -63,7 +65,7 @@ class ElectronExtensionSystem : public ExtensionSystem {
UserScriptManager* user_script_manager() override;
StateStore* state_store() override;
StateStore* rules_store() override;
scoped_refptr<ValueStoreFactory> store_factory() override;
scoped_refptr<value_store::ValueStoreFactory> store_factory() override;
InfoMap* info_map() override;
QuotaService* quota_service() override;
AppSorting* app_sorting() override;
@@ -108,7 +110,7 @@ class ElectronExtensionSystem : public ExtensionSystem {
std::unique_ptr<ElectronExtensionLoader> extension_loader_;
scoped_refptr<ValueStoreFactory> store_factory_;
scoped_refptr<value_store::ValueStoreFactory> store_factory_;
// Signaled when the extension system has completed its startup tasks.
base::OneShotEvent ready_;

View File

@@ -533,9 +533,12 @@ void FileSelectHelper::RenderFrameHostChanged(
return;
// The |old_host| and its children are now pending deletion. Do not give them
// file access past this point.
if (render_frame_host_ == old_host ||
render_frame_host_->IsDescendantOf(old_host)) {
render_frame_host_ = nullptr;
for (content::RenderFrameHost* host = render_frame_host_; host;
host = host->GetParentOrOuterDocument()) {
if (host == old_host) {
render_frame_host_ = nullptr;
return;
}
}
}

View File

@@ -76,7 +76,8 @@ class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
base::PartitionOptions::ThreadCache::kDisabled,
base::PartitionOptions::Quarantine::kAllowed,
base::PartitionOptions::Cookie::kAllowed,
base::PartitionOptions::RefCount::kDisallowed});
base::PartitionOptions::BackupRefPtr::kDisabled,
base::PartitionOptions::UseConfigurablePool::kNo});
}
// Allocate() methods return null to signal allocation failure to V8, which

View File

@@ -32,23 +32,23 @@ base::ListValue NSArrayToListValue(NSArray* arr) {
for (id value in arr) {
if ([value isKindOfClass:[NSString class]]) {
result.AppendString(base::SysNSStringToUTF8(value));
result.Append(base::SysNSStringToUTF8(value));
} else if ([value isKindOfClass:[NSNumber class]]) {
const char* objc_type = [value objCType];
if (strcmp(objc_type, @encode(BOOL)) == 0 ||
strcmp(objc_type, @encode(char)) == 0)
result.AppendBoolean([value boolValue]);
result.Append([value boolValue]);
else if (strcmp(objc_type, @encode(double)) == 0 ||
strcmp(objc_type, @encode(float)) == 0)
result.Append([value doubleValue]);
else
result.AppendInteger([value intValue]);
result.Append([value intValue]);
} else if ([value isKindOfClass:[NSArray class]]) {
result.Append(NSArrayToListValue(value));
} else if ([value isKindOfClass:[NSDictionary class]]) {
result.Append(NSDictionaryToDictionaryValue(value));
} else {
result.AppendString(base::SysNSStringToUTF8([value description]));
result.Append(base::SysNSStringToUTF8([value description]));
}
}

View File

@@ -264,15 +264,13 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
options.Get(options::kType, &window_type);
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
// Start monitoring window states.
window_state_watcher_ = std::make_unique<WindowStateWatcher>(this);
// Start monitoring window states.
window_state_watcher_ = std::make_unique<WindowStateWatcher>(this);
// Set _GTK_THEME_VARIANT to dark if we have "dark-theme" option set.
bool use_dark_theme = false;
if (options.Get(options::kDarkTheme, &use_dark_theme) && use_dark_theme) {
SetGTKDarkThemeEnabled(use_dark_theme);
}
// Set _GTK_THEME_VARIANT to dark if we have "dark-theme" option set.
bool use_dark_theme = false;
if (options.Get(options::kDarkTheme, &use_dark_theme) && use_dark_theme) {
SetGTKDarkThemeEnabled(use_dark_theme);
}
#endif
@@ -282,39 +280,37 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
#endif
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
// Before the window is mapped the SetWMSpecState can not work, so we have
// to manually set the _NET_WM_STATE.
std::vector<x11::Atom> state_atom_list;
bool skip_taskbar = false;
if (options.Get(options::kSkipTaskbar, &skip_taskbar) && skip_taskbar) {
state_atom_list.push_back(x11::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
}
// Before the window is mapped, there is no SHOW_FULLSCREEN_STATE.
if (fullscreen) {
state_atom_list.push_back(x11::GetAtom("_NET_WM_STATE_FULLSCREEN"));
}
if (parent) {
// Force using dialog type for child window.
window_type = "dialog";
// Modal window needs the _NET_WM_STATE_MODAL hint.
if (is_modal())
state_atom_list.push_back(x11::GetAtom("_NET_WM_STATE_MODAL"));
}
if (!state_atom_list.empty())
SetArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("_NET_WM_STATE"), x11::Atom::ATOM,
state_atom_list);
// Set the _NET_WM_WINDOW_TYPE.
if (!window_type.empty())
SetWindowType(static_cast<x11::Window>(GetAcceleratedWidget()),
window_type);
// Before the window is mapped the SetWMSpecState can not work, so we have
// to manually set the _NET_WM_STATE.
std::vector<x11::Atom> state_atom_list;
bool skip_taskbar = false;
if (options.Get(options::kSkipTaskbar, &skip_taskbar) && skip_taskbar) {
state_atom_list.push_back(x11::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
}
// Before the window is mapped, there is no SHOW_FULLSCREEN_STATE.
if (fullscreen) {
state_atom_list.push_back(x11::GetAtom("_NET_WM_STATE_FULLSCREEN"));
}
if (parent) {
// Force using dialog type for child window.
window_type = "dialog";
// Modal window needs the _NET_WM_STATE_MODAL hint.
if (is_modal())
state_atom_list.push_back(x11::GetAtom("_NET_WM_STATE_MODAL"));
}
if (!state_atom_list.empty())
SetArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("_NET_WM_STATE"), x11::Atom::ATOM,
state_atom_list);
// Set the _NET_WM_WINDOW_TYPE.
if (!window_type.empty())
SetWindowType(static_cast<x11::Window>(GetAcceleratedWidget()),
window_type);
#endif
#if defined(OS_WIN)
@@ -413,12 +409,10 @@ NativeWindowViews::~NativeWindowViews() {
void NativeWindowViews::SetGTKDarkThemeEnabled(bool use_dark_theme) {
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
const std::string color = use_dark_theme ? "dark" : "light";
x11::SetStringProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("_GTK_THEME_VARIANT"),
x11::GetAtom("UTF8_STRING"), color);
}
const std::string color = use_dark_theme ? "dark" : "light";
x11::SetStringProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("_GTK_THEME_VARIANT"),
x11::GetAtom("UTF8_STRING"), color);
#endif
}
@@ -474,7 +468,7 @@ void NativeWindowViews::Show() {
NotifyWindowShow();
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform() && global_menu_bar_)
if (global_menu_bar_)
global_menu_bar_->OnWindowMapped();
#endif
}
@@ -485,7 +479,7 @@ void NativeWindowViews::ShowInactive() {
NotifyWindowShow();
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform() && global_menu_bar_)
if (global_menu_bar_)
global_menu_bar_->OnWindowMapped();
#endif
}
@@ -499,7 +493,7 @@ void NativeWindowViews::Hide() {
NotifyWindowHide();
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform() && global_menu_bar_)
if (global_menu_bar_)
global_menu_bar_->OnWindowUnmapped();
#endif
@@ -521,9 +515,7 @@ bool NativeWindowViews::IsEnabled() {
return ::IsWindowEnabled(GetAcceleratedWidget());
#elif defined(OS_LINUX)
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
return !event_disabler_.get();
}
return !event_disabler_.get();
#endif
NOTIMPLEMENTED();
return true;
@@ -563,17 +555,15 @@ void NativeWindowViews::SetEnabledInternal(bool enable) {
#if defined(OS_WIN)
::EnableWindow(GetAcceleratedWidget(), enable);
#elif defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
views::DesktopWindowTreeHostPlatform* tree_host =
views::DesktopWindowTreeHostLinux::GetHostForWidget(
GetAcceleratedWidget());
if (enable) {
tree_host->RemoveEventRewriter(event_disabler_.get());
event_disabler_.reset();
} else {
event_disabler_ = std::make_unique<EventDisabler>();
tree_host->AddEventRewriter(event_disabler_.get());
}
views::DesktopWindowTreeHostPlatform* tree_host =
views::DesktopWindowTreeHostLinux::GetHostForWidget(
GetAcceleratedWidget());
if (enable) {
tree_host->RemoveEventRewriter(event_disabler_.get());
event_disabler_.reset();
} else {
event_disabler_ = std::make_unique<EventDisabler>();
tree_host->AddEventRewriter(event_disabler_.get());
}
#endif
}
@@ -786,13 +776,11 @@ bool NativeWindowViews::MoveAbove(const std::string& sourceId) {
0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
#elif defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
if (!IsWindowValid(static_cast<x11::Window>(id.id)))
return false;
if (!IsWindowValid(static_cast<x11::Window>(id.id)))
return false;
electron::MoveWindowAbove(static_cast<x11::Window>(GetAcceleratedWidget()),
static_cast<x11::Window>(id.id));
}
electron::MoveWindowAbove(static_cast<x11::Window>(GetAcceleratedWidget()),
static_cast<x11::Window>(id.id));
#endif
return true;
@@ -808,10 +796,8 @@ void NativeWindowViews::MoveTop() {
size.width(), size.height(),
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
#elif defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
electron::MoveWindowToForeground(
static_cast<x11::Window>(GetAcceleratedWidget()));
}
electron::MoveWindowToForeground(
static_cast<x11::Window>(GetAcceleratedWidget()));
#endif
}
@@ -994,10 +980,8 @@ void NativeWindowViews::SetSkipTaskbar(bool skip) {
taskbar_host_.RestoreThumbarButtons(GetAcceleratedWidget());
}
#elif defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
SetWMSpecState(static_cast<x11::Window>(GetAcceleratedWidget()), skip,
x11::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
}
SetWMSpecState(static_cast<x11::Window>(GetAcceleratedWidget()), skip,
x11::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
#endif
}
@@ -1098,27 +1082,23 @@ void NativeWindowViews::SetIgnoreMouseEvents(bool ignore, bool forward) {
SetForwardMouseMessages(forward);
}
#elif defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
auto* connection = x11::Connection::Get();
if (ignore) {
x11::Rectangle r{0, 0, 1, 1};
connection->shape().Rectangles({
.operation = x11::Shape::So::Set,
.destination_kind = x11::Shape::Sk::Input,
.ordering = x11::ClipOrdering::YXBanded,
.destination_window =
static_cast<x11::Window>(GetAcceleratedWidget()),
.rectangles = {r},
});
} else {
connection->shape().Mask({
.operation = x11::Shape::So::Set,
.destination_kind = x11::Shape::Sk::Input,
.destination_window =
static_cast<x11::Window>(GetAcceleratedWidget()),
.source_bitmap = x11::Pixmap::None,
});
}
auto* connection = x11::Connection::Get();
if (ignore) {
x11::Rectangle r{0, 0, 1, 1};
connection->shape().Rectangles({
.operation = x11::Shape::So::Set,
.destination_kind = x11::Shape::Sk::Input,
.ordering = x11::ClipOrdering::YXBanded,
.destination_window = static_cast<x11::Window>(GetAcceleratedWidget()),
.rectangles = {r},
});
} else {
connection->shape().Mask({
.operation = x11::Shape::So::Set,
.destination_kind = x11::Shape::Sk::Input,
.destination_window = static_cast<x11::Window>(GetAcceleratedWidget()),
.source_bitmap = x11::Pixmap::None,
});
}
#endif
}
@@ -1166,23 +1146,21 @@ bool NativeWindowViews::IsFocusable() {
void NativeWindowViews::SetMenu(ElectronMenuModel* menu_model) {
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
// Remove global menu bar.
if (global_menu_bar_ && menu_model == nullptr) {
global_menu_bar_.reset();
root_view_->UnregisterAcceleratorsWithFocusManager();
return;
}
// Remove global menu bar.
if (global_menu_bar_ && menu_model == nullptr) {
global_menu_bar_.reset();
root_view_->UnregisterAcceleratorsWithFocusManager();
return;
}
// Use global application menu bar when possible.
if (ShouldUseGlobalMenuBar()) {
if (!global_menu_bar_)
global_menu_bar_ = std::make_unique<GlobalMenuBarX11>(this);
if (global_menu_bar_->IsServerStarted()) {
root_view_->RegisterAcceleratorsWithFocusManager(menu_model);
global_menu_bar_->SetMenu(menu_model);
return;
}
// Use global application menu bar when possible.
if (ShouldUseGlobalMenuBar()) {
if (!global_menu_bar_)
global_menu_bar_ = std::make_unique<GlobalMenuBarX11>(this);
if (global_menu_bar_->IsServerStarted()) {
root_view_->RegisterAcceleratorsWithFocusManager(menu_model);
global_menu_bar_->SetMenu(menu_model);
return;
}
}
#endif
@@ -1264,13 +1242,11 @@ void NativeWindowViews::SetParentWindow(NativeWindow* parent) {
NativeWindow::SetParentWindow(parent);
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
x11::SetProperty(
static_cast<x11::Window>(GetAcceleratedWidget()),
x11::Atom::WM_TRANSIENT_FOR, x11::Atom::WINDOW,
parent ? static_cast<x11::Window>(parent->GetAcceleratedWidget())
: ui::GetX11RootWindow());
}
x11::SetProperty(
static_cast<x11::Window>(GetAcceleratedWidget()),
x11::Atom::WM_TRANSIENT_FOR, x11::Atom::WINDOW,
parent ? static_cast<x11::Window>(parent->GetAcceleratedWidget())
: ui::GetX11RootWindow());
#elif defined(OS_WIN)
// To set parentship between windows into Windows is better to play with the
// owner instead of the parent, as Windows natively seems to do if a parent
@@ -1349,18 +1325,17 @@ void NativeWindowViews::SetVisibleOnAllWorkspaces(
bool NativeWindowViews::IsVisibleOnAllWorkspaces() {
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
// Use the presence/absence of _NET_WM_STATE_STICKY in _NET_WM_STATE to
// determine whether the current window is visible on all workspaces.
x11::Atom sticky_atom = x11::GetAtom("_NET_WM_STATE_STICKY");
std::vector<x11::Atom> wm_states;
GetArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("_NET_WM_STATE"), &wm_states);
return std::find(wm_states.begin(), wm_states.end(), sticky_atom) !=
wm_states.end();
}
#endif
// Use the presence/absence of _NET_WM_STATE_STICKY in _NET_WM_STATE to
// determine whether the current window is visible on all workspaces.
x11::Atom sticky_atom = x11::GetAtom("_NET_WM_STATE_STICKY");
std::vector<x11::Atom> wm_states;
GetArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
x11::GetAtom("_NET_WM_STATE"), &wm_states);
return std::find(wm_states.begin(), wm_states.end(), sticky_atom) !=
wm_states.end();
#else
return false;
#endif
}
content::DesktopMediaID NativeWindowViews::GetDesktopMediaID() const {

View File

@@ -342,8 +342,6 @@ SystemNetworkContextManager::CreateNetworkContextParams() {
network::mojom::NetworkContextParamsPtr network_context_params =
CreateDefaultNetworkContextParams();
network_context_params->context_name = std::string("system");
network_context_params->user_agent =
electron::ElectronBrowserClient::Get()->GetUserAgent();

View File

@@ -6,8 +6,10 @@
#include <memory>
#include <vector>
#include "base/feature_list.h"
#include "base/i18n/rtl.h"
#include "chrome/browser/ui/views/autofill/autofill_popup_view_utils.h"
#include "components/autofill/core/common/autofill_features.h"
#include "electron/buildflags/buildflags.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "shell/browser/native_window_views.h"
@@ -114,8 +116,18 @@ void AutofillPopup::UpdatePopupBounds() {
gfx::Size preferred_size =
gfx::Size(GetDesiredPopupWidth(), GetDesiredPopupHeight());
popup_bounds_ = CalculatePopupBounds(preferred_size, window_bounds, bounds,
base::i18n::IsRTL());
if (base::FeatureList::IsEnabled(
autofill::features::kAutofillCenterAlignedSuggestions)) {
popup_bounds_ = CalculatePopupBounds(preferred_size, window_bounds, bounds,
base::i18n::IsRTL(), true);
CalculatePopupXAndWidthHorizontallyCentered(
preferred_size.width(), window_bounds, element_bounds_,
base::i18n::IsRTL(), &popup_bounds_);
} else {
popup_bounds_ = CalculatePopupBounds(preferred_size, window_bounds, bounds,
base::i18n::IsRTL(), false);
}
}
gfx::Rect AutofillPopup::popup_bounds_in_view() {

View File

@@ -244,13 +244,11 @@ class FileChooserDialog {
gtk_widget_show_all(GTK_WIDGET(dialog_));
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
// We need to call gtk_window_present after making the widgets visible
// to make sure window gets correctly raised and gets focus.
x11::Time time = ui::X11EventSource::GetInstance()->GetTimestamp();
gtk_window_present_with_time(GTK_WINDOW(dialog_),
static_cast<uint32_t>(time));
}
// We need to call gtk_window_present after making the widgets visible
// to make sure window gets correctly raised and gets focus.
x11::Time time = ui::X11EventSource::GetInstance()->GetTimestamp();
gtk_window_present_with_time(GTK_WINDOW(dialog_),
static_cast<uint32_t>(time));
#endif
}
}

View File

@@ -226,14 +226,12 @@ void BuildSubmenuFromModel(ui::MenuModel* model,
}
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
ui::Accelerator accelerator;
if (model->GetAcceleratorAt(i, &accelerator)) {
gtk_widget_add_accelerator(menu_item, "activate", nullptr,
GetGdkKeyCodeForAccelerator(accelerator),
GetGdkModifierForAccelerator(accelerator),
GTK_ACCEL_VISIBLE);
}
ui::Accelerator accelerator;
if (model->GetAcceleratorAt(i, &accelerator)) {
gtk_widget_add_accelerator(menu_item, "activate", nullptr,
GetGdkKeyCodeForAccelerator(accelerator),
GetGdkModifierForAccelerator(accelerator),
GTK_ACCEL_VISIBLE);
}
#endif

View File

@@ -159,13 +159,11 @@ class GtkMessageBox : public NativeWindowObserver {
gtk_widget_show(dialog_);
#if defined(USE_X11)
if (!features::IsUsingOzonePlatform()) {
// We need to call gtk_window_present after making the widgets visible to
// make sure window gets correctly raised and gets focus.
x11::Time time = ui::X11EventSource::GetInstance()->GetTimestamp();
gtk_window_present_with_time(GTK_WINDOW(dialog_),
static_cast<uint32_t>(time));
}
// We need to call gtk_window_present after making the widgets visible to
// make sure window gets correctly raised and gets focus.
x11::Time time = ui::X11EventSource::GetInstance()->GetTimestamp();
gtk_window_present_with_time(GTK_WINDOW(dialog_),
static_cast<uint32_t>(time));
#endif
}

View File

@@ -133,11 +133,11 @@ void WebContentsPermissionHelper::RequestMediaAccessPermission(
auto media_types = std::make_unique<base::ListValue>();
if (request.audio_type ==
blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE) {
media_types->AppendString("audio");
media_types->Append("audio");
}
if (request.video_type ==
blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE) {
media_types->AppendString("video");
media_types->Append("video");
}
details.SetList("mediaTypes", std::move(media_types));