chore: bump chromium to a84d34e372b8fb5e9a94b1b4b447e (master) (#23908)

* chore: bump chromium in DEPS to a7249f73ae05d456c04487ef1693325f719556dd

* chore: bump chromium in DEPS to 202466fa40b58f0bb9c9a76a037d1c50154c099e

* chore: bump chromium in DEPS to 2dd1b25c8d794b50fb0dd911e0c4e909ff39f145

* Update patches

* update patches

* Revert "[printing] Mojofy PrintHostMsg_CheckForCancel"

2226002

* chore: bump chromium in DEPS to 8c1542e7dd36854fdf4abd1a8021eeb65a6a2e2b

* chore: bump chromium in DEPS to 078bc6d796334fb403acd8975b99d1c8ecd028e8

* chore: bump chromium in DEPS to d96e9f16ae852ec9dbd15bf17df3d440402413bb

* update patches

* chore: update patches

* Use ExtensionSystem::is_ready() instead of ExtensionService::is_ready()

2207499

* Remove WebImeTextSpan

2225240

* Remove PDFAnnotations flag altogether.

2229317

* Rework find-from-selection so it's synchronous -- fixes flaky tests

2181570

* fixup! Revert "[printing] Mojofy PrintHostMsg_CheckForCancel"

* chore: bump chromium in DEPS to a8a280835830c65145ed8573a9a09f36d3920418

* update sysroots

* update patches

* update patches

* Take RFH as a parameter for DidUpdateFavicon/ManifestURL

2224745

* chore: bump chromium in DEPS to b6149cb5a5e32caf8eab67b97ef3072b72521ca8

* Update patches

* Rename net::cookie_util::StripStatuses to StripAccessResults

2212697

* use net::CookieAccessResultList instead of net::CookieAccessResultList

* fix mas_no_private_api patch

2230281

* chore: bump chromium in DEPS to a27feee1643d952e48f77c92d8c03aedea14b720

* update patches

* fix: add new navigation state REUSE_SITE_INSTANCE

To fix the new set of state checks added in
2215141

* chore: bump chromium in DEPS to ff4559a4c13d20888202474e4ab9917dbdad8a9a

* update patches

* Cleanup usages of old mojo types and remove unused code

2235699

* chore: bump chromium in DEPS to 05279845f76eb22900a8b0d1a11d4fd339a8e53b

* chore: bump chromium in DEPS to 821558279767cffec90e3b5b947865f90089fed3

* chore: bump chromium in DEPS to 1aef04e6486be337d3dd820b2d64d6320a1b9c13

* chore: bump chromium in DEPS to dc86386e8fdd796a0f7577e91e42a7f8b7e9bc78

* chore: bump chromium in DEPS to 64f2360794f14643764092ba3e58e2ed8f9fee12

* chore: update patches

* refactor: MessageLoop, you are terminated \o/

Refs: 2246173

* refactor: plumb DownloadSchedule to DownloadItem

Refs: 2242202

* chore: fix variable typo in IPC

* chore: s/BindPipeAndPassReceiver/BindNewPipeAndPassReceiver

* chore: update patches

* chore: XEvent becomes x11::Event

Refs: 2240355

* fixup! refactor: MessageLoop, you are terminated \o/

* fixup! chore: XEvent becomes x11::Event

* build: update v8 headers

* chore: fix windows build

* chore: disable SameSite-by-default changes

2231445

* update printing.patch

* chore: bump chromium DEPS to 9ae03ef8f7d4f6ac663f725bcfe70311987652f3

* Convert WidgetHostMsg_SelectionBoundsChanged/TextInputStateChanged

2243531

* chore: update v8 patches

* [XProto] Replace usages of XID and ::Window with x11::Window

2249389

* Update VideoFrameMetadata to use base::Optionals

2231706
2238361

* --disable-dev-shm-usage for gpu process crash

* [v8] Allow for 4GB TypedArrays

2249668

* update lib_src_switch_buffer_kmaxlength_to_size_t.patch

* disable app.getGPUInfo spec on linux

* update patches

Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: Electron Bot <anonymous@electronjs.org>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
This commit is contained in:
Electron Bot 2020-06-22 10:35:10 -07:00 committed by GitHub
parent 61a05caa78
commit 72a089262e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
107 changed files with 1029 additions and 663 deletions

View file

@ -153,12 +153,13 @@ void FilterCookies(const base::Value& filter,
promise.Resolve(result);
}
void FilterCookieWithStatuses(const base::Value& filter,
gin_helper::Promise<net::CookieList> promise,
const net::CookieStatusList& list,
const net::CookieStatusList& excluded_list) {
void FilterCookieWithStatuses(
const base::Value& filter,
gin_helper::Promise<net::CookieList> promise,
const net::CookieAccessResultList& list,
const net::CookieAccessResultList& excluded_list) {
FilterCookies(filter, std::move(promise),
net::cookie_util::StripStatuses(list));
net::cookie_util::StripAccessResults(list));
}
// Parse dictionary property to CanonicalCookie time correctly.

View file

@ -52,6 +52,8 @@
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "ppapi/buildflags/buildflags.h"
#include "shell/browser/api/electron_api_browser_window.h"
@ -409,7 +411,7 @@ WebContents::WebContents(v8::Isolate* isolate,
#endif
registry_.AddInterface(base::BindRepeating(&WebContents::BindElectronBrowser,
base::Unretained(this)));
bindings_.set_connection_error_handler(base::BindRepeating(
receivers_.set_disconnect_handler(base::BindRepeating(
&WebContents::OnElectronBrowserConnectionError, base::Unretained(this)));
}
@ -586,7 +588,7 @@ void WebContents::InitWithSessionAndOptions(
registry_.AddInterface(base::BindRepeating(&WebContents::BindElectronBrowser,
base::Unretained(this)));
bindings_.set_connection_error_handler(base::BindRepeating(
receivers_.set_disconnect_handler(base::BindRepeating(
&WebContents::OnElectronBrowserConnectionError, base::Unretained(this)));
AutofillDriverFactory::CreateForWebContents(web_contents());
@ -1117,16 +1119,16 @@ bool WebContents::EmitNavigationEvent(
}
void WebContents::BindElectronBrowser(
mojom::ElectronBrowserRequest request,
mojo::PendingReceiver<mojom::ElectronBrowser> receiver,
content::RenderFrameHost* render_frame_host) {
auto id = bindings_.AddBinding(this, std::move(request), render_frame_host);
frame_to_bindings_map_[render_frame_host].push_back(id);
auto id = receivers_.Add(this, std::move(receiver), render_frame_host);
frame_to_receivers_map_[render_frame_host].push_back(id);
}
void WebContents::OnElectronBrowserConnectionError() {
auto binding_id = bindings_.dispatch_binding();
auto* frame_host = bindings_.dispatch_context();
base::Erase(frame_to_bindings_map_[frame_host], binding_id);
auto receiver_id = receivers_.current_receiver();
auto* frame_host = receivers_.current_context();
base::Erase(frame_to_receivers_map_[frame_host], receiver_id);
}
void WebContents::Message(bool internal,
@ -1135,7 +1137,7 @@ void WebContents::Message(bool internal,
TRACE_EVENT1("electron", "WebContents::Message", "channel", channel);
// webContents.emit('-ipc-message', new Event(), internal, channel,
// arguments);
EmitWithSender("-ipc-message", bindings_.dispatch_context(), InvokeCallback(),
EmitWithSender("-ipc-message", receivers_.current_context(), InvokeCallback(),
internal, channel, std::move(arguments));
}
@ -1145,7 +1147,7 @@ void WebContents::Invoke(bool internal,
InvokeCallback callback) {
TRACE_EVENT1("electron", "WebContents::Invoke", "channel", channel);
// webContents.emit('-ipc-invoke', new Event(), internal, channel, arguments);
EmitWithSender("-ipc-invoke", bindings_.dispatch_context(),
EmitWithSender("-ipc-invoke", receivers_.current_context(),
std::move(callback), internal, channel, std::move(arguments));
}
@ -1156,7 +1158,7 @@ void WebContents::ReceivePostMessage(const std::string& channel,
MessagePort::EntanglePorts(isolate(), std::move(message.ports));
v8::Local<v8::Value> message_value =
electron::DeserializeV8Value(isolate(), message);
EmitWithSender("-ipc-ports", bindings_.dispatch_context(), InvokeCallback(),
EmitWithSender("-ipc-ports", receivers_.current_context(), InvokeCallback(),
false, channel, message_value, std::move(wrapped_ports));
}
@ -1199,7 +1201,7 @@ void WebContents::MessageSync(bool internal,
TRACE_EVENT1("electron", "WebContents::MessageSync", "channel", channel);
// webContents.emit('-ipc-message-sync', new Event(sender, message), internal,
// channel, arguments);
EmitWithSender("-ipc-message-sync", bindings_.dispatch_context(),
EmitWithSender("-ipc-message-sync", receivers_.current_context(),
std::move(callback), internal, channel, std::move(arguments));
}
@ -1222,7 +1224,7 @@ void WebContents::MessageHost(const std::string& channel,
blink::CloneableMessage arguments) {
TRACE_EVENT1("electron", "WebContents::MessageHost", "channel", channel);
// webContents.emit('ipc-message-host', new Event(), channel, args);
EmitWithSender("ipc-message-host", bindings_.dispatch_context(),
EmitWithSender("ipc-message-host", receivers_.current_context(),
InvokeCallback(), channel, std::move(arguments));
}
@ -1239,12 +1241,12 @@ void WebContents::RenderFrameDeleted(
// that no longer exist. To prevent this from happening, when a
// RenderFrameHost goes away, we close all the bindings related to that
// frame.
auto it = frame_to_bindings_map_.find(render_frame_host);
if (it == frame_to_bindings_map_.end())
auto it = frame_to_receivers_map_.find(render_frame_host);
if (it == frame_to_receivers_map_.end())
return;
for (auto id : it->second)
bindings_.RemoveBinding(id);
frame_to_bindings_map_.erase(it);
receivers_.Remove(id);
frame_to_receivers_map_.erase(it);
}
void WebContents::DidStartNavigation(
@ -1328,6 +1330,7 @@ void WebContents::TitleWasSet(content::NavigationEntry* entry) {
}
void WebContents::DidUpdateFaviconURL(
content::RenderFrameHost* render_frame_host,
const std::vector<blink::mojom::FaviconURLPtr>& urls) {
std::set<GURL> unique_urls;
for (const auto& iter : urls) {
@ -2153,7 +2156,7 @@ uint32_t WebContents::FindInPage(gin_helper::Arguments* args) {
if (args->GetNext(&dict)) {
dict.Get("forward", &options->forward);
dict.Get("matchCase", &options->match_case);
dict.Get("findNext", &options->find_next);
dict.Get("findNext", &options->new_session);
}
web_contents()->Find(request_id, search_text, std::move(options));

View file

@ -22,7 +22,7 @@
#include "electron/buildflags/buildflags.h"
#include "electron/shell/common/api/api.mojom.h"
#include "gin/handle.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "printing/buildflags/buildflags.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#include "shell/browser/api/frame_subscriber.h"
@ -535,6 +535,7 @@ class WebContents : public gin_helper::TrackableObject<WebContents>,
const content::LoadCommittedDetails& load_details) override;
void TitleWasSet(content::NavigationEntry* entry) override;
void DidUpdateFaviconURL(
content::RenderFrameHost* render_frame_host,
const std::vector<blink::mojom::FaviconURLPtr>& urls) override;
void PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) override;
@ -565,8 +566,9 @@ class WebContents : public gin_helper::TrackableObject<WebContents>,
// Binds the given request for the ElectronBrowser API. When the
// RenderFrameHost is destroyed, all related bindings will be removed.
void BindElectronBrowser(mojom::ElectronBrowserRequest request,
content::RenderFrameHost* render_frame_host);
void BindElectronBrowser(
mojo::PendingReceiver<mojom::ElectronBrowser> receiver,
content::RenderFrameHost* render_frame_host);
void OnElectronBrowserConnectionError();
uint32_t GetNextRequestId() { return ++request_id_; }
@ -648,9 +650,10 @@ class WebContents : public gin_helper::TrackableObject<WebContents>,
int currently_committed_process_id_ = -1;
service_manager::BinderRegistryWithArgs<content::RenderFrameHost*> registry_;
mojo::BindingSet<mojom::ElectronBrowser, content::RenderFrameHost*> bindings_;
std::map<content::RenderFrameHost*, std::vector<mojo::BindingId>>
frame_to_bindings_map_;
mojo::ReceiverSet<mojom::ElectronBrowser, content::RenderFrameHost*>
receivers_;
std::map<content::RenderFrameHost*, std::vector<mojo::ReceiverId>>
frame_to_receivers_map_;
base::WeakPtrFactory<WebContents> weak_factory_;

View file

@ -9,7 +9,6 @@
#include <utility>
#include "base/files/file_util.h"
#include "base/message_loop/message_loop.h"
#include "base/no_destructor.h"
#include "base/path_service.h"
#include "base/run_loop.h"

View file

@ -15,8 +15,8 @@
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/icon_manager.h"

View file

@ -130,7 +130,7 @@ void ElectronDownloadManagerDelegate::OnDownloadPathGenerated(
std::move(callback).Run(path,
download::DownloadItem::TARGET_DISPOSITION_PROMPT,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
item->GetMixedContentStatus(), path,
item->GetMixedContentStatus(), path, base::nullopt,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
}
}
@ -174,7 +174,8 @@ void ElectronDownloadManagerDelegate::OnDownloadSaveDialogDone(
std::move(download_callback)
.Run(path, download::DownloadItem::TARGET_DISPOSITION_PROMPT,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
item->GetMixedContentStatus(), path, interrupt_reason);
item->GetMixedContentStatus(), path, base::nullopt,
interrupt_reason);
}
void ElectronDownloadManagerDelegate::Shutdown() {
@ -193,7 +194,7 @@ bool ElectronDownloadManagerDelegate::DetermineDownloadTarget(
download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DownloadItem::MixedContentStatus::UNKNOWN,
download->GetForcedFilePath(),
download->GetForcedFilePath(), base::nullopt,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
}
@ -206,7 +207,7 @@ bool ElectronDownloadManagerDelegate::DetermineDownloadTarget(
save_path, download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DownloadItem::MixedContentStatus::UNKNOWN, save_path,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
base::nullopt, download::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
}

View file

@ -68,9 +68,7 @@ void AddAdditionalDataForPdf(base::DictionaryValue* dict) {
dict->SetKey("pdfFormSaveEnabled",
base::Value(base::FeatureList::IsEnabled(
chrome_pdf::features::kSaveEditedPDFForm)));
dict->SetKey("pdfAnnotationsEnabled",
base::Value(base::FeatureList::IsEnabled(
chrome_pdf::features::kPDFAnnotations)));
dict->SetKey("pdfAnnotationsEnabled", base::Value(false));
dict->SetKey("pdfTwoUpViewEnabled",
base::Value(base::FeatureList::IsEnabled(
chrome_pdf::features::kPDFTwoUpView)));

View file

@ -185,6 +185,10 @@ const base::OneShotEvent& ElectronExtensionSystem::ready() const {
return ready_;
}
bool ElectronExtensionSystem::is_ready() const {
return ready_.is_signaled();
}
ContentVerifier* ElectronExtensionSystem::content_verifier() {
return nullptr;
}

View file

@ -74,6 +74,7 @@ class ElectronExtensionSystem : public ExtensionSystem {
const std::string& extension_id,
const UnloadedExtensionReason reason) override;
const base::OneShotEvent& ready() const override;
bool is_ready() const override;
ContentVerifier* content_verifier() override;
std::unique_ptr<ExtensionSet> GetDependentExtensions(
const Extension* extension) override;

View file

@ -12,6 +12,7 @@
#include "content/public/common/content_features.h"
#include "electron/buildflags/buildflags.h"
#include "media/base/media_switches.h"
#include "net/base/features.h"
namespace electron {
@ -26,7 +27,14 @@ void InitializeFeatureList() {
// Can be reenabled when our site instance policy is aligned with chromium
// when node integration is enabled.
disable_features +=
std::string(",") + features::kSpareRendererForSitePerProcess.name;
std::string(",") + features::kSpareRendererForSitePerProcess.name +
// Disable SameSite-by-default, this will be a breaking change for many
// apps which cannot land in master until 11-x-y is branched out. For more
// info
// https://groups.google.com/a/chromium.org/g/embedder-dev/c/4yJi4Twj2NM/m/9bhpWureCAAJ
std::string(",") + net::features::kSameSiteByDefaultCookies.name +
std::string(",") +
net::features::kCookiesWithoutSameSiteMustBeSecure.name;
// https://www.polymer-project.org/blog/2018-10-02-webcomponents-v0-deprecations
// https://chromium-review.googlesource.com/c/chromium/src/+/1869562

View file

@ -659,10 +659,11 @@ bool NativeWindowViews::MoveAbove(const std::string& sourceId) {
0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
#elif defined(USE_X11)
if (!IsWindowValid(id.id))
if (!IsWindowValid(static_cast<x11::Window>(id.id)))
return false;
electron::MoveWindowAbove(GetAcceleratedWidget(), id.id);
electron::MoveWindowAbove(GetAcceleratedWidget(),
static_cast<x11::Window>(id.id));
#endif
return true;
@ -956,12 +957,14 @@ void NativeWindowViews::SetIgnoreMouseEvents(bool ignore, bool forward) {
#elif defined(USE_X11)
if (ignore) {
XRectangle r = {0, 0, 1, 1};
XShapeCombineRectangles(gfx::GetXDisplay(), GetAcceleratedWidget(),
XShapeCombineRectangles(gfx::GetXDisplay(),
static_cast<uint32_t>(GetAcceleratedWidget()),
ShapeInput, 0, 0, &r, 1, ShapeSet,
static_cast<int>(x11::ClipOrdering::YXBanded));
} else {
XShapeCombineMask(gfx::GetXDisplay(), GetAcceleratedWidget(), ShapeInput, 0,
0, x11::None, ShapeSet);
XShapeCombineMask(gfx::GetXDisplay(),
static_cast<uint32_t>(GetAcceleratedWidget()), ShapeInput,
0, 0, x11::None, ShapeSet);
}
#endif
}
@ -1070,8 +1073,9 @@ void NativeWindowViews::SetParentWindow(NativeWindow* parent) {
#if defined(USE_X11)
XDisplay* xdisplay = gfx::GetXDisplay();
XSetTransientForHint(
xdisplay, GetAcceleratedWidget(),
parent ? parent->GetAcceleratedWidget() : DefaultRootWindow(xdisplay));
xdisplay, static_cast<uint32_t>(GetAcceleratedWidget()),
static_cast<uint32_t>(parent ? 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
@ -1164,7 +1168,7 @@ content::DesktopMediaID NativeWindowViews::GetDesktopMediaID() const {
window_handle =
reinterpret_cast<content::DesktopMediaID::Id>(accelerated_widget);
#elif defined(USE_X11)
window_handle = accelerated_widget;
window_handle = static_cast<uint32_t>(accelerated_widget);
#endif
aura::WindowTreeHost* const host =
aura::WindowTreeHost::GetForAcceleratedWidget(accelerated_widget);

View file

@ -437,7 +437,7 @@ content::CursorManager* OffScreenRenderWidgetHostView::GetCursorManager() {
void OffScreenRenderWidgetHostView::SetIsLoading(bool loading) {}
void OffScreenRenderWidgetHostView::TextInputStateChanged(
const content::TextInputState& params) {}
const ui::mojom::TextInputState& params) {}
void OffScreenRenderWidgetHostView::ImeCancelComposition() {}

View file

@ -114,7 +114,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
void InitAsFullscreen(content::RenderWidgetHostView*) override;
void UpdateCursor(const content::WebCursor&) override;
void SetIsLoading(bool is_loading) override;
void TextInputStateChanged(const content::TextInputState& params) override;
void TextInputStateChanged(const ui::mojom::TextInputState& params) override;
void ImeCancelComposition(void) override;
void RenderProcessGone() override;
void Destroy(void) override;

View file

@ -112,16 +112,12 @@ void OffScreenVideoConsumer::OnFrameCaptured(
new FramePinner{std::move(mapping), callbacks_remote.Unbind()});
bitmap.setImmutable();
media::VideoFrameMetadata metadata;
metadata.MergeInternalValuesFrom(info->metadata);
gfx::Rect damage_rect;
auto UPDATE_RECT = media::VideoFrameMetadata::CAPTURE_UPDATE_RECT;
if (!metadata.GetRect(UPDATE_RECT, &damage_rect) || damage_rect.IsEmpty()) {
damage_rect = content_rect;
base::Optional<gfx::Rect> update_rect = info->metadata.capture_update_rect;
if (!update_rect.has_value() || update_rect->IsEmpty()) {
update_rect = content_rect;
}
callback_.Run(damage_rect, bitmap);
callback_.Run(*update_rect, bitmap);
}
void OffScreenVideoConsumer::OnStopped() {}

View file

@ -138,12 +138,6 @@ void PrintPreviewMessageHandler::PrintPreviewCancelled(int32_t document_cookie,
RejectPromise(request_id);
}
void PrintPreviewMessageHandler::CheckForCancel(
int32_t request_id,
CheckForCancelCallback callback) {
std::move(callback).Run(false);
}
void PrintPreviewMessageHandler::PrintToPDF(
base::DictionaryValue options,
gin_helper::Promise<v8::Local<v8::Value>> promise) {

View file

@ -66,8 +66,6 @@ class PrintPreviewMessageHandler
int32_t request_id) override;
void PrinterSettingsInvalid(int32_t document_cookie,
int32_t request_id) override {}
void CheckForCancel(int32_t request_id,
CheckForCancelCallback callback) override;
gin_helper::Promise<v8::Local<v8::Value>> GetPromise(int request_id);

View file

@ -172,24 +172,24 @@ std::string GetMenuModelStatus(ElectronMenuModel* model) {
GlobalMenuBarX11::GlobalMenuBarX11(NativeWindowViews* window)
: window_(window),
xid_(window_->GetNativeWindow()->GetHost()->GetAcceleratedWidget()) {
xwindow_(window_->GetNativeWindow()->GetHost()->GetAcceleratedWidget()) {
EnsureMethodsLoaded();
if (server_new)
InitServer(xid_);
InitServer(xwindow_);
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowMapped(xid_);
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowMapped(xwindow_);
}
GlobalMenuBarX11::~GlobalMenuBarX11() {
if (IsServerStarted())
g_object_unref(server_);
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowUnmapped(xid_);
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowUnmapped(xwindow_);
}
// static
std::string GlobalMenuBarX11::GetPathForWindow(gfx::AcceleratedWidget xid) {
return base::StringPrintf("/com/canonical/menu/%lX", xid);
std::string GlobalMenuBarX11::GetPathForWindow(x11::Window window) {
return base::StringPrintf("/com/canonical/menu/%X", window);
}
void GlobalMenuBarX11::SetMenu(ElectronMenuModel* menu_model) {
@ -211,17 +211,17 @@ bool GlobalMenuBarX11::IsServerStarted() const {
return server_;
}
void GlobalMenuBarX11::InitServer(gfx::AcceleratedWidget xid) {
std::string path = GetPathForWindow(xid);
void GlobalMenuBarX11::InitServer(x11::Window window) {
std::string path = GetPathForWindow(window);
server_ = server_new(path.c_str());
}
void GlobalMenuBarX11::OnWindowMapped() {
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowMapped(xid_);
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowMapped(xwindow_);
}
void GlobalMenuBarX11::OnWindowUnmapped() {
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowUnmapped(xid_);
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowUnmapped(xwindow_);
}
void GlobalMenuBarX11::BuildMenuFromModel(ElectronMenuModel* model,

View file

@ -40,8 +40,8 @@ class GlobalMenuBarX11 {
explicit GlobalMenuBarX11(NativeWindowViews* window);
virtual ~GlobalMenuBarX11();
// Creates the object path for DbusmenuServer which is attached to |xid|.
static std::string GetPathForWindow(gfx::AcceleratedWidget xid);
// Creates the object path for DbusmenuServer which is attached to |window|.
static std::string GetPathForWindow(x11::Window window);
void SetMenu(ElectronMenuModel* menu_model);
bool IsServerStarted() const;
@ -52,7 +52,7 @@ class GlobalMenuBarX11 {
private:
// Creates a DbusmenuServer.
void InitServer(gfx::AcceleratedWidget xid);
void InitServer(x11::Window window);
// Create a menu from menu model.
void BuildMenuFromModel(ElectronMenuModel* model, DbusmenuMenuitem* parent);
@ -69,7 +69,7 @@ class GlobalMenuBarX11 {
CHROMEG_CALLBACK_0(GlobalMenuBarX11, void, OnSubMenuShow, DbusmenuMenuitem*);
NativeWindowViews* window_;
gfx::AcceleratedWidget xid_;
x11::Window xwindow_;
DbusmenuServer* server_ = nullptr;

View file

@ -18,15 +18,15 @@ WindowStateWatcher::~WindowStateWatcher() {
ui::X11EventSource::GetInstance()->RemoveXEventObserver(this);
}
void WindowStateWatcher::WillProcessXEvent(XEvent* xev) {
if (IsWindowStateEvent(xev)) {
void WindowStateWatcher::WillProcessXEvent(x11::Event* x11_event) {
if (IsWindowStateEvent(x11_event)) {
was_minimized_ = window_->IsMinimized();
was_maximized_ = window_->IsMaximized();
}
}
void WindowStateWatcher::DidProcessXEvent(XEvent* xev) {
if (IsWindowStateEvent(xev)) {
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();
@ -54,9 +54,11 @@ void WindowStateWatcher::DidProcessXEvent(XEvent* xev) {
}
}
bool WindowStateWatcher::IsWindowStateEvent(XEvent* xev) const {
bool WindowStateWatcher::IsWindowStateEvent(x11::Event* x11_event) const {
XEvent* xev = &x11_event->xlib_event();
return (static_cast<x11::Atom>(xev->xproperty.atom) == window_state_atom_ &&
xev->type == PropertyNotify && xev->xproperty.window == widget_);
xev->type == PropertyNotify &&
xev->xproperty.window == static_cast<uint32_t>(widget_));
}
} // namespace electron

View file

@ -19,11 +19,11 @@ class WindowStateWatcher : public ui::XEventObserver {
protected:
// ui::XEventObserver:
void WillProcessXEvent(XEvent* xev) override;
void DidProcessXEvent(XEvent* xev) override;
void WillProcessXEvent(x11::Event* x11_event) override;
void DidProcessXEvent(x11::Event* x11_event) override;
private:
bool IsWindowStateEvent(XEvent* xev) const;
bool IsWindowStateEvent(x11::Event* x11_event) const;
NativeWindowViews* window_;
gfx::AcceleratedWidget widget_;

View file

@ -18,11 +18,11 @@
namespace electron {
void SetWMSpecState(::Window xwindow, bool enabled, x11::Atom state) {
void SetWMSpecState(x11::Window window, bool enabled, x11::Atom state) {
XEvent xclient;
memset(&xclient, 0, sizeof(xclient));
xclient.type = ClientMessage;
xclient.xclient.window = xwindow;
xclient.xclient.window = static_cast<uint32_t>(window);
xclient.xclient.message_type =
static_cast<uint32_t>(gfx::GetAtom("_NET_WM_STATE"));
xclient.xclient.format = 32;
@ -37,10 +37,10 @@ void SetWMSpecState(::Window xwindow, bool enabled, x11::Atom state) {
SubstructureRedirectMask | SubstructureNotifyMask, &xclient);
}
void SetWindowType(::Window xwindow, const std::string& type) {
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(xwindow, gfx::GetAtom("_NET_WM_WINDOW_TYPE"), x11::Atom::ATOM,
ui::SetProperty(window, gfx::GetAtom("_NET_WM_WINDOW_TYPE"), x11::Atom::ATOM,
window_type);
}
@ -82,23 +82,23 @@ bool ShouldUseGlobalMenuBar() {
return false;
}
void MoveWindowToForeground(::Window xwindow) {
MoveWindowAbove(xwindow, 0);
void MoveWindowToForeground(x11::Window window) {
MoveWindowAbove(window, static_cast<x11::Window>(0));
}
void MoveWindowAbove(::Window xwindow, ::Window other_xwindow) {
void MoveWindowAbove(x11::Window window, x11::Window other_window) {
XDisplay* xdisplay = gfx::GetXDisplay();
XEvent xclient;
memset(&xclient, 0, sizeof(xclient));
xclient.type = ClientMessage;
xclient.xclient.display = xdisplay;
xclient.xclient.window = xwindow;
xclient.xclient.window = static_cast<uint32_t>(window);
xclient.xclient.message_type =
static_cast<uint32_t>(gfx::GetAtom("_NET_RESTACK_WINDOW"));
xclient.xclient.format = 32;
xclient.xclient.data.l[0] = 2;
xclient.xclient.data.l[1] = other_xwindow;
xclient.xclient.data.l[1] = static_cast<uint32_t>(other_window);
xclient.xclient.data.l[2] = static_cast<uint32_t>(x11::StackMode::Above);
xclient.xclient.data.l[3] = 0;
xclient.xclient.data.l[4] = 0;
@ -108,9 +108,10 @@ void MoveWindowAbove(::Window xwindow, ::Window other_xwindow) {
XFlush(xdisplay);
}
bool IsWindowValid(::Window xwindow) {
bool IsWindowValid(x11::Window window) {
XWindowAttributes attrs;
return XGetWindowAttributes(gfx::GetXDisplay(), xwindow, &attrs);
return XGetWindowAttributes(gfx::GetXDisplay(), static_cast<uint32_t>(window),
&attrs);
}
} // namespace electron

View file

@ -13,22 +13,22 @@ namespace electron {
// Sends a message to the x11 window manager, enabling or disabling the |state|
// for _NET_WM_STATE.
void SetWMSpecState(::Window xwindow, bool enabled, x11::Atom state);
void SetWMSpecState(x11::Window window, bool enabled, x11::Atom state);
// Sets the _NET_WM_WINDOW_TYPE of window.
void SetWindowType(::Window xwindow, const std::string& type);
void SetWindowType(x11::Window window, const std::string& type);
// Returns true if the bus name "com.canonical.AppMenu.Registrar" is available.
bool ShouldUseGlobalMenuBar();
// Bring the given window to the front regardless of focus.
void MoveWindowToForeground(::Window xwindow);
void MoveWindowToForeground(x11::Window window);
// Move a given window above the other one.
void MoveWindowAbove(::Window xwindow, ::Window other_xwindow);
void MoveWindowAbove(x11::Window window, x11::Window other_window);
// Return true is the given window exists, false otherwise.
bool IsWindowValid(::Window xwindow);
bool IsWindowValid(x11::Window window);
} // namespace electron

View file

@ -6,7 +6,6 @@
#include "shell/common/api/object_life_monitor.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
namespace electron {

View file

@ -59,16 +59,16 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
weak_context_.SetWeak();
render_frame->GetRemoteInterfaces()->GetInterface(
mojo::MakeRequest(&electron_browser_ptr_));
electron_browser_remote_.BindNewPipeAndPassReceiver());
}
void OnDestruct() override { electron_browser_ptr_.reset(); }
void OnDestruct() override { electron_browser_remote_.reset(); }
void WillReleaseScriptContext(v8::Local<v8::Context> context,
int32_t world_id) override {
if (weak_context_.IsEmpty() ||
weak_context_.Get(context->GetIsolate()) == context)
electron_browser_ptr_.reset();
electron_browser_remote_.reset();
}
// gin::Wrappable:
@ -91,7 +91,7 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
bool internal,
const std::string& channel,
v8::Local<v8::Value> arguments) {
if (!electron_browser_ptr_) {
if (!electron_browser_remote_) {
thrower.ThrowError(kIPCMethodCalledAfterContextReleasedError);
return;
}
@ -99,7 +99,7 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
if (!electron::SerializeV8Value(isolate, arguments, &message)) {
return;
}
electron_browser_ptr_->Message(internal, channel, std::move(message));
electron_browser_remote_->Message(internal, channel, std::move(message));
}
v8::Local<v8::Promise> Invoke(v8::Isolate* isolate,
@ -107,7 +107,7 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
bool internal,
const std::string& channel,
v8::Local<v8::Value> arguments) {
if (!electron_browser_ptr_) {
if (!electron_browser_remote_) {
thrower.ThrowError(kIPCMethodCalledAfterContextReleasedError);
return v8::Local<v8::Promise>();
}
@ -118,7 +118,7 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
gin_helper::Promise<blink::CloneableMessage> p(isolate);
auto handle = p.GetHandle();
electron_browser_ptr_->Invoke(
electron_browser_remote_->Invoke(
internal, channel, std::move(message),
base::BindOnce(
[](gin_helper::Promise<blink::CloneableMessage> p,
@ -133,7 +133,7 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
const std::string& channel,
v8::Local<v8::Value> message_value,
base::Optional<v8::Local<v8::Value>> transfer) {
if (!electron_browser_ptr_) {
if (!electron_browser_remote_) {
thrower.ThrowError(kIPCMethodCalledAfterContextReleasedError);
return;
}
@ -165,8 +165,8 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
}
transferable_message.ports = std::move(ports);
electron_browser_ptr_->ReceivePostMessage(channel,
std::move(transferable_message));
electron_browser_remote_->ReceivePostMessage(
channel, std::move(transferable_message));
}
void SendTo(v8::Isolate* isolate,
@ -176,7 +176,7 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
int32_t web_contents_id,
const std::string& channel,
v8::Local<v8::Value> arguments) {
if (!electron_browser_ptr_) {
if (!electron_browser_remote_) {
thrower.ThrowError(kIPCMethodCalledAfterContextReleasedError);
return;
}
@ -184,15 +184,15 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
if (!electron::SerializeV8Value(isolate, arguments, &message)) {
return;
}
electron_browser_ptr_->MessageTo(internal, send_to_all, web_contents_id,
channel, std::move(message));
electron_browser_remote_->MessageTo(internal, send_to_all, web_contents_id,
channel, std::move(message));
}
void SendToHost(v8::Isolate* isolate,
gin_helper::ErrorThrower thrower,
const std::string& channel,
v8::Local<v8::Value> arguments) {
if (!electron_browser_ptr_) {
if (!electron_browser_remote_) {
thrower.ThrowError(kIPCMethodCalledAfterContextReleasedError);
return;
}
@ -200,7 +200,7 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
if (!electron::SerializeV8Value(isolate, arguments, &message)) {
return;
}
electron_browser_ptr_->MessageHost(channel, std::move(message));
electron_browser_remote_->MessageHost(channel, std::move(message));
}
v8::Local<v8::Value> SendSync(v8::Isolate* isolate,
@ -208,7 +208,7 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
bool internal,
const std::string& channel,
v8::Local<v8::Value> arguments) {
if (!electron_browser_ptr_) {
if (!electron_browser_remote_) {
thrower.ThrowError(kIPCMethodCalledAfterContextReleasedError);
return v8::Local<v8::Value>();
}
@ -218,13 +218,13 @@ class IPCRenderer : public gin::Wrappable<IPCRenderer>,
}
blink::CloneableMessage result;
electron_browser_ptr_->MessageSync(internal, channel, std::move(message),
&result);
electron_browser_remote_->MessageSync(internal, channel, std::move(message),
&result);
return electron::DeserializeV8Value(isolate, result);
}
v8::Global<v8::Context> weak_context_;
electron::mojom::ElectronBrowserPtr electron_browser_ptr_;
mojo::Remote<electron::mojom::ElectronBrowser> electron_browser_remote_;
};
gin::WrapperInfo IPCRenderer::kWrapperInfo = {gin::kEmbedderNativeGin};

View file

@ -30,12 +30,12 @@
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_element.h"
#include "third_party/blink/public/web/web_frame_widget.h"
#include "third_party/blink/public/web/web_ime_text_span.h"
#include "third_party/blink/public/web/web_input_method_controller.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_script_execution_callback.h"
#include "third_party/blink/public/web/web_script_source.h"
#include "third_party/blink/public/web/web_view.h"
#include "ui/base/ime/ime_text_span.h"
#include "url/url_util.h"
namespace gin {
@ -270,10 +270,10 @@ void SetZoomLevel(gin_helper::ErrorThrower thrower,
return;
}
mojom::ElectronBrowserPtr browser_ptr;
mojo::Remote<mojom::ElectronBrowser> browser_remote;
render_frame->GetRemoteInterfaces()->GetInterface(
mojo::MakeRequest(&browser_ptr));
browser_ptr->SetTemporaryZoomLevel(level);
browser_remote.BindNewPipeAndPassReceiver());
browser_remote->SetTemporaryZoomLevel(level);
}
double GetZoomLevel(gin_helper::ErrorThrower thrower,
@ -287,10 +287,10 @@ double GetZoomLevel(gin_helper::ErrorThrower thrower,
return result;
}
mojom::ElectronBrowserPtr browser_ptr;
mojo::Remote<mojom::ElectronBrowser> browser_remote;
render_frame->GetRemoteInterfaces()->GetInterface(
mojo::MakeRequest(&browser_ptr));
browser_ptr->DoGetZoomLevel(&result);
browser_remote.BindNewPipeAndPassReceiver());
browser_remote->DoGetZoomLevel(&result);
return result;
}
@ -420,8 +420,7 @@ void InsertText(gin_helper::ErrorThrower thrower,
->FrameWidget()
->GetActiveWebInputMethodController()
->CommitText(blink::WebString::FromUTF8(text),
blink::WebVector<blink::WebImeTextSpan>(),
blink::WebRange(), 0);
blink::WebVector<ui::ImeTextSpan>(), blink::WebRange(), 0);
}
}

View file

@ -111,10 +111,10 @@ void ElectronRenderFrameObserver::DraggableRegionsChanged() {
regions.push_back(std::move(region));
}
mojom::ElectronBrowserPtr browser_ptr;
mojo::Remote<mojom::ElectronBrowser> browser_remote;
render_frame_->GetRemoteInterfaces()->GetInterface(
mojo::MakeRequest(&browser_ptr));
browser_ptr->UpdateDraggableRegions(std::move(regions));
browser_remote.BindNewPipeAndPassReceiver());
browser_remote->UpdateDraggableRegions(std::move(regions));
}
void ElectronRenderFrameObserver::WillReleaseScriptContext(