2020-01-13 14:04:38 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Cheng Zhao <zcbenz@gmail.com>
|
|
|
|
Date: Thu, 20 Sep 2018 17:48:49 -0700
|
2021-05-19 18:20:12 +00:00
|
|
|
Subject: mas: avoid usage of NSAccessibilityRemoteUIElement
|
2020-01-13 14:04:38 +00:00
|
|
|
|
|
|
|
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
|
2023-08-15 15:49:41 +00:00
|
|
|
index 5a096477c123a782341115f964c4975301ccaf9a..ecfbb3b405425af346a6ba6788fc1d8ff89760cd 100644
|
2020-01-13 14:04:38 +00:00
|
|
|
--- a/components/remote_cocoa/app_shim/application_bridge.mm
|
|
|
|
+++ b/components/remote_cocoa/app_shim/application_bridge.mm
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -51,6 +51,7 @@
|
2020-01-13 14:04:38 +00:00
|
|
|
|
|
|
|
// NativeWidgetNSWindowHostHelper:
|
|
|
|
id GetNativeViewAccessible() override {
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
if (!remote_accessibility_element_) {
|
2023-03-10 16:07:42 +00:00
|
|
|
int64_t browser_pid = 0;
|
2020-01-13 14:04:38 +00:00
|
|
|
std::vector<uint8_t> element_token;
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -61,6 +62,9 @@ id GetNativeViewAccessible() override {
|
2023-07-16 14:14:43 +00:00
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
|
2020-01-13 14:04:38 +00:00
|
|
|
}
|
2023-07-16 14:14:43 +00:00
|
|
|
return remote_accessibility_element_;
|
2020-01-13 14:04:38 +00:00
|
|
|
+#else
|
|
|
|
+ return nil;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
void DispatchKeyEvent(ui::KeyEvent* event) override {
|
|
|
|
bool event_handled = false;
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -99,7 +103,9 @@ void GetWordAt(const gfx::Point& location_in_content,
|
2020-01-13 14:04:38 +00:00
|
|
|
mojo::AssociatedRemote<mojom::TextInputHost> text_input_host_remote_;
|
|
|
|
|
|
|
|
std::unique_ptr<NativeWidgetNSWindowBridge> bridge_;
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2023-07-16 14:14:43 +00:00
|
|
|
NSAccessibilityRemoteUIElement* __strong remote_accessibility_element_;
|
2020-01-13 14:04:38 +00:00
|
|
|
+#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
|
2023-08-15 15:49:41 +00:00
|
|
|
index c4285bf227abf1536213835ebdb8ca16d2638263..73c27518cab1efbbd2e4ec334b8685bd25d6d693 100644
|
2020-01-13 14:04:38 +00:00
|
|
|
--- a/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
|
|
|
+++ b/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -587,10 +587,12 @@ NSUInteger CountBridgedWindows(NSArray* child_windows) {
|
2020-01-13 14:04:38 +00:00
|
|
|
// this should be treated as an error and caught early.
|
|
|
|
CHECK(bridged_view_);
|
|
|
|
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
// 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
|
2023-07-16 14:14:43 +00:00
|
|
|
// https://crrev.com/c/1236675. The ordering of unassociated layers relative
|
2020-01-13 14:04:38 +00:00
|
|
|
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
|
2023-08-15 15:49:41 +00:00
|
|
|
index 8fe41069ae9578a75469b40413b8e796792527cf..c5da46f4cc173eeb28c58bc464acd55ec9e4fc9e 100644
|
2020-01-13 14:04:38 +00:00
|
|
|
--- a/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
|
|
|
+++ b/content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -86,8 +86,10 @@ id GetFocusedBrowserAccessibilityElement() override {
|
2020-01-13 14:04:38 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
void SetAccessibilityWindow(NSWindow* window) override {
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
host_->SetRemoteAccessibilityWindowToken(
|
|
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(window));
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& key_event,
|
2022-07-13 21:26:16 +00:00
|
|
|
diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
2023-08-15 15:49:41 +00:00
|
|
|
index 45aeb6838a859f57287bec51f79a4eb77d69b619..6f5c28de251d4f6db9b07b37d0b513c2cc2826b3 100644
|
2022-07-13 21:26:16 +00:00
|
|
|
--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
|
|
|
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
2023-07-16 14:14:43 +00:00
|
|
|
@@ -21,7 +21,9 @@
|
2022-07-13 21:26:16 +00:00
|
|
|
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
|
|
|
|
#include "ui/accessibility/ax_role_properties.h"
|
|
|
|
#include "ui/accessibility/platform/ax_private_webkit_constants_mac.h"
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2022-07-13 21:26:16 +00:00
|
|
|
#include "ui/base/cocoa/remote_accessibility_api.h"
|
|
|
|
+#endif
|
|
|
|
|
2023-08-15 15:49:41 +00:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
@@ -224,6 +226,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
2023-03-10 16:07:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#if !IS_MAS_BUILD()
|
|
|
|
BrowserAccessibilityManager* root_manager = GetManagerForRootFrame();
|
|
|
|
if (root_manager) {
|
|
|
|
BrowserAccessibilityManagerMac* root_manager_mac =
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -246,6 +249,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
2023-03-10 16:07:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
2023-07-16 14:14:43 +00:00
|
|
|
// Use native VoiceOver support for live regions.
|
|
|
|
BrowserAccessibilityCocoa* retained_node = native_node;
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -627,6 +631,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
2022-07-13 21:26:16 +00:00
|
|
|
if ([NSApp isActive])
|
|
|
|
return window == [NSApp accessibilityFocusedWindow];
|
|
|
|
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2022-07-13 21:26:16 +00:00
|
|
|
// TODO(accessibility): We need a solution to the problem described below.
|
|
|
|
// If the window is NSAccessibilityRemoteUIElement, there are some challenges:
|
|
|
|
// 1. NSApp is the browser which spawned the PWA, and what it considers the
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -654,6 +659,7 @@ void PostAnnouncementNotification(NSString* announcement,
|
2022-07-13 21:26:16 +00:00
|
|
|
// from within the app shim content.
|
|
|
|
if ([window isKindOfClass:[NSAccessibilityRemoteUIElement class]])
|
|
|
|
return true;
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2020-01-13 14:04:38 +00:00
|
|
|
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h
|
2023-08-15 15:49:41 +00:00
|
|
|
index fd35d3a94113f1337b097cfa4bf40d8330504e5a..04bd16db3b8a23b9e5d90ced459c440a34ffa375 100644
|
2020-01-13 14:04:38 +00:00
|
|
|
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
|
|
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -49,7 +49,9 @@ class ScopedPasswordInputEnabler;
|
2020-01-13 14:04:38 +00:00
|
|
|
|
|
|
|
@protocol RenderWidgetHostViewMacDelegate;
|
|
|
|
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
@class NSAccessibilityRemoteUIElement;
|
|
|
|
+#endif
|
|
|
|
@class RenderWidgetHostViewCocoa;
|
|
|
|
|
|
|
|
namespace content {
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -667,9 +669,11 @@ class CONTENT_EXPORT RenderWidgetHostViewMac
|
2020-01-13 14:04:38 +00:00
|
|
|
// EnsureSurfaceSynchronizedForWebTest().
|
|
|
|
uint32_t latest_capture_sequence_number_ = 0u;
|
|
|
|
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
// Remote accessibility objects corresponding to the NSWindow that this is
|
|
|
|
// displayed to the user in.
|
2023-07-16 14:14:43 +00:00
|
|
|
NSAccessibilityRemoteUIElement* __strong remote_window_accessible_;
|
2020-01-13 14:04:38 +00:00
|
|
|
+#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
|
2023-08-15 15:49:41 +00:00
|
|
|
index b8d1f98c9c7c5831677d4c200aa085a4a168273c..7f2b627031f65ad45a8ad182d3b7421005893ff4 100644
|
2020-01-13 14:04:38 +00:00
|
|
|
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
|
|
|
|
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -263,8 +263,10 @@
|
2020-01-13 14:04:38 +00:00
|
|
|
void RenderWidgetHostViewMac::MigrateNSViewBridge(
|
|
|
|
remote_cocoa::mojom::Application* remote_cocoa_application,
|
|
|
|
uint64_t parent_ns_view_id) {
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
// Destroy the previous remote accessibility element.
|
2023-07-16 14:14:43 +00:00
|
|
|
remote_window_accessible_ = nil;
|
2020-01-13 14:04:38 +00:00
|
|
|
+#endif
|
|
|
|
|
2023-02-03 11:43:42 +00:00
|
|
|
// Reset `ns_view_` before resetting `remote_ns_view_` to avoid dangling
|
|
|
|
// pointers. `ns_view_` gets reinitialized later in this method.
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -1614,8 +1616,10 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
2020-01-13 14:04:38 +00:00
|
|
|
|
|
|
|
gfx::NativeViewAccessible
|
|
|
|
RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
if (remote_window_accessible_)
|
2023-07-16 14:14:43 +00:00
|
|
|
return remote_window_accessible_;
|
2020-01-13 14:04:38 +00:00
|
|
|
+#endif
|
|
|
|
return [GetInProcessNSView() window];
|
|
|
|
}
|
|
|
|
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -1659,9 +1663,11 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
2020-01-13 14:04:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) {
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
// When running in-process, just use the NSView's NSWindow as its own
|
|
|
|
// accessibility element.
|
2023-07-16 14:14:43 +00:00
|
|
|
remote_window_accessible_ = nil;
|
2020-01-13 14:04:38 +00:00
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame(
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -2163,12 +2169,14 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
2020-01-13 14:04:38 +00:00
|
|
|
|
|
|
|
void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken(
|
|
|
|
const std::vector<uint8_t>& window_token) {
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
if (window_token.empty()) {
|
2023-07-16 14:14:43 +00:00
|
|
|
remote_window_accessible_ = nil;
|
2020-01-13 14:04:38 +00:00
|
|
|
} else {
|
2023-07-16 14:14:43 +00:00
|
|
|
remote_window_accessible_ =
|
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
2020-01-13 14:04:38 +00:00
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
|
2023-08-15 15:49:41 +00:00
|
|
|
index 121d8798571233799624a1e187b0f0edfdb9ca98..9233e89712a12e27d85232fb51f113f41375a08a 100644
|
2020-01-13 14:04:38 +00:00
|
|
|
--- a/ui/base/BUILD.gn
|
|
|
|
+++ b/ui/base/BUILD.gn
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -373,6 +373,13 @@ component("base") {
|
2022-05-17 16:48:40 +00:00
|
|
|
sources += [ "resource/resource_bundle_lacros.cc" ]
|
2020-01-13 14:04:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ if (is_mas_build) {
|
|
|
|
+ sources -= [
|
|
|
|
+ "cocoa/remote_accessibility_api.h",
|
|
|
|
+ "cocoa/remote_accessibility_api.mm",
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+
|
2020-10-28 00:33:04 +00:00
|
|
|
if (is_ios) {
|
|
|
|
sources += [
|
|
|
|
"device_form_factor_ios.mm",
|
2020-01-13 14:04:38 +00:00
|
|
|
diff --git a/ui/base/cocoa/remote_accessibility_api.h b/ui/base/cocoa/remote_accessibility_api.h
|
2023-06-09 23:08:36 +00:00
|
|
|
index 835cce73b7ab8b38c37d3e2650e12303d9d918e3..4460a00497dfaee0ba90cd5d14888055ed8a2830 100644
|
2020-01-13 14:04:38 +00:00
|
|
|
--- a/ui/base/cocoa/remote_accessibility_api.h
|
|
|
|
+++ b/ui/base/cocoa/remote_accessibility_api.h
|
2023-06-09 23:08:36 +00:00
|
|
|
@@ -13,6 +13,8 @@
|
|
|
|
|
|
|
|
// NSAccessibilityRemoteUIElement is a private class in AppKit.
|
2020-01-13 14:04:38 +00:00
|
|
|
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
+
|
|
|
|
@interface NSAccessibilityRemoteUIElement : NSObject
|
|
|
|
+ (void)registerRemoteUIProcessIdentifier:(int)pid;
|
2023-03-10 16:07:42 +00:00
|
|
|
+ (NSData*)remoteTokenForLocalUIElement:(id)element;
|
2023-06-09 23:08:36 +00:00
|
|
|
@@ -34,4 +36,6 @@ class COMPONENT_EXPORT(UI_BASE) RemoteAccessibility {
|
2020-01-13 14:04:38 +00:00
|
|
|
|
|
|
|
} // 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
|
2023-08-15 15:49:41 +00:00
|
|
|
index 58f1b79111a0be5102976c3e257375c409c1c4be..be0306b98feb451fefeec70becbcf51612d22283 100644
|
2020-01-13 14:04:38 +00:00
|
|
|
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
|
|
|
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.h
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -30,7 +30,9 @@
|
|
|
|
#include "ui/views/window/dialog_observer.h"
|
2020-01-13 14:04:38 +00:00
|
|
|
|
|
|
|
@class NativeWidgetMacNSWindow;
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
@class NSAccessibilityRemoteUIElement;
|
|
|
|
+#endif
|
|
|
|
@class NSView;
|
|
|
|
|
|
|
|
namespace remote_cocoa {
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -450,10 +452,12 @@ class VIEWS_EXPORT NativeWidgetMacNSWindowHost
|
2020-01-13 14:04:38 +00:00
|
|
|
mojo::AssociatedRemote<remote_cocoa::mojom::NativeWidgetNSWindow>
|
|
|
|
remote_ns_window_remote_;
|
|
|
|
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
// Remote accessibility objects corresponding to the NSWindow and its root
|
|
|
|
// NSView.
|
2023-07-16 14:14:43 +00:00
|
|
|
NSAccessibilityRemoteUIElement* __strong remote_window_accessible_;
|
|
|
|
NSAccessibilityRemoteUIElement* __strong remote_view_accessible_;
|
2020-01-13 14:04:38 +00:00
|
|
|
+#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
|
2023-08-15 15:49:41 +00:00
|
|
|
index 42b7016e880b26e2cc8b9da14917907d4826440c..f6b588c059d6706155144f3b0a9a8861d8f1146d 100644
|
2020-01-13 14:04:38 +00:00
|
|
|
--- a/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
|
|
|
+++ b/ui/views/cocoa/native_widget_mac_ns_window_host.mm
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -339,7 +339,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
2020-01-13 14:04:38 +00:00
|
|
|
NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSView() const {
|
|
|
|
if (in_process_ns_window_bridge_)
|
|
|
|
return in_process_ns_window_bridge_->ns_view();
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2023-07-16 14:14:43 +00:00
|
|
|
return remote_view_accessible_;
|
2020-01-13 14:04:38 +00:00
|
|
|
+#else
|
|
|
|
+ return nullptr;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
gfx::NativeViewAccessible
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -354,7 +358,11 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
2023-05-23 19:58:58 +00:00
|
|
|
return [in_process_ns_window_bridge_->ns_view() window];
|
|
|
|
}
|
|
|
|
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2023-07-16 14:14:43 +00:00
|
|
|
return remote_window_accessible_;
|
2020-01-13 14:04:38 +00:00
|
|
|
+#else
|
|
|
|
+ return nullptr;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
remote_cocoa::mojom::NativeWidgetNSWindow*
|
2023-08-15 15:49:41 +00:00
|
|
|
@@ -1326,20 +1334,24 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
2020-01-13 14:04:38 +00:00
|
|
|
void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
|
|
|
|
const std::vector<uint8_t>& window_token,
|
|
|
|
const std::vector<uint8_t>& view_token) {
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2023-07-16 14:14:43 +00:00
|
|
|
remote_window_accessible_ =
|
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
|
|
|
remote_view_accessible_ =
|
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(view_token);
|
|
|
|
[remote_view_accessible_ setWindowUIElement:remote_window_accessible_];
|
|
|
|
[remote_view_accessible_ setTopLevelUIElement:remote_window_accessible_];
|
2020-01-13 14:04:38 +00:00
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWidgetMacNSWindowHost::GetRootViewAccessibilityToken(
|
2023-03-10 16:07:42 +00:00
|
|
|
int64_t* pid,
|
2020-01-13 14:04:38 +00:00
|
|
|
std::vector<uint8_t>* token) {
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
*pid = getpid();
|
|
|
|
id element_id = GetNativeViewAccessible();
|
|
|
|
*token = ui::RemoteAccessibility::GetTokenForLocalElement(element_id);
|
|
|
|
+#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|