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
|
2021-03-04 23:46:13 +00:00
|
|
|
index f0824ada891710245f5ff8278f27613165a5f6bf..b4a70a2cfc41957846d26bdeb586bf086cd315ca 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
|
2021-01-12 23:31:23 +00:00
|
|
|
@@ -238,7 +238,7 @@
|
|
|
|
return PopulateSize([value sizeValue]);
|
|
|
|
}
|
2020-06-22 17:35:10 +00:00
|
|
|
}
|
|
|
|
-
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
// AXTextMarker
|
|
|
|
if (content::IsAXTextMarker(value)) {
|
2021-03-04 23:46:13 +00:00
|
|
|
return PopulateTextPosition(content::AXTextMarkerToAXPosition(value),
|
2021-01-12 23:31:23 +00:00
|
|
|
@@ -249,6 +249,7 @@
|
2020-06-22 17:35:10 +00:00
|
|
|
if (content::IsAXTextMarkerRange(value)) {
|
2020-09-21 08:00:36 +00:00
|
|
|
return PopulateTextMarkerRange(value, line_indexer);
|
2020-06-22 17:35:10 +00:00
|
|
|
}
|
|
|
|
+#endif
|
2020-10-16 01:30:41 +00:00
|
|
|
|
|
|
|
// AXValue
|
|
|
|
if (CFGetTypeID(value) == AXValueGetTypeID()) {
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -361,7 +362,7 @@
|
2020-06-22 17:35:10 +00:00
|
|
|
kConstValuePrefix + affinity);
|
|
|
|
return set;
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
base::Value AccessibilityTreeFormatterMac::PopulateTextMarkerRange(
|
2021-03-04 23:46:13 +00:00
|
|
|
id marker_range,
|
2020-09-21 08:00:36 +00:00
|
|
|
const LineIndexer* line_indexer) const {
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -377,7 +378,7 @@
|
|
|
|
PopulateTextPosition(ax_range.focus()->Clone(), line_indexer));
|
2020-06-22 17:35:10 +00:00
|
|
|
return dict;
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+#endif
|
|
|
|
base::Value AccessibilityTreeFormatterMac::PopulateArray(
|
|
|
|
NSArray* node_array,
|
2020-09-21 08:00:36 +00:00
|
|
|
const LineIndexer* line_indexer) const {
|
2020-08-15 01:51:28 +00:00
|
|
|
diff --git a/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm b/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm
|
2021-03-04 23:46:13 +00:00
|
|
|
index 88f339d1669436db9c1e4d048a46fc28038c83fe..2e194c5174c24552eb684faa339ad92b640d9dd7 100644
|
2020-08-15 01:51:28 +00:00
|
|
|
--- a/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm
|
|
|
|
+++ b/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm
|
2021-01-12 23:31:23 +00:00
|
|
|
@@ -234,6 +234,7 @@
|
2020-08-15 01:51:28 +00:00
|
|
|
if (property_name == "AXIndexForChildUIElement") { // UIElement
|
|
|
|
return OptionalNSObject::NotNilOrError(PropertyNodeToUIElement(arg_node));
|
|
|
|
}
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
if (property_name == "AXIndexForTextMarker") { // TextMarker
|
|
|
|
return OptionalNSObject::NotNilOrError(PropertyNodeToTextMarker(arg_node));
|
|
|
|
}
|
2021-01-12 23:31:23 +00:00
|
|
|
@@ -241,6 +242,7 @@
|
2020-08-15 01:51:28 +00:00
|
|
|
return OptionalNSObject::NotNilOrError(
|
|
|
|
PropertyNodeToTextMarkerRange(arg_node));
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
return OptionalNSObject::NotApplicable();
|
|
|
|
}
|
2021-01-12 23:31:23 +00:00
|
|
|
@@ -306,6 +308,7 @@
|
2020-08-15 01:51:28 +00:00
|
|
|
return uielement;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
2020-11-14 00:16:56 +00:00
|
|
|
id AttributeInvoker::DictNodeToTextMarker(
|
|
|
|
const AXPropertyNode& dictnode) const {
|
2020-08-15 01:51:28 +00:00
|
|
|
if (!dictnode.IsDict()) {
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -413,6 +416,7 @@ OptionalNSObject TextMarkerRangeGetEndMarker(const OptionalNSObject& obj) {
|
2020-11-14 00:16:56 +00:00
|
|
|
return OptionalNSObject::NotNilOrError(content::AXTextMarkerFrom(
|
2021-03-04 23:46:13 +00:00
|
|
|
cocoa_node, range.focus()->text_offset(), range.focus()->affinity()));
|
2020-08-15 01:51:28 +00:00
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
2020-11-14 00:16:56 +00:00
|
|
|
OptionalNSObject MakePairArray(const OptionalNSObject& obj1,
|
|
|
|
const OptionalNSObject& obj2) {
|
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
|
2021-03-15 18:32:18 +00:00
|
|
|
index eff8d3fe2d47c519952e74ca2d6238ad39429d74..ef74a8983171bb720e4be7b1efa0b1350550727d 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
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -157,7 +157,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker);
|
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;
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -169,7 +171,9 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker);
|
2019-10-18 19:57:34 +00:00
|
|
|
// Index of a row, column, or tree item.
|
|
|
|
@property(nonatomic, readonly) NSNumber* index;
|
2020-10-16 01:30:41 +00:00
|
|
|
@property(nonatomic, readonly) NSNumber* treeItemRowIndex;
|
2019-10-18 19:57:34 +00:00
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
@property(nonatomic, readonly) NSNumber* insertionPointLineNumber;
|
|
|
|
+#endif
|
|
|
|
@property(nonatomic, readonly) NSString* invalid;
|
|
|
|
@property(nonatomic, readonly) NSNumber* isMultiSelectable;
|
|
|
|
@property(nonatomic, readonly) NSString* placeholderValue;
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -192,14 +196,18 @@ id AXTextMarkerRangeFrom(id anchor_text_marker, id focus_text_marker);
|
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
|
2021-03-15 18:32:18 +00:00
|
|
|
index 86e56961584a26746cc254e8d0f53fe29f62fdb9..2d8265b3d41ce834d29f2764daf4be4aad15a1d1 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
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -202,6 +202,7 @@
|
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
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -213,6 +214,7 @@
|
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.
|
2021-01-12 23:31:23 +00:00
|
|
|
NSString* const NSAccessibilityIdentifierChromeAttribute = @"ChromeAXNodeId";
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -237,6 +239,7 @@
|
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
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -472,6 +475,7 @@ void AddMisspelledTextAttributes(const BrowserAccessibility::AXRange& ax_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,
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -743,6 +747,7 @@ bool IsSelectedStateRelevant(BrowserAccessibility* item) {
|
2020-06-22 17:35:10 +00:00
|
|
|
#define NSAccessibilityLanguageAttribute @"AXLanguage"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
bool content::IsAXTextMarker(id object) {
|
|
|
|
if (object == nil)
|
|
|
|
return false;
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -786,6 +791,7 @@ bool IsSelectedStateRelevant(BrowserAccessibility* item) {
|
2020-07-14 01:13:34 +00:00
|
|
|
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
|
|
|
|
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -825,7 +831,9 @@ + (void)initialize {
|
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"},
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -837,8 +845,10 @@ + (void)initialize {
|
2019-10-18 19:57:34 +00:00
|
|
|
{NSAccessibilityHighestEditableAncestorAttribute,
|
|
|
|
@"highestEditableAncestor"},
|
|
|
|
{NSAccessibilityIndexAttribute, @"index"},
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
{NSAccessibilityInsertionPointLineNumberAttribute,
|
|
|
|
@"insertionPointLineNumber"},
|
|
|
|
+#endif
|
|
|
|
{NSAccessibilityInvalidAttribute, @"invalid"},
|
|
|
|
{NSAccessibilityIsMultiSelectableAttribute, @"isMultiSelectable"},
|
|
|
|
{NSAccessibilityLanguageAttribute, @"language"},
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -860,13 +870,17 @@ + (void)initialize {
|
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"},
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -1370,6 +1384,7 @@ - (NSNumber*)enabled {
|
2020-12-14 18:57:36 +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 {
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -1378,6 +1393,7 @@ - (id)endTextMarker {
|
2021-03-04 23:46:13 +00:00
|
|
|
BrowserAccessibility::AXPosition position = _owner->CreatePositionAt(0);
|
2021-01-12 23:31:23 +00:00
|
|
|
return CreateTextMarker(position->CreatePositionAtEndOfContent());
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
- (NSNumber*)expanded {
|
|
|
|
if (![self instanceActive])
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -1578,6 +1594,7 @@ - (bool)findRowIndex:(BrowserAccessibilityCocoa*)toFind
|
2020-10-16 01:30:41 +00:00
|
|
|
return false;
|
2019-10-18 19:57:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
- (NSNumber*)insertionPointLineNumber {
|
|
|
|
if (![self instanceActive])
|
|
|
|
return nil;
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -1603,6 +1620,7 @@ - (NSNumber*)insertionPointLineNumber {
|
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.
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -1954,8 +1972,12 @@ - (BOOL)shouldExposeTitleUIElement {
|
|
|
|
return content::AXTextEdit(newValue, std::u16string(), nil);
|
2020-08-12 18:33:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
return content::AXTextEdit(insertedText, deletedText,
|
|
|
|
CreateTextMarker(_owner->CreatePositionAt(i)));
|
|
|
|
+#else
|
|
|
|
+ return content::AXTextEdit(insertedText, deletedText, nil);
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)instanceActive {
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -2283,6 +2305,7 @@ - (NSArray*)selectedChildren {
|
2019-10-18 19:57:34 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
- (NSString*)selectedText {
|
|
|
|
if (![self instanceActive])
|
|
|
|
return nil;
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -2294,11 +2317,13 @@ - (NSString*)selectedText {
|
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;
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -2323,7 +2348,9 @@ - (NSValue*)selectedTextRange {
|
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;
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -2335,6 +2362,7 @@ - (id)selectedTextMarkerRange {
|
2020-08-12 18:33:58 +00:00
|
|
|
// words correctly.
|
2020-12-22 22:14:44 +00:00
|
|
|
return CreateTextMarkerRange(ax_range.AsBackwardRange());
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
- (NSValue*)size {
|
|
|
|
if (![self instanceActive])
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -2367,6 +2395,7 @@ - (NSString*)sortDirection {
|
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 {
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -2375,6 +2404,7 @@ - (id)startTextMarker {
|
2021-03-04 23:46:13 +00:00
|
|
|
BrowserAccessibility::AXPosition position = _owner->CreatePositionAt(0);
|
2021-01-12 23:31:23 +00:00
|
|
|
return CreateTextMarker(position->CreatePositionAtStartOfContent());
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
// Returns a subrole based upon the role.
|
2019-03-21 15:45:22 +00:00
|
|
|
- (NSString*)subrole {
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -2704,12 +2734,14 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range {
|
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()) {
|
2021-03-04 23:46:13 +00:00
|
|
|
BrowserAccessibility::AXRange ax_range(
|
|
|
|
_owner->CreatePositionAt(0),
|
|
|
|
_owner->CreatePositionAt(int{innerText.length()}));
|
2020-04-13 23:39:26 +00:00
|
|
|
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
|
|
|
}
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -2822,6 +2854,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
|
2019-01-08 23:59:47 +00:00
|
|
|
return ToBrowserAccessibilityCocoa(cell);
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
2021-03-04 23:46:13 +00:00
|
|
|
if ([attribute
|
|
|
|
isEqualToString:
|
|
|
|
NSAccessibilityUIElementForTextMarkerParameterizedAttribute]) {
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -3145,6 +3178,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
|
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]) {
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -3175,6 +3209,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
|
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]) {
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -3292,6 +3327,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
return @(child->GetIndexInParent());
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
}
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -3821,6 +3857,7 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute {
|
2021-03-04 23:46:13 +00:00
|
|
|
_owner->CreatePositionAt(range.location),
|
|
|
|
_owner->CreatePositionAt(NSMaxRange(range))));
|
2020-11-14 00:16:56 +00:00
|
|
|
}
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
if ([attribute
|
|
|
|
isEqualToString:NSAccessibilitySelectedTextMarkerRangeAttribute]) {
|
2021-03-04 23:46:13 +00:00
|
|
|
BrowserAccessibility::AXRange range = CreateRangeFromTextMarkerRange(value);
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -3831,6 +3868,7 @@ - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute {
|
2021-03-04 23:46:13 +00:00
|
|
|
BrowserAccessibility::AXRange(range.anchor()->AsLeafTextPosition(),
|
|
|
|
range.focus()->AsLeafTextPosition()));
|
2020-11-14 00:16:56 +00:00
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
2020-12-14 18:57:36 +00:00
|
|
|
- (id)accessibilityFocusedUIElement {
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
2021-03-15 18:32:18 +00:00
|
|
|
index 2a5163acf68b8a26b562dd0ab54e78fb408e89fe..98a5b1efc461d8f46becd78a4e19c410300e40e0 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
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -482,7 +482,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
2021-02-09 20:16:21 +00:00
|
|
|
if (native_focus_object && [native_focus_object instanceActive]) {
|
|
|
|
[user_info setObject:native_focus_object
|
|
|
|
forKey:ui::NSAccessibilityTextChangeElement];
|
|
|
|
-
|
2018-09-14 05:02:16 +00:00
|
|
|
+#ifndef MAS_BUILD
|
2021-02-09 20:16:21 +00:00
|
|
|
id selected_text = [native_focus_object selectedTextMarkerRange];
|
|
|
|
if (selected_text) {
|
|
|
|
NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute =
|
2021-03-15 18:32:18 +00:00
|
|
|
@@ -490,6 +490,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
2021-02-09 20:16:21 +00:00
|
|
|
[user_info setObject:selected_text
|
|
|
|
forKey:NSAccessibilitySelectedTextMarkerRangeAttribute];
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
2021-02-09 20:16:21 +00:00
|
|
|
+#endif
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
|
|
|
|
2021-02-09 20:16:21 +00:00
|
|
|
return user_info;
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/content/renderer/renderer_main_platform_delegate_mac.mm b/content/renderer/renderer_main_platform_delegate_mac.mm
|
2020-09-21 08:00:36 +00:00
|
|
|
index 894ac47e596c1c96a7e0659be80ed8a5629d0304..eca797a24df79b8502b9698e6ed8830ad1c5cb59 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-08-10 15:23:21 +00:00
|
|
|
@@ -22,6 +24,7 @@
|
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.
|
2020-09-21 08:00:36 +00:00
|
|
|
@@ -30,6 +33,7 @@ void DisableSystemServices() {
|
2018-10-24 23:25:48 +00:00
|
|
|
|
|
|
|
sandbox::DisableLaunchServices();
|
2020-09-21 08:00:36 +00:00
|
|
|
sandbox::DisableCoreServicesCheckFix();
|
2018-09-14 05:02:16 +00:00
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
2019-04-20 17:20:37 +00:00
|
|
|
} // namespace
|
2020-08-26 04:13:42 +00:00
|
|
|
diff --git a/content/renderer/theme_helper_mac.mm b/content/renderer/theme_helper_mac.mm
|
2020-12-14 18:57:36 +00:00
|
|
|
index c15f3a631292b538698625328fb429ee3c9964f5..37e038753ecf1b82ec92c06b2c0729b5328781c9 100644
|
2020-08-26 04:13:42 +00:00
|
|
|
--- a/content/renderer/theme_helper_mac.mm
|
|
|
|
+++ b/content/renderer/theme_helper_mac.mm
|
|
|
|
@@ -7,11 +7,11 @@
|
|
|
|
#include <Cocoa/Cocoa.h>
|
|
|
|
|
|
|
|
#include "base/strings/sys_string_conversions.h"
|
|
|
|
-
|
|
|
|
+#if !defined(MAS_BUILD)
|
|
|
|
extern "C" {
|
|
|
|
bool CGFontRenderingGetFontSmoothingDisabled(void) API_AVAILABLE(macos(10.14));
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+#endif
|
|
|
|
namespace content {
|
|
|
|
|
|
|
|
void SystemColorsDidChange(int aqua_color_variant,
|
|
|
|
@@ -59,8 +59,19 @@ void SystemColorsDidChange(int aqua_color_variant,
|
|
|
|
bool IsSubpixelAntialiasingAvailable() {
|
|
|
|
if (__builtin_available(macOS 10.14, *)) {
|
|
|
|
// See https://trac.webkit.org/changeset/239306/webkit for more info.
|
|
|
|
+#if !defined(MAS_BUILD)
|
|
|
|
return !CGFontRenderingGetFontSmoothingDisabled();
|
|
|
|
+#else
|
|
|
|
+ NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
|
|
|
|
+ NSString *default_key = @"CGFontRenderingGetFontSmoothingDisabled";
|
2020-10-20 01:40:58 +00:00
|
|
|
+ // Check that key exists since boolForKey defaults to NO when the
|
2020-08-26 04:13:42 +00:00
|
|
|
+ // key is missing and this key in fact defaults to YES;
|
|
|
|
+ if ([defaults objectForKey:default_key] == nil)
|
|
|
|
+ return false;
|
|
|
|
+ return ![defaults boolForKey:default_key];
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
+
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
|
2021-02-09 20:16:21 +00:00
|
|
|
index b56737af6f4da7cc01f78430c53dfa5afd1bc6df..60cdaa18e55acfd5817d2689bdb5a0ec8c1318d7 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/device/bluetooth/bluetooth_adapter_mac.mm
|
|
|
|
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
|
2021-02-09 20:16:21 +00:00
|
|
|
@@ -43,6 +43,7 @@
|
2018-09-14 05:02:16 +00:00
|
|
|
#include "device/bluetooth/bluetooth_socket_mac.h"
|
2020-08-12 18:33:58 +00:00
|
|
|
#include "device/bluetooth/public/cpp/bluetooth_address.h"
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
+#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
|
2021-02-09 20:16:21 +00:00
|
|
|
@@ -56,6 +57,7 @@
|
2018-09-14 05:02:16 +00:00
|
|
|
// [4] https://support.apple.com/kb/PH25091
|
|
|
|
void IOBluetoothPreferenceSetControllerPowerState(int state);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2021-02-09 20:16:21 +00:00
|
|
|
@@ -124,8 +126,10 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
|
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
|
|
|
|
classic_discovery_manager_(
|
|
|
|
BluetoothDiscoveryManagerMac::CreateClassic(this)),
|
2020-10-28 00:33:04 +00:00
|
|
|
low_energy_discovery_manager_(
|
2021-02-09 20:16:21 +00:00
|
|
|
@@ -356,8 +360,12 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
|
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
|
2021-03-04 23:46:13 +00:00
|
|
|
index c68099d5baa0fec203313e8734d2d659578d687d..4a724e0f744722a4ba30ff6e22b56997364e4c49 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/media/audio/BUILD.gn
|
|
|
|
+++ b/media/audio/BUILD.gn
|
2021-03-04 23:46:13 +00:00
|
|
|
@@ -175,6 +175,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
|
2021-03-04 17:27:05 +00:00
|
|
|
index dddd4a98a99fdea4c32d9c5b33a8fc661c75f590..a210069a9576d4aca436cdc8a2cd4322714aa24c 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
|
2021-03-04 17:27:05 +00:00
|
|
|
@@ -136,8 +136,8 @@ class DnsConfigServicePosix::Watcher : public DnsConfigService::Watcher {
|
2018-09-14 05:02:16 +00:00
|
|
|
|
2021-01-25 16:46:00 +00:00
|
|
|
bool Watch() override {
|
|
|
|
CheckOnCorrectSequence();
|
|
|
|
-
|
2018-09-14 05:02:16 +00:00
|
|
|
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.";
|
2021-03-04 17:27:05 +00:00
|
|
|
@@ -154,6 +154,7 @@ class DnsConfigServicePosix::Watcher : public DnsConfigService::Watcher {
|
2021-01-12 23:31:23 +00:00
|
|
|
success = false;
|
2018-09-14 05:02:16 +00:00
|
|
|
}
|
2021-03-04 17:27:05 +00:00
|
|
|
#endif // !defined(OS_IOS)
|
2018-09-14 05:02:16 +00:00
|
|
|
+#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;
|