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.
|
|
|
|
|
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
|
2019-05-13 18:49:01 +00:00
|
|
|
index 743d1364bcd13e24ecbe5ced730161d15b8c3e93..a7e81072194c00baa0aa3159a6bfe374aaffa54f 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
|
2019-01-08 23:59:47 +00:00
|
|
|
@@ -109,7 +109,9 @@ struct AXTextEdit {
|
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;
|
2019-01-08 23:59:47 +00:00
|
|
|
@@ -145,12 +147,16 @@ struct AXTextEdit {
|
2018-09-14 05:02:16 +00:00
|
|
|
@property(nonatomic, readonly) NSArray* selectedChildren;
|
|
|
|
@property(nonatomic, readonly) NSString* selectedText;
|
|
|
|
@property(nonatomic, readonly) NSValue* selectedTextRange;
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
@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
|
2019-05-13 18:49:01 +00:00
|
|
|
index 1d8dbb5a781221dea2fb8138546461d0eddc0243..49a6ad7b31cf959cae19ef535290441598c9306a 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
|
2019-03-21 15:45:22 +00:00
|
|
|
@@ -141,6 +141,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
|
2019-05-01 00:18:22 +00:00
|
|
|
@@ -346,6 +347,7 @@ void AddMisspelledTextAttributes(
|
2018-09-14 05:02:16 +00:00
|
|
|
AddMisspelledTextAttributes(text_only_objects, attributed_text);
|
|
|
|
return [attributed_text attributedSubstringFromRange:range];
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
// Returns an autoreleased copy of the AXNodeData's attribute.
|
2019-03-21 15:45:22 +00:00
|
|
|
NSString* NSStringForStringAttribute(BrowserAccessibility* browserAccessibility,
|
2019-05-01 00:18:22 +00:00
|
|
|
@@ -613,7 +615,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"},
|
2019-05-01 00:18:22 +00:00
|
|
|
@@ -648,13 +652,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"},
|
|
|
|
{NSAccessibilitySelectedTextAttribute, @"selectedText"},
|
|
|
|
{NSAccessibilitySelectedTextRangeAttribute, @"selectedTextRange"},
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
{NSAccessibilitySelectedTextMarkerRangeAttribute,
|
|
|
|
@"selectedTextMarkerRange"},
|
|
|
|
+#endif
|
|
|
|
{NSAccessibilitySizeAttribute, @"size"},
|
|
|
|
{NSAccessibilitySortDirectionAttribute, @"sortDirection"},
|
|
|
|
{NSAccessibilitySubroleAttribute, @"subrole"},
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -1144,6 +1152,7 @@ - (NSNumber*)enabled {
|
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 {
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -1154,6 +1163,7 @@ - (id)endTextMarker {
|
2018-09-14 05:02:16 +00:00
|
|
|
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
|
|
|
|
return CreateTextMarker(position->CreatePositionAtEndOfAnchor());
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
- (NSNumber*)expanded {
|
|
|
|
if (![self instanceActive])
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -2030,6 +2040,7 @@ - (NSValue*)selectedTextRange {
|
2018-09-14 05:02:16 +00:00
|
|
|
return [NSValue valueWithRange:NSMakeRange(selStart, selLength)];
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
- (id)selectedTextMarkerRange {
|
|
|
|
if (![self instanceActive])
|
|
|
|
return nil;
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -2062,6 +2073,7 @@ - (id)selectedTextMarkerRange {
|
2018-09-14 05:02:16 +00:00
|
|
|
anchorAffinity, *focusObject,
|
|
|
|
focusOffset, focusAffinity));
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
- (NSValue*)size {
|
|
|
|
if (![self instanceActive])
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -2094,6 +2106,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 {
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -2104,6 +2117,7 @@ - (id)startTextMarker {
|
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 {
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -2404,12 +2418,14 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range {
|
2018-09-14 05:02:16 +00:00
|
|
|
NSMutableAttributedString* attributedValue =
|
|
|
|
[[[NSMutableAttributedString alloc] initWithString:value] autorelease];
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
2018-09-21 00:30:26 +00:00
|
|
|
if (!owner_->IsTextOnlyObject()) {
|
2018-09-14 05:02:16 +00:00
|
|
|
std::vector<const BrowserAccessibility*> textOnlyObjects =
|
2018-09-21 00:30:26 +00:00
|
|
|
BrowserAccessibilityManager::FindTextOnlyObjectsInRange(*owner_,
|
|
|
|
*owner_);
|
2018-09-14 05:02:16 +00:00
|
|
|
AddMisspelledTextAttributes(textOnlyObjects, attributedValue);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
return [attributedValue attributedSubstringFromRange:range];
|
|
|
|
}
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -2494,6 +2510,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
|
|
|
|
if ([attribute isEqualToString:@"AXUIElementForTextMarker"]) {
|
|
|
|
BrowserAccessibilityPositionInstance position =
|
|
|
|
CreatePositionFromTextMarker(parameter);
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -2671,6 +2688,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
|
2018-09-14 05:02:16 +00:00
|
|
|
NSString* text = GetTextForTextMarkerRange(parameter);
|
|
|
|
return [NSNumber numberWithInt:[text length]];
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
if ([attribute isEqualToString:
|
2019-03-21 15:45:22 +00:00
|
|
|
NSAccessibilityBoundsForRangeParameterizedAttribute]) {
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -2704,6 +2722,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]) {
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -2784,6 +2803,7 @@ AXPlatformRange range(position->CreatePreviousLineStartPosition(
|
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
|
2019-05-13 18:49:01 +00:00
|
|
|
index e44929e37ddf2ddd2473e2cc92e94706aa43cdb4..43eb2a27486d12c7f9ce95b95e6dc418817bd097 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
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -488,6 +488,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
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 =
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -495,6 +496,7 @@ void PostAnnouncementNotification(NSString* announcement) {
|
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
|
2019-04-20 17:20:37 +00:00
|
|
|
index e59ac93d0e1554a2df5d8c74db2beba25d090228..6657c48664bdec4964b382f80309d1bfd097a9e9 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 {
|
|
|
|
|
2019-04-20 17:20:37 +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.
|
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
|
2019-05-13 18:49:01 +00:00
|
|
|
index 6151c7b0ce1325402668a17d35be72fd953fcd2d..1836a0fac0cc3561151067d3482a58dc20b07559 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/device/bluetooth/bluetooth_adapter_mac.mm
|
|
|
|
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
|
2019-01-16 18:07:52 +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
|
2019-03-06 17:50:12 +00:00
|
|
|
@@ -49,6 +50,7 @@
|
2018-09-14 05:02:16 +00:00
|
|
|
// [4] https://support.apple.com/kb/PH25091
|
|
|
|
void IOBluetoothPreferenceSetControllerPowerState(int state);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -122,8 +124,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
|
|
|
|
should_update_name_(true),
|
|
|
|
classic_discovery_manager_(
|
|
|
|
BluetoothDiscoveryManagerMac::CreateClassic(this)),
|
2019-05-13 18:49:01 +00:00
|
|
|
@@ -321,8 +325,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
|
2019-04-20 17:20:37 +00:00
|
|
|
index cb7a5305c2d6cbe7b3aa13efdfe6dcc6dfd857e9..e3f3ee7fee0a8f9cf7b3c1b6bed7c2a6cf443954 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/media/audio/BUILD.gn
|
|
|
|
+++ b/media/audio/BUILD.gn
|
2019-03-29 00:05:53 +00:00
|
|
|
@@ -180,6 +180,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",
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
libs += [
|
|
|
|
"AudioToolbox.framework",
|
|
|
|
"AudioUnit.framework",
|
|
|
|
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
|
2019-05-13 18:49:01 +00:00
|
|
|
index a9d6babb03ca318ccd15b254d3785a9ad45698c0..34ba3bfb738226ed8b53a9c24d15af5a5176642f 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
|
2019-04-20 17:20:37 +00:00
|
|
|
index 48ee9253d64faba7c1b9a0e77deac05dc149b874..cebc6f40070ff720eaff7013c9c58767c88cdaff 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
|
2019-03-06 17:50:12 +00:00
|
|
|
@@ -245,6 +245,7 @@ class DnsConfigServicePosix::Watcher {
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
bool Watch() {
|
|
|
|
bool success = true;
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
if (!config_watcher_.Watch(base::Bind(&Watcher::OnConfigChanged,
|
|
|
|
base::Unretained(this)))) {
|
|
|
|
LOG(ERROR) << "DNS config watch failed to start.";
|
2019-03-06 17:50:12 +00:00
|
|
|
@@ -266,6 +267,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
|
2018-10-24 18:24:11 +00:00
|
|
|
index 9073364142e8f98c8872d9b5509f92f433e06624..2356add74dfae98299a4e2b207aa26fc109f47f3 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/sandbox/mac/seatbelt_extension.cc
|
|
|
|
+++ b/sandbox/mac/seatbelt_extension.cc
|
|
|
|
@@ -8,6 +8,7 @@
|
|
|
|
#include "base/memory/ptr_util.h"
|
|
|
|
#include "sandbox/mac/seatbelt_extension_token.h"
|
|
|
|
|
|
|
|
+#ifndef MAS_BUILD
|
|
|
|
// libsandbox private API.
|
|
|
|
extern "C" {
|
|
|
|
extern const char* APP_SANDBOX_READ;
|
|
|
|
@@ -18,6 +19,7 @@ char* sandbox_extension_issue_file(const char* type,
|
|
|
|
const char* path,
|
|
|
|
uint32_t flags);
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
namespace sandbox {
|
|
|
|
|
|
|
|
@@ -46,7 +48,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;
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -58,7 +64,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;
|
|
|
|
@@ -76,9 +86,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;
|