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
|
2022-11-14 20:46:52 +00:00
|
|
|
index 89b9323c08cfed0d3ea3a0ec1beaa0bdfabe343e..69ae95eb8537bab751d27749d6cf392a8419f317 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
|
2022-02-10 02:58:52 +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_) {
|
2022-10-03 20:21:00 +00:00
|
|
|
base::ProcessId browser_pid = base::kNullProcessId;
|
2020-01-13 14:04:38 +00:00
|
|
|
std::vector<uint8_t> element_token;
|
2022-02-10 02:58:52 +00:00
|
|
|
@@ -61,6 +62,9 @@ id GetNativeViewAccessible() override {
|
2020-01-13 14:04:38 +00:00
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
|
|
|
|
}
|
|
|
|
return remote_accessibility_element_.get();
|
|
|
|
+#else
|
|
|
|
+ return nil;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
void DispatchKeyEvent(ui::KeyEvent* event) override {
|
|
|
|
bool event_handled = false;
|
2022-02-10 02:58:52 +00:00
|
|
|
@@ -99,8 +103,10 @@ 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()
|
2020-01-13 14:04:38 +00:00
|
|
|
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
|
2022-12-05 22:59:19 +00:00
|
|
|
index 7fcbaf1f8165197847326025f1c01f07dad52ea4..92162dc6c7b9ebfd65be9c5d6ee2a9e0b0b93db3 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
|
2022-10-17 14:22:24 +00:00
|
|
|
@@ -566,10 +566,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
|
|
|
|
// 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
|
2022-11-14 20:46:52 +00:00
|
|
|
index abd19b8613e52a6f4c9404f509ab7ed5a61046a6..8c69b989882084946bb821e1d64d75657f17ab26 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
|
2022-10-03 20:21:00 +00:00
|
|
|
@@ -77,6 +77,7 @@ explicit RenderWidgetHostNSViewBridgeOwner(
|
|
|
|
|
|
|
|
// RenderWidgetHostNSViewHostHelper implementation.
|
|
|
|
id GetAccessibilityElement() override {
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2022-10-03 20:21:00 +00:00
|
|
|
if (!remote_accessibility_element_) {
|
|
|
|
base::ProcessId browser_pid = base::kNullProcessId;
|
|
|
|
std::vector<uint8_t> element_token;
|
|
|
|
@@ -87,6 +88,9 @@ id GetAccessibilityElement() override {
|
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
|
|
|
|
}
|
|
|
|
return remote_accessibility_element_.get();
|
|
|
|
+#else
|
|
|
|
+ return nil;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
id GetRootBrowserAccessibilityElement() override {
|
|
|
|
@@ -100,8 +104,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-10-03 20:21:00 +00:00
|
|
|
@@ -163,8 +169,10 @@ void SmartMagnify(const blink::WebGestureEvent& web_event) override {
|
2020-01-13 14:04:38 +00:00
|
|
|
|
|
|
|
mojo::AssociatedRemote<mojom::RenderWidgetHostNSViewHost> host_;
|
|
|
|
std::unique_ptr<RenderWidgetHostNSViewBridge> bridge_;
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
base::scoped_nsobject<NSAccessibilityRemoteUIElement>
|
|
|
|
remote_accessibility_element_;
|
|
|
|
+#endif
|
|
|
|
};
|
2021-11-24 08:45:59 +00:00
|
|
|
}
|
|
|
|
|
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
|
2022-11-14 20:46:52 +00:00
|
|
|
index 67473b500bc8305bc21ec0324001ea5a64612aee..859e45bd6f4f130947e0718e32fea4abe8fe3a8c 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
|
2022-10-17 14:22:24 +00:00
|
|
|
@@ -22,7 +22,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
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2022-10-17 14:22:24 +00:00
|
|
|
@@ -621,6 +623,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
|
2022-10-17 14:22:24 +00:00
|
|
|
@@ -648,6 +651,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
|
2022-11-14 20:46:52 +00:00
|
|
|
index c1f2725cf74fe8845843461518a849f2cbf2c024..c9f489a8603a63dc2641fbd435c4ab1de9fafbd3 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
|
2022-09-07 07:46:37 +00:00
|
|
|
@@ -52,7 +52,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 {
|
2022-10-03 20:21:00 +00:00
|
|
|
@@ -671,10 +673,12 @@ 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.
|
|
|
|
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
|
2022-12-05 22:59:19 +00:00
|
|
|
index e27191c89a3be5fd21be4403a5e183e5dd12d383..07dcac920740a029dfc69c123506bafd142eb4ef 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
|
2022-10-03 20:21:00 +00:00
|
|
|
@@ -260,8 +260,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.
|
|
|
|
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
|
2022-10-03 20:21:00 +00:00
|
|
|
@@ -1574,8 +1576,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_)
|
|
|
|
return remote_window_accessible_.get();
|
|
|
|
+#endif
|
|
|
|
return [GetInProcessNSView() window];
|
|
|
|
}
|
|
|
|
|
2022-10-03 20:21:00 +00:00
|
|
|
@@ -1623,9 +1627,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.
|
|
|
|
remote_window_accessible_.reset();
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame(
|
2022-10-03 20:21:00 +00:00
|
|
|
@@ -2121,20 +2127,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
|
|
|
void RenderWidgetHostViewMac::GetRenderWidgetAccessibilityToken(
|
|
|
|
GetRenderWidgetAccessibilityTokenCallback callback) {
|
|
|
|
base::ProcessId pid = getpid();
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2022-10-03 20:21:00 +00:00
|
|
|
id element_id = GetNativeViewAccessible();
|
|
|
|
std::vector<uint8_t> token =
|
|
|
|
ui::RemoteAccessibility::GetTokenForLocalElement(element_id);
|
|
|
|
+#else
|
|
|
|
+ std::vector<uint8_t> token;
|
|
|
|
+#endif
|
|
|
|
std::move(callback).Run(pid, token);
|
|
|
|
}
|
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()) {
|
|
|
|
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
|
2022-11-17 19:59:23 +00:00
|
|
|
index 5aaee8318049cf35afaaa45fe189baf8a2418c49..e8b06c7fa14405902abc84dc738efdbb327a3677 100644
|
2020-01-13 14:04:38 +00:00
|
|
|
--- a/ui/base/BUILD.gn
|
|
|
|
+++ b/ui/base/BUILD.gn
|
2022-10-03 20:21:00 +00:00
|
|
|
@@ -353,6 +353,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
|
2022-11-14 20:46:52 +00:00
|
|
|
index 4d47115d3f72da17b2ada8866770ac24717c29da..506d7847d904478793d992dbe548a61177644d09 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
|
|
|
|
@@ -11,6 +11,8 @@
|
2020-05-26 20:06:26 +00:00
|
|
|
#include "base/component_export.h"
|
2020-01-13 14:04:38 +00:00
|
|
|
#include "base/mac/scoped_nsobject.h"
|
|
|
|
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
+
|
|
|
|
@interface NSAccessibilityRemoteUIElement : NSObject
|
2022-10-03 20:21:00 +00:00
|
|
|
+ (void)setRemoteUIApp:(BOOL)flag;
|
2020-01-13 14:04:38 +00:00
|
|
|
+ (void)registerRemoteUIProcessIdentifier:(int)pid;
|
2022-10-03 20:21:00 +00:00
|
|
|
@@ -33,4 +35,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
|
2022-11-14 20:46:52 +00:00
|
|
|
index f6d8e8847203d705aea9f581bab84c361a6164c9..4130f1bced39af36f9761613a1d1cbcddf922dd2 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
|
2022-07-13 21:26:16 +00:00
|
|
|
@@ -32,7 +32,9 @@
|
2020-01-13 14:04:38 +00:00
|
|
|
#include "ui/views/window/dialog_observer.h"
|
|
|
|
|
|
|
|
@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 {
|
2022-10-03 20:21:00 +00:00
|
|
|
@@ -463,11 +465,13 @@ 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.
|
|
|
|
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
|
2022-11-14 20:46:52 +00:00
|
|
|
index 020c952ea07bd67b3acefe33c73e7c1aed598fea..3bf8849e269b62d9a5a2389b2e45433b3acf8448 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
|
2022-10-27 16:37:04 +00:00
|
|
|
@@ -336,14 +336,22 @@ 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()
|
2020-01-13 14:04:38 +00:00
|
|
|
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();
|
2022-11-14 20:46:52 +00:00
|
|
|
+#if !IS_MAS_BUILD()
|
2020-01-13 14:04:38 +00:00
|
|
|
return remote_window_accessible_.get();
|
|
|
|
+#else
|
|
|
|
+ return nullptr;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
remote_cocoa::mojom::NativeWidgetNSWindow*
|
2022-10-27 16:37:04 +00:00
|
|
|
@@ -1328,6 +1336,7 @@ 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()
|
2020-01-13 14:04:38 +00:00
|
|
|
remote_window_accessible_ =
|
|
|
|
ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
|
|
|
|
remote_view_accessible_ =
|
2022-10-27 16:37:04 +00:00
|
|
|
@@ -1336,14 +1345,17 @@ void HandleAccelerator(const ui::Accelerator& accelerator,
|
2020-01-13 14:04:38 +00:00
|
|
|
[remote_view_accessible_
|
|
|
|
setTopLevelUIElement:remote_window_accessible_.get()];
|
2022-10-03 20:21:00 +00:00
|
|
|
[NSAccessibilityRemoteUIElement setRemoteUIApp:YES];
|
2020-01-13 14:04:38 +00:00
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NativeWidgetMacNSWindowHost::GetRootViewAccessibilityToken(
|
2022-10-03 20:21:00 +00:00
|
|
|
base::ProcessId* 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;
|
|
|
|
}
|
|
|
|
|