72a089262e
* 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" https://chromium-review.googlesource.com/c/chromium/src/+/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() https://chromium-review.googlesource.com/c/chromium/src/+/2207499 * Remove WebImeTextSpan https://chromium-review.googlesource.com/c/chromium/src/+/2225240 * Remove PDFAnnotations flag altogether. https://chromium-review.googlesource.com/c/chromium/src/+/2229317 * Rework find-from-selection so it's synchronous -- fixes flaky tests https://chromium-review.googlesource.com/c/chromium/src/+/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 https://chromium-review.googlesource.com/c/chromium/src/+/2224745 * chore: bump chromium in DEPS to b6149cb5a5e32caf8eab67b97ef3072b72521ca8 * Update patches * Rename net::cookie_util::StripStatuses to StripAccessResults https://chromium-review.googlesource.com/c/chromium/src/+/2212697 * use net::CookieAccessResultList instead of net::CookieAccessResultList * fix mas_no_private_api patch https://chromium-review.googlesource.com/c/chromium/src/+/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 https://chromium-review.googlesource.com/c/chromium/src/+/2215141 * chore: bump chromium in DEPS to ff4559a4c13d20888202474e4ab9917dbdad8a9a * update patches * Cleanup usages of old mojo types and remove unused code https://chromium-review.googlesource.com/c/chromium/src/+/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: https://chromium-review.googlesource.com/c/chromium/src/+/2246173 * refactor: plumb DownloadSchedule to DownloadItem Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2242202 * chore: fix variable typo in IPC * chore: s/BindPipeAndPassReceiver/BindNewPipeAndPassReceiver * chore: update patches * chore: XEvent becomes x11::Event Refs: https://chromium-review.googlesource.com/c/chromium/src/+/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 https://chromium-review.googlesource.com/c/chromium/src/+/2231445 * update printing.patch * chore: bump chromium DEPS to 9ae03ef8f7d4f6ac663f725bcfe70311987652f3 * Convert WidgetHostMsg_SelectionBoundsChanged/TextInputStateChanged https://chromium-review.googlesource.com/c/chromium/src/+/2243531 * chore: update v8 patches * [XProto] Replace usages of XID and ::Window with x11::Window https://chromium-review.googlesource.com/c/chromium/src/+/2249389 * Update VideoFrameMetadata to use base::Optionals https://chromium-review.googlesource.com/c/chromium/src/+/2231706 https://chromium-review.googlesource.com/c/chromium/src/+/2238361 * --disable-dev-shm-usage for gpu process crash * [v8] Allow for 4GB TypedArrays https://chromium-review.googlesource.com/c/v8/v8/+/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>
290 lines
11 KiB
Diff
290 lines
11 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Cheng Zhao <zcbenz@gmail.com>
|
|
Date: Thu, 20 Sep 2018 17:48:49 -0700
|
|
Subject: mas_disable_remote_accessibility.patch
|
|
|
|
Disable remote accessibility APIs (NSAccessibilityRemoteUIElement) for MAS
|
|
build.
|
|
|
|
According to ccameron:
|
|
|
|
NSAccessibilityRemoteUIElement is unnecessary for Electron's use-case. We use it
|
|
for progressive web apps (where the AXTree is in the browser process, but macOS
|
|
needs to think it's coming from the PWA process). I think it can just be chopped
|
|
out -- if there are any side-effects, we should be able to work around them.
|
|
|
|
diff --git a/components/remote_cocoa/app_shim/application_bridge.mm b/components/remote_cocoa/app_shim/application_bridge.mm
|
|
index 9ddda9116e7284cbccde8a51e23ad7560dd06367..e846091ad99b0154636489e53491209ff3cbfaaa 100644
|
|
--- a/components/remote_cocoa/app_shim/application_bridge.mm
|
|
+++ b/components/remote_cocoa/app_shim/application_bridge.mm
|
|
@@ -49,6 +49,7 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper {
|
|
|
|
// NativeWidgetNSWindowHostHelper:
|
|
id GetNativeViewAccessible() override {
|
|
+#ifndef MAS_BUILD
|
|
if (!remote_accessibility_element_) {
|
|
int64_t browser_pid = 0;
|
|
std::vector<uint8_t> element_token;
|
|
@@ -59,6 +60,9 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper {
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
|
|
}
|
|
return remote_accessibility_element_.get();
|
|
+#else
|
|
+ return nil;
|
|
+#endif
|
|
}
|
|
void DispatchKeyEvent(ui::KeyEvent* event) override {
|
|
bool event_handled = false;
|
|
@@ -96,8 +100,10 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper {
|
|
mojo::AssociatedRemote<mojom::TextInputHost> text_input_host_remote_;
|
|
|
|
std::unique_ptr<NativeWidgetNSWindowBridge> bridge_;
|
|
+#ifndef MAS_BUILD
|
|
base::scoped_nsobject<NSAccessibilityRemoteUIElement>
|
|
remote_accessibility_element_;
|
|
+#endif
|
|
};
|
|
|
|
} // namespace
|
|
diff --git a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
|
index 2ee45cb069ec5d78d9c7a3f61fdd1d444a590f41..badc4323b910f8e3957583e05af303472cb204f6 100644
|
|
--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
|
+++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
|
@@ -543,10 +543,12 @@ void NativeWidgetNSWindowBridge::CreateContentView(uint64_t ns_view_id,
|
|
// this should be treated as an error and caught early.
|
|
CHECK(bridged_view_);
|
|
|
|
+#ifndef MAS_BUILD
|
|
// Send the accessibility tokens for the NSView now that it exists.
|
|
host_->SetRemoteAccessibilityTokens(
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(window_),
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(bridged_view_));
|
|
+#endif
|
|
|
|
// Beware: This view was briefly removed (in favor of a bare CALayer) in
|
|
// crrev/c/1236675. The ordering of unassociated layers relative to NSView
|
|
diff --git a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
|
index c3a9fbf0f9d2b80c1de42a22ad094a286f0b559b..02493d4b62c98a3aebd3e460c459218a4dc4ea8e 100644
|
|
--- a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
|
+++ b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
|
@@ -70,8 +70,10 @@ class RenderWidgetHostNSViewBridgeOwner
|
|
return nil;
|
|
}
|
|
void SetAccessibilityWindow(NSWindow* window) override {
|
|
+#ifndef MAS_BUILD
|
|
host_->SetRemoteAccessibilityWindowToken(
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(window));
|
|
+#endif
|
|
}
|
|
|
|
void ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& key_event,
|
|
@@ -133,8 +135,10 @@ class RenderWidgetHostNSViewBridgeOwner
|
|
|
|
mojo::AssociatedRemote<mojom::RenderWidgetHostNSViewHost> host_;
|
|
std::unique_ptr<RenderWidgetHostNSViewBridge> bridge_;
|
|
+#ifndef MAS_BUILD
|
|
base::scoped_nsobject<NSAccessibilityRemoteUIElement>
|
|
remote_accessibility_element_;
|
|
+#endif
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostNSViewBridgeOwner);
|
|
};
|
|
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h
|
|
index 51f91581aff32cd42b74c7086f51282cbc3629e8..8fa02de5ed90538923cd858a92f339daac686994 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
|
|
@@ -47,7 +47,9 @@ class ScopedPasswordInputEnabler;
|
|
|
|
@protocol RenderWidgetHostViewMacDelegate;
|
|
|
|
+#ifndef MAS_BUILD
|
|
@class NSAccessibilityRemoteUIElement;
|
|
+#endif
|
|
@class RenderWidgetHostViewCocoa;
|
|
|
|
namespace content {
|
|
@@ -628,10 +630,12 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
|
|
// EnsureSurfaceSynchronizedForWebTest().
|
|
uint32_t latest_capture_sequence_number_ = 0u;
|
|
|
|
+#ifndef MAS_BUILD
|
|
// Remote accessibility objects corresponding to the NSWindow that this is
|
|
// displayed to the user in.
|
|
base::scoped_nsobject<NSAccessibilityRemoteUIElement>
|
|
remote_window_accessible_;
|
|
+#endif
|
|
|
|
// Used to force the NSApplication's focused accessibility element to be the
|
|
// content::BrowserAccessibilityCocoa accessibility tree when the NSView for
|
|
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
|
index 026bb184e3ecf21185900d3102fbbdb4bc9e1100..aef2f3625465d5de36d0ce496f7133865a7ba18a 100644
|
|
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
|
@@ -233,8 +233,10 @@ RenderWidgetHostViewMac::~RenderWidgetHostViewMac() {
|
|
void RenderWidgetHostViewMac::MigrateNSViewBridge(
|
|
remote_cocoa::mojom::Application* remote_cocoa_application,
|
|
uint64_t parent_ns_view_id) {
|
|
+#ifndef MAS_BUILD
|
|
// Destroy the previous remote accessibility element.
|
|
remote_window_accessible_.reset();
|
|
+#endif
|
|
|
|
// Disconnect from the previous bridge (this will have the effect of
|
|
// destroying the associated bridge), and close the receiver (to allow it
|
|
@@ -1357,8 +1359,10 @@ RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessible() {
|
|
|
|
gfx::NativeViewAccessible
|
|
RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
|
|
+#ifndef MAS_BUILD
|
|
if (remote_window_accessible_)
|
|
return remote_window_accessible_.get();
|
|
+#endif
|
|
return [GetInProcessNSView() window];
|
|
}
|
|
|
|
@@ -1390,9 +1394,11 @@ id RenderWidgetHostViewMac::GetFocusedBrowserAccessibilityElement() {
|
|
}
|
|
|
|
void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) {
|
|
+#ifndef MAS_BUILD
|
|
// When running in-process, just use the NSView's NSWindow as its own
|
|
// accessibility element.
|
|
remote_window_accessible_.reset();
|
|
+#endif
|
|
}
|
|
|
|
bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame(
|
|
@@ -1879,12 +1885,14 @@ void RenderWidgetHostViewMac::StopSpeaking() {
|
|
|
|
void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken(
|
|
const std::vector<uint8_t>& window_token) {
|
|
+#ifndef MAS_BUILD
|
|
if (window_token.empty()) {
|
|
remote_window_accessible_.reset();
|
|
} else {
|
|
remote_window_accessible_ =
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
|
|
index 3241093ca37134435507b6cfb7d9663317563860..aace5b11a419cdbb0e257dd3ba2329e9ea013c6a 100644
|
|
--- a/ui/base/BUILD.gn
|
|
+++ b/ui/base/BUILD.gn
|
|
@@ -311,6 +311,13 @@ jumbo_component("base") {
|
|
]
|
|
}
|
|
|
|
+ if (is_mas_build) {
|
|
+ sources -= [
|
|
+ "cocoa/remote_accessibility_api.h",
|
|
+ "cocoa/remote_accessibility_api.mm",
|
|
+ ]
|
|
+ }
|
|
+
|
|
if (is_posix) {
|
|
sources += [ "l10n/l10n_util_posix.cc" ]
|
|
}
|
|
diff --git a/ui/base/cocoa/remote_accessibility_api.h b/ui/base/cocoa/remote_accessibility_api.h
|
|
index e7adfee3210ec723c687adfcc4bee8827ef643e7..25a924a47eeb30d783ef83dbb4896c4bed139a27 100644
|
|
--- a/ui/base/cocoa/remote_accessibility_api.h
|
|
+++ b/ui/base/cocoa/remote_accessibility_api.h
|
|
@@ -11,6 +11,8 @@
|
|
#include "base/component_export.h"
|
|
#include "base/mac/scoped_nsobject.h"
|
|
|
|
+#ifndef MAS_BUILD
|
|
+
|
|
@interface NSAccessibilityRemoteUIElement : NSObject
|
|
+ (void)registerRemoteUIProcessIdentifier:(int)pid;
|
|
+ (NSData*)remoteTokenForLocalUIElement:(id)element;
|
|
@@ -32,4 +34,6 @@ class COMPONENT_EXPORT(UI_BASE) RemoteAccessibility {
|
|
|
|
} // namespace ui
|
|
|
|
+#endif // MAS_BUILD
|
|
+
|
|
#endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_
|
|
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.h b/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
|
index 06427b2009ceb2cecf39d783fd1c3477cd5e66f9..1a2cd7a0e52e6345472f29283dfe94be506a338a 100644
|
|
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
|
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
|
@@ -29,7 +29,9 @@
|
|
#include "ui/views/window/dialog_observer.h"
|
|
|
|
@class NativeWidgetMacNSWindow;
|
|
+#ifndef MAS_BUILD
|
|
@class NSAccessibilityRemoteUIElement;
|
|
+#endif
|
|
@class NSView;
|
|
|
|
namespace remote_cocoa {
|
|
@@ -408,11 +410,13 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
|
|
mojo::AssociatedRemote<remote_cocoa::mojom::NativeWidgetNSWindow>
|
|
remote_ns_window_remote_;
|
|
|
|
+#ifndef MAS_BUILD
|
|
// Remote accessibility objects corresponding to the NSWindow and its root
|
|
// NSView.
|
|
base::scoped_nsobject<NSAccessibilityRemoteUIElement>
|
|
remote_window_accessible_;
|
|
base::scoped_nsobject<NSAccessibilityRemoteUIElement> remote_view_accessible_;
|
|
+#endif
|
|
|
|
// Used to force the NSApplication's focused accessibility element to be the
|
|
// views::Views accessibility tree when the NSView for this is focused.
|
|
diff --git a/ui/views/cocoa/native_widget_mac_ns_window_host.mm b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
|
index 2256c365af5b1af79458fdcb0cb9d44c9ff641fd..f4949b071a177452b0074a2436669e9846558d1a 100644
|
|
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
|
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
|
@@ -282,14 +282,22 @@ gfx::NativeViewAccessible
|
|
NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSView() const {
|
|
if (in_process_ns_window_bridge_)
|
|
return in_process_ns_window_bridge_->ns_view();
|
|
+#ifndef MAS_BUILD
|
|
return remote_view_accessible_.get();
|
|
+#else
|
|
+ return nullptr;
|
|
+#endif
|
|
}
|
|
|
|
gfx::NativeViewAccessible
|
|
NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSWindow() const {
|
|
if (in_process_ns_window_bridge_)
|
|
return in_process_ns_window_bridge_->ns_window();
|
|
+#ifndef MAS_BUILD
|
|
return remote_window_accessible_.get();
|
|
+#else
|
|
+ return nullptr;
|
|
+#endif
|
|
}
|
|
|
|
remote_cocoa::mojom::NativeWidgetNSWindow*
|
|
@@ -1118,6 +1126,7 @@ void NativeWidgetMacNSWindowHost::OnFocusWindowToolbar() {
|
|
void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
|
|
const std::vector<uint8_t>& window_token,
|
|
const std::vector<uint8_t>& view_token) {
|
|
+#ifndef MAS_BUILD
|
|
remote_window_accessible_ =
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
|
remote_view_accessible_ =
|
|
@@ -1125,14 +1134,17 @@ void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
|
|
[remote_view_accessible_ setWindowUIElement:remote_window_accessible_.get()];
|
|
[remote_view_accessible_
|
|
setTopLevelUIElement:remote_window_accessible_.get()];
|
|
+#endif
|
|
}
|
|
|
|
bool NativeWidgetMacNSWindowHost::GetRootViewAccessibilityToken(
|
|
int64_t* pid,
|
|
std::vector<uint8_t>* token) {
|
|
+#ifndef MAS_BUILD
|
|
*pid = getpid();
|
|
id element_id = GetNativeViewAccessible();
|
|
*token = ui::RemoteAccessibility::GetTokenForLocalElement(element_id);
|
|
+#endif
|
|
return true;
|
|
}
|
|
|