501 lines
18 KiB
Diff
501 lines
18 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/browser_accessibility_cocoa.h b/content/browser/accessibility/browser_accessibility_cocoa.h
|
|
index 9cc52238971a095421c3cde01a5df24a2f6f92cd..0216501dda1dc8b8fb4307785a0dab868bc3315a 100644
|
|
--- a/content/browser/accessibility/browser_accessibility_cocoa.h
|
|
+++ b/content/browser/accessibility/browser_accessibility_cocoa.h
|
|
@@ -109,7 +109,9 @@ struct AXTextEdit {
|
|
@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;
|
|
@@ -120,7 +122,9 @@ struct AXTextEdit {
|
|
@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;
|
|
@@ -143,14 +147,18 @@ struct AXTextEdit {
|
|
// 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 9ed2e56e9ebad1f084074c37484f7f68c8f98460..91ec30df10337f96151e4b2ee1c3182048109de2 100644
|
|
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
|
|
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
|
|
@@ -207,6 +207,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
|
|
@@ -218,6 +219,7 @@
|
|
NSString* const
|
|
NSAccessibilityTextMarkerNodeDebugDescriptionParameterizedAttribute =
|
|
@"AXTextMarkerNodeDebugDescription";
|
|
+#endif
|
|
|
|
// Other private attributes.
|
|
NSString* const NSAccessibilitySelectTextWithCriteriaParameterizedAttribute =
|
|
@@ -241,6 +243,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
|
|
@@ -480,6 +483,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,
|
|
@@ -773,7 +777,9 @@ + (void)initialize {
|
|
{NSAccessibilityEditableAncestorAttribute, @"editableAncestor"},
|
|
{NSAccessibilityElementBusyAttribute, @"elementBusy"},
|
|
{NSAccessibilityEnabledAttribute, @"enabled"},
|
|
+#ifndef MAS_BUILD
|
|
{NSAccessibilityEndTextMarkerAttribute, @"endTextMarker"},
|
|
+#endif
|
|
{NSAccessibilityExpandedAttribute, @"expanded"},
|
|
{NSAccessibilityFocusableAncestorAttribute, @"focusableAncestor"},
|
|
{NSAccessibilityFocusedAttribute, @"focused"},
|
|
@@ -785,8 +791,10 @@ + (void)initialize {
|
|
{NSAccessibilityHighestEditableAncestorAttribute,
|
|
@"highestEditableAncestor"},
|
|
{NSAccessibilityIndexAttribute, @"index"},
|
|
+#ifndef MAS_BUILD
|
|
{NSAccessibilityInsertionPointLineNumberAttribute,
|
|
@"insertionPointLineNumber"},
|
|
+#endif
|
|
{NSAccessibilityInvalidAttribute, @"invalid"},
|
|
{NSAccessibilityIsMultiSelectableAttribute, @"isMultiSelectable"},
|
|
{NSAccessibilityLanguageAttribute, @"language"},
|
|
@@ -808,13 +816,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"},
|
|
@@ -1310,6 +1322,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 {
|
|
@@ -1320,6 +1333,7 @@ - (id)endTextMarker {
|
|
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
|
|
return CreateTextMarker(position->CreatePositionAtEndOfAnchor());
|
|
}
|
|
+#endif
|
|
|
|
- (NSNumber*)expanded {
|
|
if (![self instanceActive])
|
|
@@ -1469,6 +1483,8 @@ - (NSNumber*)index {
|
|
return nil;
|
|
}
|
|
|
|
+
|
|
+#ifndef MAS_BUILD
|
|
- (NSNumber*)insertionPointLineNumber {
|
|
if (![self instanceActive])
|
|
return nil;
|
|
@@ -1491,6 +1507,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.
|
|
@@ -2169,6 +2186,7 @@ - (NSArray*)selectedChildren {
|
|
return ret;
|
|
}
|
|
|
|
+#ifndef MAS_BUILD
|
|
- (NSString*)selectedText {
|
|
if (![self instanceActive])
|
|
return nil;
|
|
@@ -2180,11 +2198,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;
|
|
@@ -2205,12 +2225,15 @@ - (NSValue*)selectedTextRange {
|
|
int selLength = range.GetText().length();
|
|
return [NSValue valueWithRange:NSMakeRange(selStart, selLength)];
|
|
}
|
|
+#endif
|
|
|
|
+#ifndef MAS_BUILD
|
|
- (id)selectedTextMarkerRange {
|
|
if (![self instanceActive])
|
|
return nil;
|
|
return CreateTextMarkerRange(GetSelectedRange(*_owner));
|
|
}
|
|
+#endif
|
|
|
|
- (NSValue*)size {
|
|
if (![self instanceActive])
|
|
@@ -2243,6 +2266,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 {
|
|
@@ -2253,6 +2277,7 @@ - (id)startTextMarker {
|
|
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
|
|
return CreateTextMarker(position->CreatePositionAtStartOfAnchor());
|
|
}
|
|
+#endif
|
|
|
|
// Returns a subrole based upon the role.
|
|
- (NSString*)subrole {
|
|
@@ -2560,11 +2585,13 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range {
|
|
NSMutableAttributedString* attributedValue =
|
|
[[[NSMutableAttributedString alloc] initWithString:value] autorelease];
|
|
|
|
+#ifndef MAS_BUILD
|
|
if (!_owner->IsTextOnlyObject()) {
|
|
AXPlatformRange ax_range(_owner->CreatePositionAt(0),
|
|
_owner->CreatePositionAt(int{text.length()}));
|
|
AddMisspelledTextAttributes(ax_range, attributedValue);
|
|
}
|
|
+#endif
|
|
|
|
return [attributedValue attributedSubstringFromRange:range];
|
|
}
|
|
@@ -2667,9 +2694,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())
|
|
@@ -2980,6 +3006,7 @@ AXPlatformRange range(std::move(lineStartPosition),
|
|
|
|
return CreateTextMarker(root->CreatePositionAt(index));
|
|
}
|
|
+#endif
|
|
|
|
if ([attribute isEqualToString:
|
|
NSAccessibilityBoundsForRangeParameterizedAttribute]) {
|
|
@@ -3013,6 +3040,7 @@ AXPlatformRange range(std::move(lineStartPosition),
|
|
return nil;
|
|
}
|
|
|
|
+#ifndef MAS_BUILD
|
|
if ([attribute
|
|
isEqualToString:
|
|
NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute]) {
|
|
@@ -3119,6 +3147,7 @@ AXPlatformRange range(position->CreatePreviousLineStartPosition(
|
|
|
|
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 9009a7f7bd5505f4a65c90ecc31dca5b2b82f248..88e4b8aad6e882d8085e77f09aa7798fcdcb56ec 100644
|
|
--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
|
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm
|
|
@@ -532,6 +532,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 =
|
|
@@ -539,6 +540,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 e59ac93d0e1554a2df5d8c74db2beba25d090228..6657c48664bdec4964b382f80309d1bfd097a9e9 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.
|
|
@@ -29,6 +32,7 @@ void DisableSystemServices() {
|
|
CHECK_EQ(result, kCGErrorSuccess);
|
|
|
|
sandbox::DisableLaunchServices();
|
|
+#endif
|
|
}
|
|
|
|
} // namespace
|
|
diff --git a/device/bluetooth/bluetooth_adapter_mac.mm b/device/bluetooth/bluetooth_adapter_mac.mm
|
|
index b2425416b1993f037530619df0458d43d008bd03..39b096120b57c3192519a607d96c8a3ddab434e5 100644
|
|
--- a/device/bluetooth/bluetooth_adapter_mac.mm
|
|
+++ b/device/bluetooth/bluetooth_adapter_mac.mm
|
|
@@ -36,6 +36,7 @@
|
|
#include "device/bluetooth/bluetooth_low_energy_peripheral_manager_delegate.h"
|
|
#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
|
|
@@ -49,6 +50,7 @@
|
|
// [4] https://support.apple.com/kb/PH25091
|
|
void IOBluetoothPreferenceSetControllerPowerState(int state);
|
|
}
|
|
+#endif
|
|
|
|
namespace {
|
|
|
|
@@ -121,8 +123,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 3947aa5016f9a061d98cdb838c413b204dbcbd19..36ccf8cc6e0e91e0f754d22ac69e702007af6391 100644
|
|
--- a/media/audio/BUILD.gn
|
|
+++ b/media/audio/BUILD.gn
|
|
@@ -175,6 +175,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",
|
|
+ ]
|
|
+ }
|
|
libs += [
|
|
"AudioToolbox.framework",
|
|
"AudioUnit.framework",
|
|
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
|
|
index 26436b47942b14e419adb5780c45a9d42224d39f..215abac9672f72aeef7694e97ff260ae7546d061 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 2e0f06b0c1e4b1670bfe8145b3c5abb178b47d62..2f9483283a789a69d7e85536620daa2e35ee9155 100644
|
|
--- a/net/dns/dns_config_service_posix.cc
|
|
+++ b/net/dns/dns_config_service_posix.cc
|
|
@@ -246,6 +246,7 @@ class DnsConfigServicePosix::Watcher {
|
|
|
|
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.";
|
|
@@ -267,6 +268,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 9073364142e8f98c8872d9b5509f92f433e06624..2356add74dfae98299a4e2b207aa26fc109f47f3 100644
|
|
--- 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;
|