2018-10-24 18:24:11 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-09-21 00:30:26 +00:00
|
|
|
From: Cheng Zhao <zcbenz@gmail.com>
|
2018-10-09 17:37:20 +00:00
|
|
|
Date: Tue, 9 Oct 2018 10:36:20 -0700
|
2018-09-21 00:30:26 +00:00
|
|
|
Subject: mas_no_private_api.patch
|
|
|
|
|
|
|
|
Guard usages in blink of private Mac APIs by MAS_BUILD, so they can be
|
|
|
|
excluded for people who want to submit their apps to the Mac App store.
|
|
|
|
|
2020-06-22 17:35:10 +00:00
|
|
|
diff --git a/content/browser/accessibility/accessibility_tree_formatter_mac.mm b/content/browser/accessibility/accessibility_tree_formatter_mac.mm
|
2020-07-14 01:13:34 +00:00
|
|
|
index 6074fd6fb7da7c0e927fa81e8095729349520417..d6e93ab7cea23fe9592110967a1c9cfa0481551d 100644
|
2020-06-22 17:35:10 +00:00
|
|
|
--- a/content/browser/accessibility/accessibility_tree_formatter_mac.mm
|
|
|
|
+++ b/content/browser/accessibility/accessibility_tree_formatter_mac.mm
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -341,11 +341,13 @@ AccessibilityTreeFormatterMac::ParamByPropertyNode(
|
|
|
|
param = PropertyNodeToRange(property_node);
|
|
|
|
} else if (property_name == "AXIndexForChildUIElement") { // UIElement
|
|
|
|
param = PropertyNodeToUIElement(property_node, line_indexes_map);
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
} else if (property_name == "AXIndexForTextMarker") { // TextMarker
|
|
|
|
param = PropertyNodeToTextMarker(property_node, line_indexes_map);
|
|
|
|
} else if (property_name ==
|
|
|
|
"AXStringForTextMarkerRange") { // TextMarkerRange
|
|
|
|
param = PropertyNodeToTextMarkerRange(property_node, line_indexes_map);
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
return param;
|
|
|
|
@@ -433,6 +435,7 @@ AccessibilityTreeFormatterMac::PropertyNodeToUIElement(
|
|
|
|
return uielement;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
id AccessibilityTreeFormatterMac::DictNodeToTextMarker(
|
|
|
|
const PropertyNode& dictnode,
|
|
|
|
const LineIndexesMap& line_indexes_map) const {
|
|
|
|
@@ -512,6 +515,7 @@ id AccessibilityTreeFormatterMac::PropertyNodeToTextMarkerRange(
|
|
|
|
|
|
|
|
return content::AXTextMarkerRangeFrom(anchor_textmarker, focus_textmarker);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
base::Value AccessibilityTreeFormatterMac::PopulateSize(
|
|
|
|
const BrowserAccessibilityCocoa* cocoa_node) const {
|
|
|
|
@@ -573,7 +577,7 @@ base::Value AccessibilityTreeFormatterMac::PopulateObject(
|
2020-06-22 17:35:10 +00:00
|
|
|
0 == strcmp([value objCType], @encode(NSRange))) {
|
|
|
|
return PopulateRange([value rangeValue]);
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
// AXTextMarker
|
|
|
|
if (content::IsAXTextMarker(value)) {
|
|
|
|
return PopulateTextPosition(content::AXTextMarkerToPosition(value).get(),
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -584,7 +588,7 @@ base::Value AccessibilityTreeFormatterMac::PopulateObject(
|
2020-06-22 17:35:10 +00:00
|
|
|
if (content::IsAXTextMarkerRange(value)) {
|
|
|
|
return PopulateTextMarkerRange(value, line_indexes_map);
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+#endif
|
|
|
|
// Accessible object
|
|
|
|
if ([value isKindOfClass:[BrowserAccessibilityCocoa class]]) {
|
|
|
|
return base::Value(NodeToLineIndex(value, line_indexes_map));
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -635,7 +639,7 @@ base::Value AccessibilityTreeFormatterMac::PopulateTextPosition(
|
2020-06-22 17:35:10 +00:00
|
|
|
kConstValuePrefix + affinity);
|
|
|
|
return set;
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
base::Value AccessibilityTreeFormatterMac::PopulateTextMarkerRange(
|
|
|
|
id object,
|
|
|
|
const LineIndexesMap& line_indexes_map) const {
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -650,7 +654,7 @@ base::Value AccessibilityTreeFormatterMac::PopulateTextMarkerRange(
|
2020-06-22 17:35:10 +00:00
|
|
|
dict.SetPath("focus", PopulateTextPosition(range.focus(), line_indexes_map));
|
|
|
|
return dict;
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+#endif
|
|
|
|
base::Value AccessibilityTreeFormatterMac::PopulateArray(
|
|
|
|
NSArray* node_array,
|
|
|
|
const LineIndexesMap& line_indexes_map) const {
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.h b/content/browser/accessibility/browser_accessibility_cocoa.h
|
2020-07-14 01:13:34 +00:00
|
|
|
index d1d406e383d80cf7bc233c87d383084f130f73d5..f56a191cb01fbcf91f60abc312ee5277bf857929 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/content/browser/accessibility/browser_accessibility_cocoa.h
|
|
|
|
+++ b/content/browser/accessibility/browser_accessibility_cocoa.h
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -132,7 +132,9 @@ id AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker);
|
2018-09-14 05:02:16 +00:00
|
|
|
@property(nonatomic, readonly) NSNumber* enabled;
|
|
|
|
// Returns a text marker that points to the last character in the document that
|
|
|
|
// can be selected with Voiceover.
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
@property(nonatomic, readonly) id endTextMarker;
|
|
|
|
+#endif
|
|
|
|
@property(nonatomic, readonly) NSNumber* expanded;
|
|
|
|
@property(nonatomic, readonly) NSNumber* focused;
|
|
|
|
@property(nonatomic, readonly) NSNumber* grabbed;
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -143,7 +145,9 @@ id AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker);
|
2019-10-18 19:57:34 +00:00
|
|
|
@property(nonatomic, readonly, getter=isIgnored) BOOL ignored;
|
|
|
|
// Index of a row, column, or tree item.
|
|
|
|
@property(nonatomic, readonly) NSNumber* index;
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
@property(nonatomic, readonly) NSNumber* insertionPointLineNumber;
|
|
|
|
+#endif
|
|
|
|
@property(nonatomic, readonly) NSString* invalid;
|
|
|
|
@property(nonatomic, readonly) NSNumber* isMultiSelectable;
|
|
|
|
@property(nonatomic, readonly) NSString* placeholderValue;
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -166,14 +170,18 @@ id AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker);
|
2019-10-18 19:57:34 +00:00
|
|
|
// The object is selected as a whole.
|
|
|
|
@property(nonatomic, readonly) NSNumber* selected;
|
2018-09-14 05:02:16 +00:00
|
|
|
@property(nonatomic, readonly) NSArray* selectedChildren;
|
2019-10-18 19:57:34 +00:00
|
|
|
+#ifndef MAS_BUILD
|
2018-09-14 05:02:16 +00:00
|
|
|
@property(nonatomic, readonly) NSString* selectedText;
|
|
|
|
@property(nonatomic, readonly) NSValue* selectedTextRange;
|
|
|
|
@property(nonatomic, readonly) id selectedTextMarkerRange;
|
|
|
|
+#endif
|
|
|
|
@property(nonatomic, readonly) NSValue* size;
|
|
|
|
@property(nonatomic, readonly) NSString* sortDirection;
|
|
|
|
// Returns a text marker that points to the first character in the document that
|
|
|
|
// can be selected with Voiceover.
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
@property(nonatomic, readonly) id startTextMarker;
|
|
|
|
+#endif
|
|
|
|
// A string indicating the subrole of this object as far as accessibility
|
|
|
|
// is concerned.
|
|
|
|
@property(nonatomic, readonly) NSString* subrole;
|
|
|
|
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm
|
2020-07-14 01:13:34 +00:00
|
|
|
index 474ae88c323e9a10bd8486482507f0d749214963..090c8fdc3b374ed937d3e04ccd5d91772acc7d9d 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
|
|
|
|
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
|
2020-06-22 17:35:10 +00:00
|
|
|
@@ -208,6 +208,7 @@ NSString* const
|
2019-11-05 23:41:20 +00:00
|
|
|
NSString* const NSAccessibilityLengthForTextMarkerRangeParameterizedAttribute =
|
|
|
|
@"AXLengthForTextMarkerRange";
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
// Private attributes that can be used for testing text markers, e.g. in dump
|
|
|
|
// tree tests.
|
|
|
|
NSString* const
|
2020-06-22 17:35:10 +00:00
|
|
|
@@ -219,6 +220,7 @@ NSString* const
|
2019-11-05 23:41:20 +00:00
|
|
|
NSString* const
|
|
|
|
NSAccessibilityTextMarkerNodeDebugDescriptionParameterizedAttribute =
|
|
|
|
@"AXTextMarkerNodeDebugDescription";
|
2019-12-05 19:04:34 +00:00
|
|
|
+#endif
|
2019-11-05 23:41:20 +00:00
|
|
|
|
|
|
|
// Other private attributes.
|
|
|
|
NSString* const NSAccessibilitySelectTextWithCriteriaParameterizedAttribute =
|
2020-06-22 17:35:10 +00:00
|
|
|
@@ -242,6 +244,7 @@ NSDictionary* attributeToMethodNameMap = nil;
|
2018-09-14 05:02:16 +00:00
|
|
|
// VoiceOver uses -1 to mean "no limit" for AXResultsLimit.
|
|
|
|
const int kAXResultsLimitNoLimit = -1;
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
// The following are private accessibility APIs required for cursor navigation
|
2020-06-22 17:35:10 +00:00
|
|
|
@@ -470,6 +473,7 @@ NSAttributedString* GetAttributedTextForTextMarkerRange(id marker_range) {
|
2019-07-09 01:00:24 +00:00
|
|
|
AddMisspelledTextAttributes(ax_range, attributed_text);
|
2019-07-03 01:22:09 +00:00
|
|
|
return attributed_text;
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
// Returns an autoreleased copy of the AXNodeData's attribute.
|
2019-03-21 15:45:22 +00:00
|
|
|
NSString* NSStringForStringAttribute(BrowserAccessibility* browserAccessibility,
|
2020-06-22 17:35:10 +00:00
|
|
|
@@ -727,6 +731,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
|
|
|
|
#define NSAccessibilityLanguageAttribute @"AXLanguage"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
bool content::IsAXTextMarker(id object) {
|
|
|
|
if (object == nil)
|
|
|
|
return false;
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -770,6 +775,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
|
|
|
kCFAllocatorDefault, anchor_textmarker, focus_textmarker);
|
|
|
|
return [static_cast<id>(cf_marker_range) autorelease];
|
2020-06-22 17:35:10 +00:00
|
|
|
}
|
|
|
|
+#endif
|
2020-07-14 01:13:34 +00:00
|
|
|
|
2020-06-22 17:35:10 +00:00
|
|
|
@implementation BrowserAccessibilityCocoa
|
|
|
|
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -807,7 +813,9 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2018-09-14 05:02:16 +00:00
|
|
|
{NSAccessibilityEditableAncestorAttribute, @"editableAncestor"},
|
2019-02-26 21:31:29 +00:00
|
|
|
{NSAccessibilityElementBusyAttribute, @"elementBusy"},
|
2018-09-14 05:02:16 +00:00
|
|
|
{NSAccessibilityEnabledAttribute, @"enabled"},
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
{NSAccessibilityEndTextMarkerAttribute, @"endTextMarker"},
|
|
|
|
+#endif
|
|
|
|
{NSAccessibilityExpandedAttribute, @"expanded"},
|
2018-09-21 00:30:26 +00:00
|
|
|
{NSAccessibilityFocusableAncestorAttribute, @"focusableAncestor"},
|
2018-09-14 05:02:16 +00:00
|
|
|
{NSAccessibilityFocusedAttribute, @"focused"},
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -819,8 +827,10 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2019-10-18 19:57:34 +00:00
|
|
|
{NSAccessibilityHighestEditableAncestorAttribute,
|
|
|
|
@"highestEditableAncestor"},
|
|
|
|
{NSAccessibilityIndexAttribute, @"index"},
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
{NSAccessibilityInsertionPointLineNumberAttribute,
|
|
|
|
@"insertionPointLineNumber"},
|
|
|
|
+#endif
|
|
|
|
{NSAccessibilityInvalidAttribute, @"invalid"},
|
|
|
|
{NSAccessibilityIsMultiSelectableAttribute, @"isMultiSelectable"},
|
|
|
|
{NSAccessibilityLanguageAttribute, @"language"},
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -842,13 +852,17 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2018-09-14 05:02:16 +00:00
|
|
|
{NSAccessibilityRowsAttribute, @"rows"},
|
|
|
|
// TODO(aboxhall): expose
|
|
|
|
// NSAccessibilityServesAsTitleForUIElementsAttribute
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
{NSAccessibilityStartTextMarkerAttribute, @"startTextMarker"},
|
|
|
|
+#endif
|
|
|
|
{NSAccessibilitySelectedAttribute, @"selected"},
|
|
|
|
{NSAccessibilitySelectedChildrenAttribute, @"selectedChildren"},
|
2019-10-18 19:57:34 +00:00
|
|
|
+#ifndef MAS_BUILD
|
2018-09-14 05:02:16 +00:00
|
|
|
{NSAccessibilitySelectedTextAttribute, @"selectedText"},
|
|
|
|
{NSAccessibilitySelectedTextRangeAttribute, @"selectedTextRange"},
|
|
|
|
{NSAccessibilitySelectedTextMarkerRangeAttribute,
|
|
|
|
@"selectedTextMarkerRange"},
|
|
|
|
+#endif
|
|
|
|
{NSAccessibilitySizeAttribute, @"size"},
|
|
|
|
{NSAccessibilitySortDirectionAttribute, @"sortDirection"},
|
|
|
|
{NSAccessibilitySubroleAttribute, @"subrole"},
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -1336,6 +1350,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2018-09-21 00:30:26 +00:00
|
|
|
ax::mojom::Restriction::kDisabled];
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
// Returns a text marker that points to the last character in the document that
|
|
|
|
// can be selected with VoiceOver.
|
|
|
|
- (id)endTextMarker {
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -1346,6 +1361,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2018-09-14 05:02:16 +00:00
|
|
|
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
|
|
|
|
return CreateTextMarker(position->CreatePositionAtEndOfAnchor());
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
- (NSNumber*)expanded {
|
|
|
|
if (![self instanceActive])
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -1495,6 +1511,8 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2019-10-18 19:57:34 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
- (NSNumber*)insertionPointLineNumber {
|
|
|
|
if (![self instanceActive])
|
|
|
|
return nil;
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -1517,6 +1535,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2019-10-18 19:57:34 +00:00
|
|
|
caretPosition->AsTextPosition()->text_offset());
|
|
|
|
return @(std::distance(lineBreaks.begin(), iterator));
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
// Returns whether or not this node should be ignored in the
|
|
|
|
// accessibility tree.
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -2193,6 +2212,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2019-10-18 19:57:34 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
- (NSString*)selectedText {
|
|
|
|
if (![self instanceActive])
|
|
|
|
return nil;
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -2204,11 +2224,13 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2019-10-18 19:57:34 +00:00
|
|
|
return nil;
|
|
|
|
return base::SysUTF16ToNSString(range.GetText());
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
// Returns range of text under the current object that is selected.
|
|
|
|
//
|
|
|
|
// Example, caret at offset 5:
|
|
|
|
// NSRange: “pos=5 len=0”
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
- (NSValue*)selectedTextRange {
|
|
|
|
if (![self instanceActive])
|
|
|
|
return nil;
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -2229,12 +2251,15 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2019-10-18 19:57:34 +00:00
|
|
|
int selLength = range.GetText().length();
|
2018-09-14 05:02:16 +00:00
|
|
|
return [NSValue valueWithRange:NSMakeRange(selStart, selLength)];
|
|
|
|
}
|
2019-10-18 19:57:34 +00:00
|
|
|
+#endif
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
- (id)selectedTextMarkerRange {
|
|
|
|
if (![self instanceActive])
|
|
|
|
return nil;
|
2019-12-13 20:13:12 +00:00
|
|
|
return CreateTextMarkerRange(GetSelectedRange(*_owner));
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
- (NSValue*)size {
|
|
|
|
if (![self instanceActive])
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -2267,6 +2292,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2018-09-14 05:02:16 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
// Returns a text marker that points to the first character in the document that
|
|
|
|
// can be selected with VoiceOver.
|
|
|
|
- (id)startTextMarker {
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -2277,6 +2303,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2018-09-14 05:02:16 +00:00
|
|
|
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
|
|
|
|
return CreateTextMarker(position->CreatePositionAtStartOfAnchor());
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
// Returns a subrole based upon the role.
|
2019-03-21 15:45:22 +00:00
|
|
|
- (NSString*)subrole {
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -2599,11 +2626,13 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2020-04-13 23:39:26 +00:00
|
|
|
NSMutableAttributedString* attributedInnerText =
|
|
|
|
[[[NSMutableAttributedString alloc]
|
|
|
|
initWithString:base::SysUTF16ToNSString(innerText)] autorelease];
|
2018-09-14 05:02:16 +00:00
|
|
|
+#ifndef MAS_BUILD
|
2020-07-14 01:13:34 +00:00
|
|
|
if (!_owner->IsText()) {
|
2019-12-13 20:13:12 +00:00
|
|
|
AXPlatformRange ax_range(_owner->CreatePositionAt(0),
|
2020-04-13 23:39:26 +00:00
|
|
|
_owner->CreatePositionAt(int{innerText.length()}));
|
|
|
|
AddMisspelledTextAttributes(ax_range, attributedInnerText);
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
2020-04-13 23:39:26 +00:00
|
|
|
return [attributedInnerText attributedSubstringFromRange:range];
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -2707,9 +2736,8 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2019-01-08 23:59:47 +00:00
|
|
|
return ToBrowserAccessibilityCocoa(cell);
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
|
2019-08-15 20:50:58 +00:00
|
|
|
- if ([attribute
|
|
|
|
- isEqualToString:
|
|
|
|
- NSAccessibilityUIElementForTextMarkerParameterizedAttribute]) {
|
2018-09-14 05:02:16 +00:00
|
|
|
+#ifndef MAS_BUILD
|
2019-08-15 20:50:58 +00:00
|
|
|
+ if ([attribute isEqualToString:NSAccessibilityUIElementForTextMarkerParameterizedAttribute]) {
|
2018-09-14 05:02:16 +00:00
|
|
|
BrowserAccessibilityPositionInstance position =
|
|
|
|
CreatePositionFromTextMarker(parameter);
|
2019-08-15 20:50:58 +00:00
|
|
|
if (!position->IsNullPosition())
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -3022,6 +3050,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2019-08-15 20:50:58 +00:00
|
|
|
|
|
|
|
return CreateTextMarker(root->CreatePositionAt(index));
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
if ([attribute isEqualToString:
|
2019-03-21 15:45:22 +00:00
|
|
|
NSAccessibilityBoundsForRangeParameterizedAttribute]) {
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -3057,6 +3086,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2018-09-14 05:02:16 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
2019-03-21 15:45:22 +00:00
|
|
|
if ([attribute
|
|
|
|
isEqualToString:
|
|
|
|
NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute]) {
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -3171,6 +3201,7 @@ id content::AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker) {
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
return @(child->GetIndexInParent());
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
2020-07-22 05:34:34 +00:00
|
|
|
index aaf53dd214037f103ea7399d0702b1e2ffff1b56..5972939a070908521e82845b084d2d3b9f9a73f8 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
|
|
|
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
2020-07-22 05:34:34 +00:00
|
|
|
@@ -527,6 +527,7 @@ NSDictionary* BrowserAccessibilityManagerMac::
|
2018-09-14 05:02:16 +00:00
|
|
|
[user_info setObject:native_focus_object
|
|
|
|
forKey:NSAccessibilityTextChangeElement];
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
id selected_text = [native_focus_object selectedTextMarkerRange];
|
|
|
|
if (selected_text) {
|
|
|
|
NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute =
|
2020-07-22 05:34:34 +00:00
|
|
|
@@ -534,6 +535,7 @@ NSDictionary* BrowserAccessibilityManagerMac::
|
2018-09-14 05:02:16 +00:00
|
|
|
[user_info setObject:selected_text
|
|
|
|
forKey:NSAccessibilitySelectedTextMarkerRangeAttribute];
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/content/renderer/renderer_main_platform_delegate_mac.mm b/content/renderer/renderer_main_platform_delegate_mac.mm
|
2020-05-26 20:06:26 +00:00
|
|
|
index 28ca1646af0b0cce40d27baec71cbe65adc334fa..bae65c1f485bc02eb9ef2ebf7018af4a5a492397 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/content/renderer/renderer_main_platform_delegate_mac.mm
|
|
|
|
+++ b/content/renderer/renderer_main_platform_delegate_mac.mm
|
2019-04-20 17:20:37 +00:00
|
|
|
@@ -10,9 +10,11 @@
|
|
|
|
#include "sandbox/mac/seatbelt.h"
|
2018-10-24 23:25:48 +00:00
|
|
|
#include "sandbox/mac/system_services.h"
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
extern "C" {
|
2019-01-12 01:00:43 +00:00
|
|
|
CGError CGSSetDenyWindowServerConnections(bool);
|
2019-02-26 21:31:29 +00:00
|
|
|
}
|
2018-09-14 05:02:16 +00:00
|
|
|
+#endif
|
|
|
|
|
|
|
|
namespace content {
|
|
|
|
|
2020-04-08 15:59:14 +00:00
|
|
|
@@ -22,6 +24,7 @@ namespace {
|
2019-01-12 01:00:43 +00:00
|
|
|
// verifies there are no existing open connections), and then indicates that
|
|
|
|
// Chrome should continue execution without access to launchservicesd.
|
|
|
|
void DisableSystemServices() {
|
2018-09-14 05:02:16 +00:00
|
|
|
+#ifndef MAS_BUILD
|
2019-01-12 01:00:43 +00:00
|
|
|
// Tell the WindowServer that we don't want to make any future connections.
|
|
|
|
// This will return Success as long as there are no open connections, which
|
|
|
|
// is what we want.
|
2019-04-20 17:20:37 +00:00
|
|
|
@@ -29,6 +32,7 @@ void DisableSystemServices() {
|
2019-01-12 01:00:43 +00:00
|
|
|
CHECK_EQ(result, kCGErrorSuccess);
|
2018-10-24 23:25:48 +00:00
|
|
|
|
|
|
|
sandbox::DisableLaunchServices();
|
2018-09-14 05:02:16 +00:00
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
2019-04-20 17:20:37 +00:00
|
|
|
} // namespace
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
|
2020-07-15 03:07:42 +00:00
|
|
|
index 3aec8bc1fe1a619f2c4ec42ef438ae49fe0f5812..76dc23dfa26beb3b92bd87eb60fe3868ed0a703f 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/device/bluetooth/bluetooth_adapter_mac.mm
|
|
|
|
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
|
2020-06-22 17:35:10 +00:00
|
|
|
@@ -36,6 +36,7 @@
|
2018-09-21 00:30:26 +00:00
|
|
|
#include "device/bluetooth/bluetooth_low_energy_peripheral_manager_delegate.h"
|
2018-09-14 05:02:16 +00:00
|
|
|
#include "device/bluetooth/bluetooth_socket_mac.h"
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
extern "C" {
|
|
|
|
// Undocumented IOBluetooth Preference API [1]. Used by `blueutil` [2] and
|
|
|
|
// `Karabiner` [3] to programmatically control the Bluetooth state. Calling the
|
2020-06-22 17:35:10 +00:00
|
|
|
@@ -49,6 +50,7 @@ extern "C" {
|
2018-09-14 05:02:16 +00:00
|
|
|
// [4] https://support.apple.com/kb/PH25091
|
|
|
|
void IOBluetoothPreferenceSetControllerPowerState(int state);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2020-06-22 17:35:10 +00:00
|
|
|
@@ -118,8 +120,10 @@ BluetoothAdapterMac::BluetoothAdapterMac()
|
2018-09-14 05:02:16 +00:00
|
|
|
controller_state_function_(
|
|
|
|
base::BindRepeating(&BluetoothAdapterMac::GetHostControllerState,
|
|
|
|
base::Unretained(this))),
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
power_state_function_(
|
|
|
|
base::BindRepeating(IOBluetoothPreferenceSetControllerPowerState)),
|
|
|
|
+#endif
|
|
|
|
should_update_name_(true),
|
|
|
|
classic_discovery_manager_(
|
|
|
|
BluetoothDiscoveryManagerMac::CreateClassic(this)),
|
2020-07-14 01:13:34 +00:00
|
|
|
@@ -306,8 +310,12 @@ base::WeakPtr<BluetoothAdapter> BluetoothAdapterMac::GetWeakPtr() {
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BluetoothAdapterMac::SetPoweredImpl(bool powered) {
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
power_state_function_.Run(base::strict_cast<int>(powered));
|
|
|
|
return true;
|
|
|
|
+#else
|
|
|
|
+ return false;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void BluetoothAdapterMac::RemovePairingDelegateInternal(
|
|
|
|
diff --git a/media/audio/BUILD.gn b/media/audio/BUILD.gn
|
2020-07-14 01:13:34 +00:00
|
|
|
index bf4b736b05f38fb7022d0d15860d88672bd6def5..f49bb226163d74759c8f02a29abfc3e1ed17bf9f 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/media/audio/BUILD.gn
|
|
|
|
+++ b/media/audio/BUILD.gn
|
2020-04-13 23:39:26 +00:00
|
|
|
@@ -171,6 +171,12 @@ source_set("audio") {
|
2018-09-14 05:02:16 +00:00
|
|
|
"mac/scoped_audio_unit.cc",
|
|
|
|
"mac/scoped_audio_unit.h",
|
|
|
|
]
|
|
|
|
+ if (is_mas_build) {
|
|
|
|
+ sources -= [
|
|
|
|
+ "mac/coreaudio_dispatch_override.cc",
|
|
|
|
+ "mac/coreaudio_dispatch_override.h",
|
|
|
|
+ ]
|
|
|
|
+ }
|
2020-07-14 01:13:34 +00:00
|
|
|
frameworks = [
|
2018-09-14 05:02:16 +00:00
|
|
|
"AudioToolbox.framework",
|
|
|
|
"AudioUnit.framework",
|
|
|
|
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
|
2020-05-26 20:06:26 +00:00
|
|
|
index a994f74bb68d1e57ffa787e159f0a6c69e7b6953..1d84f84b59b2bae75c10c00da730022eca52d258 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/media/audio/mac/audio_manager_mac.cc
|
|
|
|
+++ b/media/audio/mac/audio_manager_mac.cc
|
2019-04-20 17:20:37 +00:00
|
|
|
@@ -882,7 +882,7 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters(
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
void AudioManagerMac::InitializeOnAudioThread() {
|
|
|
|
DCHECK(GetTaskRunner()->BelongsToCurrentThread());
|
|
|
|
- InitializeCoreAudioDispatchOverride();
|
|
|
|
+ // InitializeCoreAudioDispatchOverride();
|
|
|
|
power_observer_.reset(new AudioPowerObserver());
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
|
2020-04-24 01:55:17 +00:00
|
|
|
index d8224724a8920330ef2ff8179f87b84bb8a58045..4f61e4441e6597306140847f2de567f3f094677e 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/net/dns/dns_config_service_posix.cc
|
|
|
|
+++ b/net/dns/dns_config_service_posix.cc
|
2020-04-24 01:55:17 +00:00
|
|
|
@@ -247,6 +247,7 @@ class DnsConfigServicePosix::Watcher {
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
bool Watch() {
|
|
|
|
bool success = true;
|
|
|
|
+#ifndef MAS_BUILD
|
2020-03-11 11:15:07 +00:00
|
|
|
if (!config_watcher_.Watch(base::BindRepeating(&Watcher::OnConfigChanged,
|
|
|
|
base::Unretained(this)))) {
|
2018-09-14 05:02:16 +00:00
|
|
|
LOG(ERROR) << "DNS config watch failed to start.";
|
2020-04-24 01:55:17 +00:00
|
|
|
@@ -268,6 +269,7 @@ class DnsConfigServicePosix::Watcher {
|
2018-09-14 05:02:16 +00:00
|
|
|
DNS_CONFIG_WATCH_MAX);
|
|
|
|
}
|
|
|
|
#endif // !defined(OS_ANDROID) && !defined(OS_IOS)
|
|
|
|
+#endif
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/sandbox/mac/sandbox_compiler.cc b/sandbox/mac/sandbox_compiler.cc
|
2018-10-24 18:24:11 +00:00
|
|
|
index e524aa7b851022abed1edac39e18d8d92e5349b4..718d3f963da5c1a15a1bdb0e6043f89bc0f940f8 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/sandbox/mac/sandbox_compiler.cc
|
|
|
|
+++ b/sandbox/mac/sandbox_compiler.cc
|
|
|
|
@@ -28,6 +28,7 @@ bool SandboxCompiler::InsertStringParam(const std::string& key,
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SandboxCompiler::CompileAndApplyProfile(std::string* error) {
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
char* error_internal = nullptr;
|
|
|
|
std::vector<const char*> params;
|
|
|
|
|
|
|
|
@@ -44,6 +45,7 @@ bool SandboxCompiler::CompileAndApplyProfile(std::string* error) {
|
|
|
|
sandbox::Seatbelt::FreeError(error_internal);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/sandbox/mac/seatbelt.cc b/sandbox/mac/seatbelt.cc
|
2019-02-26 21:31:29 +00:00
|
|
|
index e0c31170acd13c9997c6b1d04c6de1420feaf422..0e561f97b33380bfbe52e64c2c4a6988095e8074 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/sandbox/mac/seatbelt.cc
|
|
|
|
+++ b/sandbox/mac/seatbelt.cc
|
|
|
|
@@ -64,7 +64,11 @@ void Seatbelt::FreeError(char* errorbuf) {
|
|
|
|
|
|
|
|
// static
|
|
|
|
bool Seatbelt::IsSandboxed() {
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
return ::sandbox_check(getpid(), NULL, 0);
|
|
|
|
+#else
|
|
|
|
+ return true;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace sandbox
|
|
|
|
diff --git a/sandbox/mac/seatbelt_extension.cc b/sandbox/mac/seatbelt_extension.cc
|
2020-05-26 20:06:26 +00:00
|
|
|
index 84c7370a3bb98aa29cdc04730a25148c3adc162a..5175c2c210e13e41224ae7268528c595c35cc4dc 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/sandbox/mac/seatbelt_extension.cc
|
|
|
|
+++ b/sandbox/mac/seatbelt_extension.cc
|
2020-05-26 20:06:26 +00:00
|
|
|
@@ -11,6 +11,7 @@
|
|
|
|
#include "base/notreached.h"
|
2018-09-14 05:02:16 +00:00
|
|
|
#include "sandbox/mac/seatbelt_extension_token.h"
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
// libsandbox private API.
|
|
|
|
extern "C" {
|
|
|
|
extern const char* APP_SANDBOX_READ;
|
2020-05-26 20:06:26 +00:00
|
|
|
@@ -21,6 +22,7 @@ char* sandbox_extension_issue_file(const char* type,
|
2018-09-14 05:02:16 +00:00
|
|
|
const char* path,
|
|
|
|
uint32_t flags);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
namespace sandbox {
|
|
|
|
|
2020-05-26 20:06:26 +00:00
|
|
|
@@ -49,7 +51,11 @@ std::unique_ptr<SeatbeltExtension> SeatbeltExtension::FromToken(
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
bool SeatbeltExtension::Consume() {
|
|
|
|
DCHECK(!token_.empty());
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
handle_ = sandbox_extension_consume(token_.c_str());
|
|
|
|
+#else
|
|
|
|
+ handle_ = -1;
|
|
|
|
+#endif
|
|
|
|
return handle_ > 0;
|
|
|
|
}
|
|
|
|
|
2020-05-26 20:06:26 +00:00
|
|
|
@@ -61,7 +67,11 @@ bool SeatbeltExtension::ConsumePermanently() {
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool SeatbeltExtension::Revoke() {
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
int rv = sandbox_extension_release(handle_);
|
|
|
|
+#else
|
|
|
|
+ int rv = -1;
|
|
|
|
+#endif
|
|
|
|
handle_ = 0;
|
|
|
|
token_.clear();
|
|
|
|
return rv == 0;
|
2020-05-26 20:06:26 +00:00
|
|
|
@@ -79,9 +89,11 @@ SeatbeltExtension::SeatbeltExtension(const std::string& token)
|
2018-09-14 05:02:16 +00:00
|
|
|
char* SeatbeltExtension::IssueToken(SeatbeltExtension::Type type,
|
|
|
|
const std::string& resource) {
|
|
|
|
switch (type) {
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
case FILE_READ:
|
|
|
|
return sandbox_extension_issue_file(APP_SANDBOX_READ, resource.c_str(),
|
|
|
|
0);
|
|
|
|
+#endif
|
|
|
|
default:
|
|
|
|
NOTREACHED();
|
|
|
|
return nullptr;
|