mirror of
https://github.com/electron/electron.git
synced 2026-05-02 03:00:22 -04:00
chore: bump chromium to 7264889ce3aad1568ff3d211c81fe (master) (#27003)
* chore: bump chromium in DEPS to 91c9f44297abe2844f593ec7956e6ce79c81f463 * chore: update chromium patches * chore: update v8 patches * build: service_names.mojom has been deleted Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2568681 * chore: add DISPLAY_CAPTURE permission to converter Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2551098 * chore: handle AXPropertyFilter::SCRIPT in accessibility_ui Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2563923 * refactor: web_isolated_world_ids.h has been deleted Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2585255 * refactor: ResourceType has been deprecated / removed in ExtensionsBrowserClient Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2562002 * chore: fix lint * chore: remove deleted headers * build: disable gn check for blink header * fix: refactor X11 event handling Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2577887 Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2585750 * chore: update patches * chore: bump chromium in DEPS to bfd8e7dbd37af8b1bc40d887815edd5a29496fa3 * chore: update patches * refactor: xeventobserver is now x11:eventobserver Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2585750 * refactor: remove UseWebUIBindingsForURL Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2583590 * chore: DidProcessXEvent has been removed * chore: bump chromium in DEPS to b13e791d7244a08d9d61dbfa2bb2b6cdf1ff6294 * chore: update patches * build: change gfx::GetAtom to x11:GetAtom Refs:d972a0ae4a* build: change gfx namespace to x11 Ref:d972a0ae4a* build: change ui namespace to x11 Refs:c38f8571a8:ui/gfx/x/xproto_util.h;dlc=ba9145d0c7f2b10e869e2ba482ca05b75ca35812 * chore: add patch to fix blink prefs fetching during frame swap * chore: fix lint * fix: do not make invalid SKImageRep in FrameSubscriber Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2572896 Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
This commit is contained in:
@@ -161,8 +161,7 @@ void FrameSubscriber::Done(const gfx::Rect& damage, const SkBitmap& frame) {
|
||||
// frame is modified.
|
||||
SkBitmap copy;
|
||||
copy.allocPixels(SkImageInfo::Make(bitmap.width(), bitmap.height(),
|
||||
kRGBA_8888_SkColorType,
|
||||
kPremul_SkAlphaType));
|
||||
kN32_SkColorType, kPremul_SkAlphaType));
|
||||
SkPixmap pixmap;
|
||||
bool success = bitmap.peekPixels(&pixmap) && copy.writePixels(pixmap, 0, 0);
|
||||
CHECK(success);
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "content/public/common/content_descriptors.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/service_names.mojom.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
#include "electron/grit/electron_resources.h"
|
||||
|
||||
@@ -40,12 +40,6 @@ bool ElectronWebUIControllerFactory::UseWebUIForURL(
|
||||
return GetWebUIType(browser_context, url) != content::WebUI::kNoWebUI;
|
||||
}
|
||||
|
||||
bool ElectronWebUIControllerFactory::UseWebUIBindingsForURL(
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& url) {
|
||||
return UseWebUIForURL(browser_context, url);
|
||||
}
|
||||
|
||||
std::unique_ptr<content::WebUIController>
|
||||
ElectronWebUIControllerFactory::CreateWebUIControllerForURL(
|
||||
content::WebUI* web_ui,
|
||||
|
||||
@@ -26,8 +26,6 @@ class ElectronWebUIControllerFactory : public content::WebUIControllerFactory {
|
||||
const GURL& url) override;
|
||||
bool UseWebUIForURL(content::BrowserContext* browser_context,
|
||||
const GURL& url) override;
|
||||
bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
|
||||
const GURL& url) override;
|
||||
std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(
|
||||
content::WebUI* web_ui,
|
||||
const GURL& url) override;
|
||||
|
||||
@@ -179,17 +179,18 @@ void ElectronExtensionsBrowserClient::LoadResourceFromResourceBundle(
|
||||
}
|
||||
|
||||
namespace {
|
||||
bool AllowCrossRendererResourceLoad(const network::ResourceRequest& request,
|
||||
blink::mojom::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
const extensions::Extension* extension,
|
||||
const extensions::ExtensionSet& extensions,
|
||||
const extensions::ProcessMap& process_map,
|
||||
bool* allowed) {
|
||||
bool AllowCrossRendererResourceLoad(
|
||||
const network::ResourceRequest& request,
|
||||
network::mojom::RequestDestination destination,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
const extensions::Extension* extension,
|
||||
const extensions::ExtensionSet& extensions,
|
||||
const extensions::ProcessMap& process_map,
|
||||
bool* allowed) {
|
||||
if (extensions::url_request_util::AllowCrossRendererResourceLoad(
|
||||
request, resource_type, page_transition, child_id, is_incognito,
|
||||
request, destination, page_transition, child_id, is_incognito,
|
||||
extension, extensions, process_map, allowed)) {
|
||||
return true;
|
||||
}
|
||||
@@ -210,7 +211,7 @@ bool AllowCrossRendererResourceLoad(const network::ResourceRequest& request,
|
||||
|
||||
bool ElectronExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
const network::ResourceRequest& request,
|
||||
blink::mojom::ResourceType resource_type,
|
||||
network::mojom::RequestDestination destination,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
@@ -219,7 +220,7 @@ bool ElectronExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
const extensions::ProcessMap& process_map) {
|
||||
bool allowed = false;
|
||||
if (::electron::AllowCrossRendererResourceLoad(
|
||||
request, resource_type, page_transition, child_id, is_incognito,
|
||||
request, destination, page_transition, child_id, is_incognito,
|
||||
extension, extensions, process_map, &allowed)) {
|
||||
return allowed;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "extensions/browser/extensions_browser_client.h"
|
||||
#include "extensions/browser/kiosk/kiosk_delegate.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
|
||||
#include "services/network/public/mojom/fetch_api.mojom.h"
|
||||
|
||||
class PrefService;
|
||||
|
||||
@@ -71,7 +71,7 @@ class ElectronExtensionsBrowserClient
|
||||
bool send_cors_header) override;
|
||||
bool AllowCrossRendererResourceLoad(
|
||||
const network::ResourceRequest& request,
|
||||
blink::mojom::ResourceType resource_type,
|
||||
network::mojom::RequestDestination destination,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
#include "ui/gfx/x/shape.h"
|
||||
#include "ui/gfx/x/x11_atom_cache.h"
|
||||
#include "ui/gfx/x/xproto.h"
|
||||
#include "ui/gfx/x/xproto_util.h"
|
||||
#endif
|
||||
|
||||
#if defined(USE_OZONE) || defined(USE_X11)
|
||||
@@ -244,12 +245,12 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
|
||||
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(gfx::GetAtom("_NET_WM_STATE_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(gfx::GetAtom("_NET_WM_STATE_FULLSCREEN"));
|
||||
state_atom_list.push_back(x11::GetAtom("_NET_WM_STATE_FULLSCREEN"));
|
||||
}
|
||||
|
||||
if (parent) {
|
||||
@@ -258,7 +259,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
|
||||
|
||||
// Modal window needs the _NET_WM_STATE_MODAL hint.
|
||||
if (is_modal())
|
||||
state_atom_list.push_back(gfx::GetAtom("_NET_WM_STATE_MODAL"));
|
||||
state_atom_list.push_back(x11::GetAtom("_NET_WM_STATE_MODAL"));
|
||||
}
|
||||
|
||||
if (!state_atom_list.empty())
|
||||
@@ -353,9 +354,9 @@ void NativeWindowViews::SetGTKDarkThemeEnabled(bool use_dark_theme) {
|
||||
#if defined(USE_X11)
|
||||
if (!features::IsUsingOzonePlatform()) {
|
||||
const std::string color = use_dark_theme ? "dark" : "light";
|
||||
ui::SetStringProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
|
||||
gfx::GetAtom("_GTK_THEME_VARIANT"),
|
||||
gfx::GetAtom("UTF8_STRING"), color);
|
||||
x11::SetStringProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
|
||||
x11::GetAtom("_GTK_THEME_VARIANT"),
|
||||
x11::GetAtom("UTF8_STRING"), color);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -926,7 +927,7 @@ void NativeWindowViews::SetSkipTaskbar(bool skip) {
|
||||
#elif defined(USE_X11)
|
||||
if (!features::IsUsingOzonePlatform()) {
|
||||
SetWMSpecState(static_cast<x11::Window>(GetAcceleratedWidget()), skip,
|
||||
gfx::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
|
||||
x11::GetAtom("_NET_WM_STATE_SKIP_TASKBAR"));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1156,7 +1157,7 @@ void NativeWindowViews::SetParentWindow(NativeWindow* parent) {
|
||||
|
||||
#if defined(USE_X11)
|
||||
if (!features::IsUsingOzonePlatform()) {
|
||||
ui::SetProperty(
|
||||
x11::SetProperty(
|
||||
static_cast<x11::Window>(GetAcceleratedWidget()),
|
||||
x11::Atom::WM_TRANSIENT_FOR, x11::Atom::WINDOW,
|
||||
parent ? static_cast<x11::Window>(parent->GetAcceleratedWidget())
|
||||
@@ -1239,7 +1240,7 @@ bool NativeWindowViews::IsVisibleOnAllWorkspaces() {
|
||||
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 = gfx::GetAtom("_NET_WM_STATE_STICKY");
|
||||
x11::Atom sticky_atom = x11::GetAtom("_NET_WM_STATE_STICKY");
|
||||
std::vector<x11::Atom> wm_states;
|
||||
ui::GetAtomArrayProperty(static_cast<x11::Window>(GetAcceleratedWidget()),
|
||||
"_NET_WM_STATE", &wm_states);
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
#include "content/public/common/content_features.h"
|
||||
#include "content/public/common/service_names.mojom.h"
|
||||
#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "net/net_buildflags.h"
|
||||
|
||||
@@ -164,6 +164,7 @@ bool MatchesPropertyFilters(
|
||||
if (base::MatchPattern(text, filter.match_str)) {
|
||||
switch (filter.type) {
|
||||
case ui::AXPropertyFilter::ALLOW_EMPTY:
|
||||
case ui::AXPropertyFilter::SCRIPT:
|
||||
allow = true;
|
||||
break;
|
||||
case ui::AXPropertyFilter::ALLOW:
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/ui/x/window_state_watcher.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "ui/base/x/x11_util.h"
|
||||
#include "ui/gfx/x/x11_atom_cache.h"
|
||||
|
||||
namespace electron {
|
||||
@@ -10,52 +14,63 @@ namespace electron {
|
||||
WindowStateWatcher::WindowStateWatcher(NativeWindowViews* window)
|
||||
: window_(window),
|
||||
widget_(window->GetAcceleratedWidget()),
|
||||
window_state_atom_(gfx::GetAtom("_NET_WM_STATE")) {
|
||||
ui::X11EventSource::GetInstance()->AddXEventObserver(this);
|
||||
window_state_atom_(x11::GetAtom("_NET_WM_STATE")) {
|
||||
ui::X11EventSource::GetInstance()->connection()->AddEventObserver(this);
|
||||
}
|
||||
|
||||
WindowStateWatcher::~WindowStateWatcher() {
|
||||
ui::X11EventSource::GetInstance()->RemoveXEventObserver(this);
|
||||
ui::X11EventSource::GetInstance()->connection()->RemoveEventObserver(this);
|
||||
}
|
||||
|
||||
void WindowStateWatcher::WillProcessXEvent(x11::Event* x11_event) {
|
||||
void WindowStateWatcher::OnEvent(const x11::Event& x11_event) {
|
||||
if (IsWindowStateEvent(x11_event)) {
|
||||
was_minimized_ = window_->IsMinimized();
|
||||
was_maximized_ = window_->IsMaximized();
|
||||
}
|
||||
}
|
||||
bool was_minimized_ = window_->IsMinimized();
|
||||
bool was_maximized_ = window_->IsMaximized();
|
||||
|
||||
void WindowStateWatcher::DidProcessXEvent(x11::Event* x11_event) {
|
||||
if (IsWindowStateEvent(x11_event)) {
|
||||
bool is_minimized = window_->IsMinimized();
|
||||
bool is_maximized = window_->IsMaximized();
|
||||
bool is_fullscreen = window_->IsFullscreen();
|
||||
if (is_minimized != was_minimized_) {
|
||||
if (is_minimized)
|
||||
window_->NotifyWindowMinimize();
|
||||
else
|
||||
window_->NotifyWindowRestore();
|
||||
} else if (is_maximized != was_maximized_) {
|
||||
if (is_maximized)
|
||||
window_->NotifyWindowMaximize();
|
||||
else
|
||||
window_->NotifyWindowUnmaximize();
|
||||
} else {
|
||||
// If this is neither a "maximize" or "minimize" event, then we think it
|
||||
// is a "fullscreen" event.
|
||||
// The "IsFullscreen()" becomes true immediately before "WillProcessEvent"
|
||||
// is called, so we can not handle this like "maximize" and "minimize" by
|
||||
// watching whether they have changed.
|
||||
if (is_fullscreen)
|
||||
window_->NotifyWindowEnterFullScreen();
|
||||
else
|
||||
window_->NotifyWindowLeaveFullScreen();
|
||||
std::vector<x11::Atom> wm_states;
|
||||
|
||||
if (ui::GetAtomArrayProperty(
|
||||
static_cast<x11::Window>(window_->GetAcceleratedWidget()),
|
||||
"_NET_WM_STATE", &wm_states)) {
|
||||
auto props =
|
||||
base::flat_set<x11::Atom>(std::begin(wm_states), std::end(wm_states));
|
||||
bool is_minimized =
|
||||
props.find(x11::GetAtom("_NET_WM_STATE_HIDDEN")) != props.end();
|
||||
bool is_maximized =
|
||||
props.find(x11::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT")) !=
|
||||
props.end() &&
|
||||
props.find(x11::GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ")) !=
|
||||
props.end();
|
||||
bool is_fullscreen =
|
||||
props.find(x11::GetAtom("_NET_WM_STATE_FULLSCREEN")) != props.end();
|
||||
|
||||
if (is_minimized != was_minimized_) {
|
||||
if (is_minimized)
|
||||
window_->NotifyWindowMinimize();
|
||||
else
|
||||
window_->NotifyWindowRestore();
|
||||
} else if (is_maximized != was_maximized_) {
|
||||
if (is_maximized)
|
||||
window_->NotifyWindowMaximize();
|
||||
else
|
||||
window_->NotifyWindowUnmaximize();
|
||||
} else {
|
||||
// If this is neither a "maximize" or "minimize" event, then we think it
|
||||
// is a "fullscreen" event.
|
||||
// The "IsFullscreen()" becomes true immediately before "OnEvent"
|
||||
// is called, so we can not handle this like "maximize" and "minimize"
|
||||
// by watching whether they have changed.
|
||||
if (is_fullscreen)
|
||||
window_->NotifyWindowEnterFullScreen();
|
||||
else
|
||||
window_->NotifyWindowLeaveFullScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool WindowStateWatcher::IsWindowStateEvent(x11::Event* x11_event) const {
|
||||
auto* property = x11_event->As<x11::PropertyNotifyEvent>();
|
||||
bool WindowStateWatcher::IsWindowStateEvent(const x11::Event& x11_event) const {
|
||||
auto* property = x11_event.As<x11::PropertyNotifyEvent>();
|
||||
return (property && property->atom == window_state_atom_ &&
|
||||
static_cast<uint32_t>(property->window) == widget_);
|
||||
}
|
||||
|
||||
@@ -12,26 +12,22 @@
|
||||
|
||||
namespace electron {
|
||||
|
||||
class WindowStateWatcher : public ui::XEventObserver {
|
||||
class WindowStateWatcher : public x11::EventObserver {
|
||||
public:
|
||||
explicit WindowStateWatcher(NativeWindowViews* window);
|
||||
~WindowStateWatcher() override;
|
||||
|
||||
protected:
|
||||
// ui::XEventObserver:
|
||||
void WillProcessXEvent(x11::Event* x11_event) override;
|
||||
void DidProcessXEvent(x11::Event* x11_event) override;
|
||||
// x11::EventObserver:
|
||||
void OnEvent(const x11::Event& x11_event) override;
|
||||
|
||||
private:
|
||||
bool IsWindowStateEvent(x11::Event* x11_event) const;
|
||||
bool IsWindowStateEvent(const x11::Event& x11_event) const;
|
||||
|
||||
NativeWindowViews* window_;
|
||||
gfx::AcceleratedWidget widget_;
|
||||
const x11::Atom window_state_atom_;
|
||||
|
||||
bool was_minimized_ = false;
|
||||
bool was_maximized_ = false;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WindowStateWatcher);
|
||||
};
|
||||
|
||||
|
||||
@@ -21,16 +21,16 @@ namespace electron {
|
||||
|
||||
void SetWMSpecState(x11::Window window, bool enabled, x11::Atom state) {
|
||||
ui::SendClientMessage(window, ui::GetX11RootWindow(),
|
||||
gfx::GetAtom("_NET_WM_STATE"),
|
||||
x11::GetAtom("_NET_WM_STATE"),
|
||||
{enabled ? 1 : 0, static_cast<uint32_t>(state),
|
||||
static_cast<uint32_t>(x11::Window::None), 1, 0});
|
||||
}
|
||||
|
||||
void SetWindowType(x11::Window window, const std::string& type) {
|
||||
std::string type_prefix = "_NET_WM_WINDOW_TYPE_";
|
||||
x11::Atom window_type = gfx::GetAtom(type_prefix + base::ToUpperASCII(type));
|
||||
ui::SetProperty(window, gfx::GetAtom("_NET_WM_WINDOW_TYPE"), x11::Atom::ATOM,
|
||||
window_type);
|
||||
x11::Atom window_type = x11::GetAtom(type_prefix + base::ToUpperASCII(type));
|
||||
x11::SetProperty(window, x11::GetAtom("_NET_WM_WINDOW_TYPE"), x11::Atom::ATOM,
|
||||
window_type);
|
||||
}
|
||||
|
||||
bool ShouldUseGlobalMenuBar() {
|
||||
@@ -77,7 +77,7 @@ void MoveWindowToForeground(x11::Window window) {
|
||||
|
||||
void MoveWindowAbove(x11::Window window, x11::Window other_window) {
|
||||
ui::SendClientMessage(window, ui::GetX11RootWindow(),
|
||||
gfx::GetAtom("_NET_RESTACK_WINDOW"),
|
||||
x11::GetAtom("_NET_RESTACK_WINDOW"),
|
||||
{2, static_cast<uint32_t>(other_window),
|
||||
static_cast<uint32_t>(x11::StackMode::Above), 0, 0});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user