Skip to content

Commit

Permalink
fixup! fix: silent printing mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ckerr committed Jul 15, 2019
1 parent 8e68e6e commit b8796c4
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 54 deletions.
2 changes: 1 addition & 1 deletion patches/common/chromium/browser_compositor_mac.patch
Expand Up @@ -29,7 +29,7 @@ diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/cont
index 0817b4eca4f4e6f7f5d250589c1e4dbcc068237c..dcc2340e59771e8d73de7e97fa2371d8bec7b149 100644
--- a/content/browser/renderer_host/browser_compositor_view_mac.mm
+++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -79,6 +79,12 @@
@@ -79,6 +79,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
DCHECK_EQ(1u, num_erased);
}

Expand Down
10 changes: 5 additions & 5 deletions patches/common/chromium/color_chooser_mac.patch
Expand Up @@ -63,7 +63,7 @@ diff --git a/chrome/browser/ui/cocoa/color_chooser_mac.mm b/chrome/browser/ui/co
index bf47154f0a880f1c6143065e5c6d060f1df73765..e7cdab7a23d96345cc6e8ec578a8616d132b7d51 100644
--- a/chrome/browser/ui/cocoa/color_chooser_mac.mm
+++ b/chrome/browser/ui/cocoa/color_chooser_mac.mm
@@ -39,16 +39,18 @@
@@ -39,16 +39,18 @@ void ColorChooserMac::DidChooseColorInColorPanel(SkColor color) {
web_contents_->DidChooseColorInColorChooser(color);
}

Expand All @@ -87,7 +87,7 @@ index bf47154f0a880f1c6143065e5c6d060f1df73765..e7cdab7a23d96345cc6e8ec578a8616d
}

void ColorChooserMac::SetSelectedColor(SkColor color) {
@@ -67,9 +69,14 @@ - (id)initWithChooser:(ColorChooserMac*)chooser {
@@ -67,9 +69,14 @@ void ColorChooserMac::SetSelectedColor(SkColor color) {
chooser_ = chooser;
NSColorPanel* panel = [NSColorPanel sharedColorPanel];
[panel setShowsAlpha:NO];
Expand All @@ -103,7 +103,7 @@ index bf47154f0a880f1c6143065e5c6d060f1df73765..e7cdab7a23d96345cc6e8ec578a8616d
}
return self;
}
@@ -82,19 +89,21 @@ - (void)dealloc {
@@ -82,19 +89,21 @@ void ColorChooserMac::SetSelectedColor(SkColor color) {
// the ColorPanelCocoa is still the target.
BOOL respondsToPrivateTargetMethod =
[panel respondsToSelector:@selector(__target)];
Expand Down Expand Up @@ -134,7 +134,7 @@ diff --git a/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm b/chrome/brow
index 83185ceb9bbd29bf38fce7f72c23f3a5b15ba6c8..823365fdfc0bceceeed6f5edc00b3462715a4751 100644
--- a/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm
+++ b/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm
@@ -28,28 +28,6 @@ void SetUp() override {
@@ -28,28 +28,6 @@ class ColorPanelCocoaTest : public CocoaTest {
}
};

Expand Down Expand Up @@ -163,7 +163,7 @@ index 83185ceb9bbd29bf38fce7f72c23f3a5b15ba6c8..823365fdfc0bceceeed6f5edc00b3462
TEST_F(ColorPanelCocoaTest, ClearTargetOnEnd) {
NSColorPanel* nscolor_panel = [NSColorPanel sharedColorPanel];
@autoreleasepool {
@@ -61,19 +39,12 @@ void SetUp() override {
@@ -61,19 +39,12 @@ TEST_F(ColorPanelCocoaTest, ClearTargetOnEnd) {

// Confirm the NSColorPanel's configuration by the ColorChooserMac's
// ColorPanelCocoa.
Expand Down
4 changes: 2 additions & 2 deletions patches/common/chromium/command-ismediakey.patch
Expand Up @@ -18,7 +18,7 @@ diff --git a/chrome/browser/extensions/global_shortcut_listener_mac.mm b/chrome/
index befe726af9c10b1563a7fc0bb77cc55f65943d5c..46c6fe08bab8471007f78d3ef227e5195bfdf0e1 100644
--- a/chrome/browser/extensions/global_shortcut_listener_mac.mm
+++ b/chrome/browser/extensions/global_shortcut_listener_mac.mm
@@ -21,6 +21,26 @@
@@ -21,6 +21,26 @@ using extensions::GlobalShortcutListenerMac;

namespace extensions {

Expand Down Expand Up @@ -104,7 +104,7 @@ index b48fa8e63867021bdd77bf585a0e02c366980d91..bae9e24e7bcf7615be243bcb5629cc59
}
return VKEY_UNKNOWN;
}
@@ -190,7 +196,10 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
@@ -190,7 +196,10 @@ CGEventRef MediaKeysListenerImpl::EventTapCallback(CGEventTapProxy proxy,
int key_code = (data1 & 0xFFFF0000) >> 16;
if (key_code != NX_KEYTYPE_PLAY && key_code != NX_KEYTYPE_NEXT &&
key_code != NX_KEYTYPE_PREVIOUS && key_code != NX_KEYTYPE_FAST &&
Expand Down
6 changes: 3 additions & 3 deletions patches/common/chromium/mas-cfisobjc.patch
Expand Up @@ -9,15 +9,15 @@ diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index 2d619e791c03a17d29ed47abe765a0a644b364bc..c36989c429344d85a0f5efe11754de13b12ec5df 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -26,7 +26,6 @@
@@ -26,7 +26,6 @@ CFTypeID SecKeyGetTypeID();
#if !defined(OS_IOS)
CFTypeID SecACLGetTypeID();
CFTypeID SecTrustedApplicationGetTypeID();
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
#endif
} // extern "C"

@@ -326,8 +325,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
@@ -326,8 +325,7 @@ NSFont* CFToNSCast(CTFontRef cf_val) {
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
DCHECK(!cf_val ||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
Expand All @@ -27,7 +27,7 @@ index 2d619e791c03a17d29ed47abe765a0a644b364bc..c36989c429344d85a0f5efe11754de13
return ns_val;
}

@@ -395,9 +393,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
@@ -395,9 +393,6 @@ CFCast<CTFontRef>(const CFTypeRef& cf_val) {
return (CTFontRef)(cf_val);
}

Expand Down
6 changes: 3 additions & 3 deletions patches/common/chromium/mas_blink_no_private_api.patch
Expand Up @@ -18,7 +18,7 @@ index 94afefcee81b87c05bf9b1199d90d3d4b5ea84a6..2ec7f04c71824b47de1ddbf1f0e8625d
extern "C" {

// Kill ring calls. Would be better to use NSKillRing.h, but that's not
@@ -39,38 +40,53 @@
@@ -39,38 +40,53 @@ NSString* _NSYankFromKillRing();
void _NSNewKillRingSequence();
void _NSSetKillRingToYankedState();
}
Expand Down Expand Up @@ -92,7 +92,7 @@ index 7a1260db0a139f9f3f8a823af2c220f36162812a..bf9cf7046e2fc9cdfee5b92f2a348185

namespace blink {

@@ -73,10 +75,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
@@ -73,10 +75,12 @@ bool ThemePainterMac::PaintTextField(const Node* node,
// behavior change while remaining a fragile solution.
// https://bugs.chromium.org/p/chromium/issues/detail?id=658085#c3
if (!use_ns_text_field_cell) {
Expand All @@ -105,7 +105,7 @@ index 7a1260db0a139f9f3f8a823af2c220f36162812a..bf9cf7046e2fc9cdfee5b92f2a348185
return false;
}

@@ -162,10 +166,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
@@ -162,10 +166,12 @@ bool ThemePainterMac::PaintTextArea(const Node* node,
const PaintInfo& paint_info,
const IntRect& r) {
LocalCurrentGraphicsContext local_context(paint_info.context, r);
Expand Down
42 changes: 21 additions & 21 deletions patches/common/chromium/mas_no_private_api.patch
Expand Up @@ -41,23 +41,23 @@ diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/cont
index d1e716429cd96588c2df06d7c55ed6053d190f64..e1f41179b1cb3f9c68900ad0f0b0dbad6e989746 100644
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
@@ -135,6 +135,7 @@
@@ -135,6 +135,7 @@ NSDictionary* attributeToMethodNameMap = nil;
// 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
@@ -341,6 +342,7 @@ void AddMisspelledTextAttributes(
@@ -341,6 +342,7 @@ NSAttributedString* GetAttributedTextForTextMarkerRange(
AddMisspelledTextAttributes(text_only_objects, attributed_text);
return [attributed_text attributedSubstringFromRange:range];
}
+#endif

// Returns an autoreleased copy of the AXNodeData's attribute.
NSString* NSStringForStringAttribute(
@@ -595,7 +597,9 @@ + (void)initialize {
@@ -595,7 +597,9 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
{NSAccessibilityDOMIdentifierAttribute, @"domIdentifier"},
{NSAccessibilityEditableAncestorAttribute, @"editableAncestor"},
{NSAccessibilityEnabledAttribute, @"enabled"},
Expand All @@ -67,7 +67,7 @@ index d1e716429cd96588c2df06d7c55ed6053d190f64..e1f41179b1cb3f9c68900ad0f0b0dbad
{NSAccessibilityExpandedAttribute, @"expanded"},
{NSAccessibilityFocusableAncestorAttribute, @"focusableAncestor"},
{NSAccessibilityFocusedAttribute, @"focused"},
@@ -630,13 +634,17 @@ + (void)initialize {
@@ -630,13 +634,17 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
{NSAccessibilityRowsAttribute, @"rows"},
// TODO(aboxhall): expose
// NSAccessibilityServesAsTitleForUIElementsAttribute
Expand All @@ -85,55 +85,55 @@ index d1e716429cd96588c2df06d7c55ed6053d190f64..e1f41179b1cb3f9c68900ad0f0b0dbad
{NSAccessibilitySizeAttribute, @"size"},
{NSAccessibilitySortDirectionAttribute, @"sortDirection"},
{NSAccessibilitySubroleAttribute, @"subrole"},
@@ -1052,6 +1060,7 @@ - (NSNumber*)enabled {
@@ -1052,6 +1060,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
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 {
@@ -1062,6 +1071,7 @@ - (id)endTextMarker {
@@ -1062,6 +1071,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
return CreateTextMarker(position->CreatePositionAtEndOfAnchor());
}
+#endif

- (NSNumber*)expanded {
if (![self instanceActive])
@@ -1922,6 +1932,7 @@ - (NSValue*)selectedTextRange {
@@ -1922,6 +1932,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
return [NSValue valueWithRange:NSMakeRange(selStart, selLength)];
}

+#ifndef MAS_BUILD
- (id)selectedTextMarkerRange {
if (![self instanceActive])
return nil;
@@ -1954,6 +1965,7 @@ - (id)selectedTextMarkerRange {
@@ -1954,6 +1965,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
anchorAffinity, *focusObject,
focusOffset, focusAffinity));
}
+#endif

- (NSValue*)size {
if (![self instanceActive])
@@ -1986,6 +1998,7 @@ - (NSString*)sortDirection {
@@ -1986,6 +1998,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
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 {
@@ -1996,6 +2009,7 @@ - (id)startTextMarker {
@@ -1996,6 +2009,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
BrowserAccessibilityPositionInstance position = root->CreatePositionAt(0);
return CreateTextMarker(position->CreatePositionAtStartOfAnchor());
}
+#endif

// Returns a subrole based upon the role.
- (NSString*) subrole {
@@ -2301,12 +2315,14 @@ - (NSAttributedString*)attributedValueForRange:(NSRange)range {
@@ -2301,12 +2315,14 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
NSMutableAttributedString* attributedValue =
[[[NSMutableAttributedString alloc] initWithString:value] autorelease];

Expand All @@ -148,31 +148,31 @@ index d1e716429cd96588c2df06d7c55ed6053d190f64..e1f41179b1cb3f9c68900ad0f0b0dbad

return [attributedValue attributedSubstringFromRange:range];
}
@@ -2392,6 +2408,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
@@ -2392,6 +2408,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
return ToBrowserAccessibilityCocoa(cell);
}

+#ifndef MAS_BUILD
if ([attribute isEqualToString:@"AXUIElementForTextMarker"]) {
BrowserAccessibilityPositionInstance position =
CreatePositionFromTextMarker(parameter);
@@ -2569,6 +2586,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
@@ -2569,6 +2586,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
NSString* text = GetTextForTextMarkerRange(parameter);
return [NSNumber numberWithInt:[text length]];
}
+#endif

if ([attribute isEqualToString:
NSAccessibilityBoundsForRangeParameterizedAttribute]) {
@@ -2602,6 +2620,7 @@ - (id)accessibilityAttributeValue:(NSString*)attribute
@@ -2602,6 +2620,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
return nil;
}

+#ifndef MAS_BUILD
if ([attribute isEqualToString:
NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute]) {
BrowserAccessibilityPositionInstance position =
@@ -2677,6 +2696,7 @@ AXPlatformRange range(position->CreatePreviousLineStartPosition(
@@ -2677,6 +2696,7 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";

return @(child->GetIndexInParent());
}
Expand All @@ -184,15 +184,15 @@ diff --git a/content/browser/accessibility/browser_accessibility_manager_mac.mm
index 242a86ddd00517adc5e09310a25739ee34b3d23c..aa95e8ba159e5e185f0814d13d8743f3e5be9b67 100644
--- a/content/browser/accessibility/browser_accessibility_manager_mac.mm
+++ b/content/browser/accessibility/browser_accessibility_manager_mac.mm
@@ -463,6 +463,7 @@ void PostAnnouncementNotification(NSString* announcement) {
@@ -463,6 +463,7 @@ NSDictionary* BrowserAccessibilityManagerMac::
[user_info setObject:native_focus_object
forKey:NSAccessibilityTextChangeElement];

+#ifndef MAS_BUILD
id selected_text = [native_focus_object selectedTextMarkerRange];
if (selected_text) {
NSString* const NSAccessibilitySelectedTextMarkerRangeAttribute =
@@ -470,6 +471,7 @@ void PostAnnouncementNotification(NSString* announcement) {
@@ -470,6 +471,7 @@ NSDictionary* BrowserAccessibilityManagerMac::
[user_info setObject:selected_text
forKey:NSAccessibilitySelectedTextMarkerRangeAttribute];
}
Expand All @@ -216,7 +216,7 @@ index b7142c2871faf4a0ba8be79266e9515d81585bdd..3d80c332e9af280a166612f6be54b6f7

namespace content {

@@ -35,6 +37,7 @@
@@ -35,6 +37,7 @@ namespace {
// verifies there are no existing open connections), and then indicates that
// Chrome should continue execution without access to launchservicesd.
void DisableSystemServices() {
Expand Down Expand Up @@ -244,15 +244,15 @@ index 6299846975301964c4066dff1a7eec40778e8d7f..c9c64e9ea8af9c02099695db38c27871
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 @@
@@ -49,6 +50,7 @@ extern "C" {
// [4] https://support.apple.com/kb/PH25091
void IOBluetoothPreferenceSetControllerPowerState(int state);
}
+#endif

namespace {

@@ -128,8 +130,10 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
@@ -128,8 +130,10 @@ BluetoothAdapterMac::BluetoothAdapterMac()
controller_state_function_(
base::BindRepeating(&BluetoothAdapterMac::GetHostControllerState,
base::Unretained(this))),
Expand All @@ -263,7 +263,7 @@ index 6299846975301964c4066dff1a7eec40778e8d7f..c9c64e9ea8af9c02099695db38c27871
should_update_name_(true),
classic_discovery_manager_(
BluetoothDiscoveryManagerMac::CreateClassic(this)),
@@ -327,8 +331,12 @@ CBCentralManagerState GetCBManagerState(CBCentralManager* manager) {
@@ -327,8 +331,12 @@ bool BluetoothAdapterMac::IsLowEnergyAvailable() {
}

bool BluetoothAdapterMac::SetPoweredImpl(bool powered) {
Expand Down

0 comments on commit b8796c4

Please sign in to comment.