electron/patches/chromium/mas_no_private_api.patch
Electron Bot 69f1731bbb
chore: bump chromium to ec5bc1743792d64724693eb357083 (master) (#24984)
* chore: bump chromium in DEPS to cbdeef954dfc34e94c8ca9cf72ad326b4a121158

* chore: bump chromium in DEPS to 29723f905baeab1d4228eef2c31cdb341ebeffe0

* chore: bump chromium in DEPS to 44d6d78e852137fff58c14ed26ab1e803e5bf822

* update patches

* chore: bump chromium in DEPS to 8a3a0fccb39d6b8334c9a0496c0d5056e50cdb3f

* chore: update patches

* refactor: fix PrintBackend::CreateInstance() calls

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2354541

* chore: bump chromium in DEPS to b9ebec3bcb1cabdd1426f367636f54cc98e0500e

* chore: remove patches to code that was deleted upstream

CL: https://chromium-review.googlesource.com/c/chromium/src/+/2360314

* Remove uses of kCGColorSpaceITUR_2020_PQ_EOTF/HLG

CL: https://chromium-review.googlesource.com/c/chromium/src/+/2363950

just garden variety code shear

* chore: update patch indices

* Move ColorModel to //printing/mojom/print.mojom

https://chromium-review.googlesource.com/c/chromium/src/+/2355083

sync with printing ColorModel changes: moved to mojo, different naming scheme

* chore: bump chromium in DEPS to 56c4b4d2ce5ba941acd2e0fdb5100e8a48847134

* chore: bump chromium in DEPS to 130501f220b684a79dc82c17e236e63ac1f2a093

* Convert PrintHostMsg_DidGetPrintedPagesCount to Mojo

https://chromium-review.googlesource.com/c/chromium/src/+/2326857

Update argument list to Print()

* chore: update patch indices

* DumpAccTree: convert utf16 to utf8 in PropertyFilter

https://chromium-review.googlesource.com/c/chromium/src/+/2360218

* chore: bump chromium in DEPS to 3058368c6646e0dc8be6f8ea838b0343428b7998

* chore: bump chromium in DEPS to f51b4e6555364363c61438dac7afd988c8347bfc

* chore: bump chromium in DEPS to 2dcc6f8fc23ac41b2499eb69dee0b4017e9d1046

* update patches

* chore: bump chromium in DEPS to 2d8e98ecedc7e4905540b053bc1c87e964715be5

* update patches

* 2345900: Move content::RecordContentToVisibleTimeRequest struct to mojo

https://chromium-review.googlesource.com/c/chromium/src/+/2345900

* update patches

* 2345900: Move content::RecordContentToVisibleTimeRequest struct to mojo

https://chromium-review.googlesource.com/c/chromium/src/+/2345900

* 2367394: Remove net::LOAD_DO_NOT_SEND_COOKIES and net::LOAD_DO_NOT_SEND_AUTH_DATA.

https://chromium-review.googlesource.com/c/chromium/src/+/2367394

* 2373227: [XProto] Consolidate all <X11/*> includes to //ui/gfx/x/x11.h

https://chromium-review.googlesource.com/c/chromium/src/+/2373227

* fixup! 2373227: [XProto] Consolidate all <X11/*> includes to //ui/gfx/x/x11.h

* chore: bump chromium in DEPS to c090e3f960520cbd2328608b97f87238c76d6143

* update patches

* chore: bump chromium in DEPS to 13a25e0a755de9a14271022c595f3d2e29829e1a

* chore: bump chromium in DEPS to 6adbb767b012c41efaeab0d1bdbb3eefed0977bc

* chore: bump chromium in DEPS to 339ec5455c5932ef1322ea9953a6349b0732199e

* chore: bump chromium in DEPS to 20291807c33f7ef4ef4f57d62075e099b027bfe6

* chore: bump chromium in DEPS to 226fbd1b8b17d4ac84fdb9548ef3a1c646878d47

* update patches

* fixup disable_color_correct_rendering patch

* chore: bump chromium in DEPS to 577c45979cad4359f2e206d68efd9317d3d79315

* update patches

* viz: Rename RenderPass to CompositorRenderPass (and related types).

https://chromium-review.googlesource.com/c/chromium/src/+/2380730

* chore: bump chromium in DEPS to 37e2ad5303f2c03a1b5d8eda65341bf2561196cd

* update patches

* add kOmitCookies_Electron

* update patch

* chore: bump chromium in DEPS to 256e42409ea63a7e71016de07818a983a97db463

* update patches

* fix worker script ready hook

https://chromium-review.googlesource.com/c/chromium/src/+/2335713

* Fixup printing page ranges patch

* [printing] Move PrintMsg_PrintPages_Params to print.mojom

https://chromium-review.googlesource.com/c/chromium/src/+/2340854

* Add MIME sniffer overloads that take base::StringPieces

https://chromium-review.googlesource.com/c/chromium/src/+/2382896

* [printing] Move PrintHostMsg_PreviewIds to print.mojom

https://chromium-review.googlesource.com/c/chromium/src/+/2379455

* fixup test due to new DCHECK

https://chromium-review.googlesource.com/c/chromium/src/+/2333750

* stop sending cookies when useSessionCookies is false

* chore: bump chromium in DEPS to dd429dbc556449951ee8160d8a4d61fd95a139d5

* update patches

* chore: bump chromium in DEPS to 5202bde3f9f44c2065f5dacf27e7000dd19e4e4d

* chore: bump chromium in DEPS to 099e8e07b89da65932431bb0fd51b6f7f5344c19

* chore: bump chromium in DEPS to 104e5da2a43b759732d5b94bfc750b3a9a639653

* chore: bump chromium in DEPS to a4519ce657af25834e355315fd7fefa77b13426a

* update patches

* Make FileURLLoaderFactory always owned by its |receivers_|.

https://chromium-review.googlesource.com/c/chromium/src/+/2337411

* Make FileURLLoaderFactory always owned by its |receivers_|.

https://chromium-review.googlesource.com/c/chromium/src/+/2337411

* chore: bump chromium in DEPS to 1b62e9e8c8eaf6b8e3a9c77ee67a4c1bfa6a4d6b

* chore: update patches

* fixup! Make FileURLLoaderFactory always owned by its |receivers_|.

* chore: update patches

- mac: Disable CoreServices _CSCheckFix.
  https://chromium-review.googlesource.com/c/chromium/src/+/2401334
- [XProto] Remove bad DCHECK in x11_error_tracker.cc
  https://chromium-review.googlesource.com/c/chromium/src/+/2402304
- Move content/browser/frame_host/* over to content/browser/renderer_host/
  https://chromium-review.googlesource.com/c/chromium/src/+/2401303

* Refactor WebContentSettingsClient to dedupe AllowXYZ methods

https://chromium-review.googlesource.com/c/chromium/src/+/2353552

* Introduce NonNetworkURLLoaderFactoryBase class.

https://chromium-review.googlesource.com/c/chromium/src/+/2357559

* [XProto] Remove usage of all Xlib headers

https://chromium-review.googlesource.com/c/chromium/src/+/2392140

* fixup! chore: update patches

* chore: bump chromium in DEPS to c1df55fbeb8207d036a604f59e4ea4e8ee79930a

* chore: update patches

* Move content::WebPreferences struct to Blink

https://chromium-review.googlesource.com/c/chromium/src/+/2397670

* chore: bump chromium in DEPS to 57a23ec4884fff6c2f8d9b8536131cdc9b551ec2

* Set appid on Pip windows.

https://chromium-review.googlesource.com/c/chromium/src/+/2388274

* fixup! Set appid on Pip windows.

* fix: add a patch to remove deprecated factory

* chore: bump chromium in DEPS to 1a9ddb7ea43955877823d5c4dcbf241b64228635

* fix compilation on windows

* chore: bump chromium in DEPS to 234e6c6a77f61ffad9335099d9b13892cf88fd44

* chore: update patches

* chore: bump chromium in DEPS to 7631eb0a9f57a8a47d3c28e1d265961b3a4d6b2b

* chore: update patches

* chore: bump chromium in DEPS to f9c34cd485845b95c2d17a7f55fdf92cda9a1b3a

* chore: update patches

* chore: implement GetSurveyAPIKey

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2362182

* chore: replace CreateWebUIURLLoader with CreateWebUIURLLoaderFactory

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2358309

* chore: bump chromium in DEPS to 5bdbd2373da884adf41c087be1465fcc344d168c

* chore: update node patches for common.gypi

* chore: update patches

* chore: non_network_url_loader_factory_base was moved

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2357431

* 2415752: Reland "Reland "OOR-CORS: Remove BlinkCORS supporting code outside Blink""

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2415752

* chore: bump chromium in DEPS to b943d006a33ec5bc1743792d64724693eb357083

* fix: replace x11::None with x11::Window::None

* chore: update patches

* chore: update patches

* fix: cast x11::Window to int

* 2402123: Use end date when deleting http auth cache

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2402123

* 2320268: Migrate DragHostMsg_StartDragging to Mojo

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2320268

* 2401303: Move content/browser/frame_host/* over to content/browser/renderer_host/

https://chromium-review.googlesource.com/c/chromium/src/+/2401303

* chore: fix lint

* chore: fix build

* Update config.yml

Co-authored-by: Electron Bot <anonymous@electronjs.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
2020-09-21 01:00:36 -07:00

646 lines
24 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
Date: Tue, 9 Oct 2018 10:36:20 -0700
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.
diff --git a/content/browser/accessibility/accessibility_tree_formatter_mac.mm b/content/browser/accessibility/accessibility_tree_formatter_mac.mm
index f2fb5aabf511cb16275f9925a21b83013d268a7b..b0b137ae454418296376bb650eb6b6134b66d83b 100644
--- a/content/browser/accessibility/accessibility_tree_formatter_mac.mm
+++ b/content/browser/accessibility/accessibility_tree_formatter_mac.mm
@@ -334,7 +334,7 @@ OptionalNSObject InvokeAttributeFor(
0 == strcmp([value objCType], @encode(NSRange))) {
return PopulateRange([value rangeValue]);
}
-
+#ifndef MAS_BUILD
// AXTextMarker
if (content::IsAXTextMarker(value)) {
return PopulateTextPosition(content::AXTextMarkerToPosition(value).get(),
@@ -345,7 +345,7 @@ OptionalNSObject InvokeAttributeFor(
if (content::IsAXTextMarkerRange(value)) {
return PopulateTextMarkerRange(value, line_indexer);
}
-
+#endif
// Accessible object
if (IsBrowserAccessibilityCocoa(value) || IsAXUIElement(value)) {
return base::Value(NodeToLineIndex(value, line_indexer));
@@ -396,7 +396,7 @@ OptionalNSObject InvokeAttributeFor(
kConstValuePrefix + affinity);
return set;
}
-
+#ifndef MAS_BUILD
base::Value AccessibilityTreeFormatterMac::PopulateTextMarkerRange(
id object,
const LineIndexer* line_indexer) const {
@@ -410,7 +410,7 @@ OptionalNSObject InvokeAttributeFor(
dict.SetPath("focus", PopulateTextPosition(range.focus(), line_indexer));
return dict;
}
-
+#endif
base::Value AccessibilityTreeFormatterMac::PopulateArray(
NSArray* node_array,
const LineIndexer* line_indexer) const {
diff --git a/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm b/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm
index 540afa34eb0ab6597f799767988b3d8cb8f4bb9c..feb109c62708d107cc475d8332cd1f969969733b 100644
--- a/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm
+++ b/content/browser/accessibility/accessibility_tree_formatter_utils_mac.mm
@@ -267,6 +267,7 @@ id ParameterizedAttributeValueOf(const id node,
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));
}
@@ -274,6 +275,7 @@ id ParameterizedAttributeValueOf(const id node,
return OptionalNSObject::NotNilOrError(
PropertyNodeToTextMarkerRange(arg_node));
}
+#endif
return OptionalNSObject::NotApplicable();
}
@@ -339,6 +341,7 @@ id ParameterizedAttributeValueOf(const id node,
return uielement;
}
+#ifndef MAS_BUILD
id AttributeInvoker::DictNodeToTextMarker(const PropertyNode& dictnode) const {
if (!dictnode.IsDict()) {
TEXTMARKER_FAIL(dictnode, "dictionary is expected")
@@ -406,6 +409,7 @@ id ParameterizedAttributeValueOf(const id node,
return content::AXTextMarkerRangeFrom(anchor_textmarker, focus_textmarker);
}
+#endif
} // namespace a11y
} // namespace content
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.h b/content/browser/accessibility/browser_accessibility_cocoa.h
index cb253906ddd9b70df1618a1c3738fc64389b5432..318af1ec3a11ee53a1146909f76c9cea7f78be1e 100644
--- a/content/browser/accessibility/browser_accessibility_cocoa.h
+++ b/content/browser/accessibility/browser_accessibility_cocoa.h
@@ -137,7 +137,9 @@ id AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker);
@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;
@@ -148,7 +150,9 @@ id AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker);
@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;
@@ -171,14 +175,18 @@ id AXTextMarkerRangeFrom(id anchor_textmarker, id focus_textmarker);
// The object is selected as a whole.
@property(nonatomic, readonly) NSNumber* selected;
@property(nonatomic, readonly) NSArray* selectedChildren;
+#ifndef MAS_BUILD
@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
index d203e3a6a80d3347e22c84384359de3df50a1f0c..7d38e86e76e1f1ae70300141091d0fb98fdc208c 100644
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
@@ -208,6 +208,7 @@
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
@@ -219,6 +220,7 @@
NSString* const
NSAccessibilityTextMarkerNodeDebugDescriptionParameterizedAttribute =
@"AXTextMarkerNodeDebugDescription";
+#endif
// Other private attributes.
NSString* const NSAccessibilitySelectTextWithCriteriaParameterizedAttribute =
@@ -242,6 +244,7 @@
// 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
@@ -470,6 +473,7 @@ void AddMisspelledTextAttributes(const AXPlatformRange& ax_range,
AddMisspelledTextAttributes(ax_range, attributed_text);
return attributed_text;
}
+#endif
// Returns an autoreleased copy of the AXNodeData's attribute.
NSString* NSStringForStringAttribute(BrowserAccessibility* browserAccessibility,
@@ -741,6 +745,7 @@ bool IsSelectedStateRelevant(BrowserAccessibility* item) {
#define NSAccessibilityLanguageAttribute @"AXLanguage"
#endif
+#ifndef MAS_BUILD
bool content::IsAXTextMarker(id object) {
if (object == nil)
return false;
@@ -784,6 +789,7 @@ bool IsSelectedStateRelevant(BrowserAccessibility* item) {
kCFAllocatorDefault, anchor_textmarker, focus_textmarker);
return [static_cast<id>(cf_marker_range) autorelease];
}
+#endif
@implementation BrowserAccessibilityCocoa
@@ -821,7 +827,9 @@ + (void)initialize {
{NSAccessibilityEditableAncestorAttribute, @"editableAncestor"},
{NSAccessibilityElementBusyAttribute, @"elementBusy"},
{NSAccessibilityEnabledAttribute, @"enabled"},
+#ifndef MAS_BUILD
{NSAccessibilityEndTextMarkerAttribute, @"endTextMarker"},
+#endif
{NSAccessibilityExpandedAttribute, @"expanded"},
{NSAccessibilityFocusableAncestorAttribute, @"focusableAncestor"},
{NSAccessibilityFocusedAttribute, @"focused"},
@@ -833,8 +841,10 @@ + (void)initialize {
{NSAccessibilityHighestEditableAncestorAttribute,
@"highestEditableAncestor"},
{NSAccessibilityIndexAttribute, @"index"},
+#ifndef MAS_BUILD
{NSAccessibilityInsertionPointLineNumberAttribute,
@"insertionPointLineNumber"},
+#endif
{NSAccessibilityInvalidAttribute, @"invalid"},
{NSAccessibilityIsMultiSelectableAttribute, @"isMultiSelectable"},
{NSAccessibilityLanguageAttribute, @"language"},
@@ -856,13 +866,17 @@ + (void)initialize {
{NSAccessibilityRowsAttribute, @"rows"},
// TODO(aboxhall): expose
// NSAccessibilityServesAsTitleForUIElementsAttribute
+#ifndef MAS_BUILD
{NSAccessibilityStartTextMarkerAttribute, @"startTextMarker"},
+#endif
{NSAccessibilitySelectedAttribute, @"selected"},
{NSAccessibilitySelectedChildrenAttribute, @"selectedChildren"},
+#ifndef MAS_BUILD
{NSAccessibilitySelectedTextAttribute, @"selectedText"},
{NSAccessibilitySelectedTextRangeAttribute, @"selectedTextRange"},
{NSAccessibilitySelectedTextMarkerRangeAttribute,
@"selectedTextMarkerRange"},
+#endif
{NSAccessibilitySizeAttribute, @"size"},
{NSAccessibilitySortDirectionAttribute, @"sortDirection"},
{NSAccessibilitySubroleAttribute, @"subrole"},
@@ -1350,6 +1364,7 @@ - (NSNumber*)enabled {
ax::mojom::Restriction::kDisabled];
}
+#ifndef MAS_BUILD
// Returns a text marker that points to the last character in the document that
// can be selected with VoiceOver.
- (id)endTextMarker {
@@ -1360,6 +1375,7 @@ - (id)endTextMarker {
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
return CreateTextMarker(position->CreatePositionAtEndOfAnchor());
}
+#endif
- (NSNumber*)expanded {
if (![self instanceActive])
@@ -1509,6 +1525,8 @@ - (NSNumber*)index {
return nil;
}
+
+#ifndef MAS_BUILD
- (NSNumber*)insertionPointLineNumber {
if (![self instanceActive])
return nil;
@@ -1531,6 +1549,7 @@ - (NSNumber*)insertionPointLineNumber {
caretPosition->AsTextPosition()->text_offset());
return @(std::distance(lineBreaks.begin(), iterator));
}
+#endif
// Returns whether or not this node should be ignored in the
// accessibility tree.
@@ -1894,8 +1913,12 @@ - (BOOL)shouldExposeTitleUIElement {
return content::AXTextEdit(newValue, base::string16(), nil);
}
}
+#ifndef MAS_BUILD
return content::AXTextEdit(insertedText, deletedText,
CreateTextMarker(_owner->CreatePositionAt(i)));
+#else
+ return content::AXTextEdit(insertedText, deletedText, nil);
+#endif
}
- (BOOL)instanceActive {
@@ -2225,6 +2248,7 @@ - (NSArray*)selectedChildren {
return ret;
}
+#ifndef MAS_BUILD
- (NSString*)selectedText {
if (![self instanceActive])
return nil;
@@ -2236,11 +2260,13 @@ - (NSString*)selectedText {
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;
@@ -2261,7 +2287,9 @@ - (NSValue*)selectedTextRange {
int selLength = range.GetText().length();
return [NSValue valueWithRange:NSMakeRange(selStart, selLength)];
}
+#endif
+#ifndef MAS_BUILD
- (id)selectedTextMarkerRange {
if (![self instanceActive])
return nil;
@@ -2269,6 +2297,7 @@ - (id)selectedTextMarkerRange {
// words correctly.
return CreateTextMarkerRange(GetSelectedRange(*_owner).AsBackwardRange());
}
+#endif
- (NSValue*)size {
if (![self instanceActive])
@@ -2301,6 +2330,7 @@ - (NSString*)sortDirection {
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 {
@@ -2311,6 +2341,7 @@ - (id)startTextMarker {
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
return CreateTextMarker(position->CreatePositionAtStartOfAnchor());
}
+#endif
// Returns a subrole based upon the role.
- (NSString*)subrole {
@@ -2630,11 +2661,13 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range {
NSMutableAttributedString* attributedInnerText =
[[[NSMutableAttributedString alloc]
initWithString:base::SysUTF16ToNSString(innerText)] autorelease];
+#ifndef MAS_BUILD
if (!_owner->IsText()) {
AXPlatformRange ax_range(_owner->CreatePositionAt(0),
_owner->CreatePositionAt(int{innerText.length()}));
AddMisspelledTextAttributes(ax_range, attributedInnerText);
}
+#endif
return [attributedInnerText attributedSubstringFromRange:range];
}
@@ -2738,9 +2771,8 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
return ToBrowserAccessibilityCocoa(cell);
}
- if ([attribute
- isEqualToString:
- NSAccessibilityUIElementForTextMarkerParameterizedAttribute]) {
+#ifndef MAS_BUILD
+ if ([attribute isEqualToString:NSAccessibilityUIElementForTextMarkerParameterizedAttribute]) {
BrowserAccessibilityPositionInstance position =
CreatePositionFromTextMarker(parameter);
if (!position->IsNullPosition())
@@ -3053,6 +3085,7 @@ AXPlatformRange range(std::move(lineStartPosition),
return CreateTextMarker(root->CreatePositionAt(index));
}
+#endif
if ([attribute isEqualToString:
NSAccessibilityBoundsForRangeParameterizedAttribute]) {
@@ -3088,6 +3121,7 @@ AXPlatformRange range(std::move(lineStartPosition),
return nil;
}
+#ifndef MAS_BUILD
if ([attribute
isEqualToString:
NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute]) {
@@ -3202,6 +3236,7 @@ AXPlatformRange range(std::move(lineStartPosition),
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
index f77433fff5426dd174865aad3d290d787764174c..d64e4fbcf44590e9132c2338819d2aa76612db95 100644
--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm
@@ -529,6 +529,7 @@ void PostAnnouncementNotification(NSString* announcement) {
[user_info setObject:native_focus_object
forKey:NSAccessibilityTextChangeElement];
+#ifndef MAS_BUILD
id selected_text = [native_focus_object selectedTextMarkerRange];
if (selected_text) {
NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute =
@@ -536,6 +537,7 @@ void PostAnnouncementNotification(NSString* announcement) {
[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
index 894ac47e596c1c96a7e0659be80ed8a5629d0304..eca797a24df79b8502b9698e6ed8830ad1c5cb59 100644
--- a/content/renderer/renderer_main_platform_delegate_mac.mm
+++ b/content/renderer/renderer_main_platform_delegate_mac.mm
@@ -10,9 +10,11 @@
#include "sandbox/mac/seatbelt.h"
#include "sandbox/mac/system_services.h"
+#ifndef MAS_BUILD
extern "C" {
CGError CGSSetDenyWindowServerConnections(bool);
}
+#endif
namespace content {
@@ -22,6 +24,7 @@
// verifies there are no existing open connections), and then indicates that
// Chrome should continue execution without access to launchservicesd.
void DisableSystemServices() {
+#ifndef MAS_BUILD
// 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.
@@ -30,6 +33,7 @@ void DisableSystemServices() {
sandbox::DisableLaunchServices();
sandbox::DisableCoreServicesCheckFix();
+#endif
}
} // namespace
diff --git a/content/renderer/theme_helper_mac.mm b/content/renderer/theme_helper_mac.mm
index 1db129740992672a4e8be8100da18b6813f1a4f8..5b1e456020ac859c826dbef2826cacf3bb60108b 100644
--- 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";
+ // Check that key exists since boolForKey defaults to NO when the
+ // 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;
}
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
index 933483c36d94336c8e9cc56a53bc86aee01e12d0..a48b4af66fb4edcf74caef5bec68c53be5469fe8 100644
--- a/device/bluetooth/bluetooth_adapter_mac.mm
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
@@ -37,6 +37,7 @@
#include "device/bluetooth/bluetooth_socket_mac.h"
#include "device/bluetooth/public/cpp/bluetooth_address.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
@@ -50,6 +51,7 @@
// [4] https://support.apple.com/kb/PH25091
void IOBluetoothPreferenceSetControllerPowerState(int state);
}
+#endif
namespace {
@@ -119,8 +121,10 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
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)),
@@ -307,8 +311,12 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
}
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
index f5279e1f51e9fcb5f700311153b67044ddc81497..2aad6e02ef356765b80141702c21bb03dc2eb977 100644
--- a/media/audio/BUILD.gn
+++ b/media/audio/BUILD.gn
@@ -171,6 +171,12 @@ source_set("audio") {
"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",
+ ]
+ }
frameworks = [
"AudioToolbox.framework",
"AudioUnit.framework",
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
index a994f74bb68d1e57ffa787e159f0a6c69e7b6953..1d84f84b59b2bae75c10c00da730022eca52d258 100644
--- a/media/audio/mac/audio_manager_mac.cc
+++ b/media/audio/mac/audio_manager_mac.cc
@@ -882,7 +882,7 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters(
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
index 5a4aead0acf93db6a633fa90fac3c9943d58f6df..808ccae535c5a8473e15a7067b1e9034f3809b93 100644
--- a/net/dns/dns_config_service_posix.cc
+++ b/net/dns/dns_config_service_posix.cc
@@ -247,6 +247,7 @@ class DnsConfigServicePosix::Watcher {
bool Watch() {
bool success = true;
+#ifndef MAS_BUILD
if (!config_watcher_.Watch(base::BindRepeating(&Watcher::OnConfigChanged,
base::Unretained(this)))) {
LOG(ERROR) << "DNS config watch failed to start.";
@@ -268,6 +269,7 @@ class DnsConfigServicePosix::Watcher {
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
index e524aa7b851022abed1edac39e18d8d92e5349b4..718d3f963da5c1a15a1bdb0e6043f89bc0f940f8 100644
--- 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
index e0c31170acd13c9997c6b1d04c6de1420feaf422..0e561f97b33380bfbe52e64c2c4a6988095e8074 100644
--- 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
index 84c7370a3bb98aa29cdc04730a25148c3adc162a..5175c2c210e13e41224ae7268528c595c35cc4dc 100644
--- a/sandbox/mac/seatbelt_extension.cc
+++ b/sandbox/mac/seatbelt_extension.cc
@@ -11,6 +11,7 @@
#include "base/notreached.h"
#include "sandbox/mac/seatbelt_extension_token.h"
+#ifndef MAS_BUILD
// libsandbox private API.
extern "C" {
extern const char* APP_SANDBOX_READ;
@@ -21,6 +22,7 @@ char* sandbox_extension_issue_file(const char* type,
const char* path,
uint32_t flags);
}
+#endif
namespace sandbox {
@@ -49,7 +51,11 @@ std::unique_ptr<SeatbeltExtension> SeatbeltExtension::FromToken(
bool SeatbeltExtension::Consume() {
DCHECK(!token_.empty());
+#ifndef MAS_BUILD
handle_ = sandbox_extension_consume(token_.c_str());
+#else
+ handle_ = -1;
+#endif
return handle_ > 0;
}
@@ -61,7 +67,11 @@ bool SeatbeltExtension::ConsumePermanently() {
}
bool SeatbeltExtension::Revoke() {
+#ifndef MAS_BUILD
int rv = sandbox_extension_release(handle_);
+#else
+ int rv = -1;
+#endif
handle_ = 0;
token_.clear();
return rv == 0;
@@ -79,9 +89,11 @@ SeatbeltExtension::SeatbeltExtension(const std::string& token)
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;