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-02-03 11:43:42 +00:00
|
|
|
index 447bc6bfb54484b30686db7fd9df0454f48316c8..a1b3140858ae9a456f1c07fbe60cf9ca55e78bb0 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
|
2023-02-03 11:43:42 +00:00
|
|
|
index bb0bb33745c9fa7c2c9b7ba0b03e832ad51f0829..de419f3226b586b122cb9b90d105d85a957c02d7 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-02-03 11:43:42 +00:00
|
|
|
@@ -567,10 +567,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
|
2023-02-03 11:43:42 +00:00
|
|
|
index 5fbbb7a1d56640a2bf540ecb148f358ef88c4ad2..7eb3433b6561bba527d9c69b4819e7c26388eb2d 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
|
2023-02-03 11:43:42 +00:00
|
|
|
index 22e8250d7f87d1c34854aa07f96b229caa807e17..5575c479ac6aaa92b6a637781c1cdb472b54f95c 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 {
|
|
|
|
|
2023-02-03 11:43:42 +00:00
|
|
|
@@ -617,6 +619,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-02-03 11:43:42 +00:00
|
|
|
@@ -644,6 +647,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-02-03 11:43:42 +00:00
|
|
|
index a58b06e3fa5e9008e6013565c2a58fad906c8b79..8e679d886ca90636f63b1752296fc76405f562e5 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 {
|
2023-02-03 11:43:42 +00:00
|
|
|
@@ -670,10 +672,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
|
2023-02-03 11:43:42 +00:00
|
|
|
index ab7e3a7428a2ea2ac9eb3f0e97cd4bce9c72f0ba..a557cc2b06e68e54817f154f2d1e6a7635958d0e 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-02-03 11:43:42 +00:00
|
|
|
@@ -262,8 +262,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
|
|
|
|
|
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.
|
|
|
|
@@ -1580,8 +1582,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];
|
|
|
|
}
|
|
|
|
|
2023-02-03 11:43:42 +00:00
|
|
|
@@ -1629,9 +1633,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(
|
2023-02-03 11:43:42 +00:00
|
|
|
@@ -2127,20 +2133,26 @@ void CombineTextNodesAndMakeCallback(SpeechCallback callback,
|
2022-10-03 20:21:00 +00:00
|
|
|
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
|
2023-01-06 02:35:34 +00:00
|
|
|
index acd06385277ac91670e5aa3ad386ccb6740a5a52..8ed2cd062b2e9531742835c61f015975c7d59d40 100644
|
2020-01-13 14:04:38 +00:00
|
|
|
--- a/ui/base/BUILD.gn
|
|
|
|
+++ b/ui/base/BUILD.gn
|
2023-01-06 02:35:34 +00:00
|
|
|
@@ -354,6 +354,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
|
2023-01-06 02:35:34 +00:00
|
|
|
index 1c30148ec8f091e6e35a9f849cc1935cd10f2691..3ca2b624c03ca09b75b966d63f3559d0966e5d51 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 {
|
2023-01-06 02:35:34 +00:00
|
|
|
@@ -464,11 +466,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
|
2023-02-03 11:43:42 +00:00
|
|
|
index 0cb9bea6f8d29ccacac658ccb419e3549cdc6af5..14fcb3e2daf451a7db8111aad550300235bcd168 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-01-06 02:35:34 +00:00
|
|
|
@@ -337,14 +337,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*
|
2023-02-03 11:43:42 +00:00
|
|
|
@@ -1350,6 +1358,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_ =
|
2023-02-03 11:43:42 +00:00
|
|
|
@@ -1358,14 +1367,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;
|
|
|
|
}
|
|
|
|
|