Skip to content

Commit

Permalink
mac: Remove IsOSMountainLion().
Browse files Browse the repository at this point in the history
BUG=579255
TBR=brettw

Review-Url: https://codereview.chromium.org/2027693004
Cr-Commit-Position: refs/heads/master@{#396973}
  • Loading branch information
nico authored and Commit bot committed May 31, 2016
1 parent dc9e970 commit 5991e16
Show file tree
Hide file tree
Showing 26 changed files with 34 additions and 191 deletions.
20 changes: 0 additions & 20 deletions base/mac/mac_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,8 @@ BASE_EXPORT bool RemoveQuarantineAttribute(const FilePath& file_path);
// "OrLater" variants to those that check for a specific version, unless you
// know for sure that you need to check for a specific version.

// Mountain Lion is Mac OS X 10.8, Darwin 12.
BASE_EXPORT bool IsOSMountainLion();
BASE_EXPORT bool IsOSMountainLionOrEarlier();
BASE_EXPORT bool IsOSMountainLionOrLater();

// Mavericks is Mac OS X 10.9, Darwin 13.
BASE_EXPORT bool IsOSMavericks();
BASE_EXPORT bool IsOSMavericksOrEarlier();
BASE_EXPORT bool IsOSMavericksOrLater();

// Yosemite is Mac OS X 10.10, Darwin 14.
Expand All @@ -139,27 +133,13 @@ BASE_EXPORT bool IsOSLaterThanElCapitan_DontCallThis();

// Inline functions that are redundant due to version ranges being mutually-
// exclusive.
inline bool IsOSMountainLionOrEarlier() { return !IsOSMavericksOrLater(); }
inline bool IsOSMavericksOrEarlier() { return !IsOSYosemiteOrLater(); }
inline bool IsOSYosemiteOrEarlier() { return !IsOSElCapitanOrLater(); }

// When the deployment target is set, the code produced cannot run on earlier
// OS releases. That enables some of the IsOS* family to be implemented as
// constant-value inline functions. The MAC_OS_X_VERSION_MIN_REQUIRED macro
// contains the value of the deployment target.

#if defined(MAC_OS_X_VERSION_10_8) && \
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8
#define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_8
inline bool IsOSMountainLionOrLater() { return true; }
#endif

#if defined(MAC_OS_X_VERSION_10_8) && \
MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_8
#define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_8
inline bool IsOSMountainLion() { return false; }
#endif

#if defined(MAC_OS_X_VERSION_10_9) && \
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9
#define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_9
Expand Down
27 changes: 1 addition & 26 deletions base/mac/mac_util_unittest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -145,25 +145,8 @@
base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);

if (major == 10) {
if (minor == 8) {
EXPECT_TRUE(IsOSMountainLion());
EXPECT_TRUE(IsOSMountainLionOrEarlier());
EXPECT_TRUE(IsOSMountainLionOrLater());
EXPECT_FALSE(IsOSMavericks());
EXPECT_TRUE(IsOSMavericksOrEarlier());
EXPECT_FALSE(IsOSMavericksOrLater());
EXPECT_FALSE(IsOSYosemite());
EXPECT_TRUE(IsOSYosemiteOrEarlier());
EXPECT_FALSE(IsOSYosemiteOrLater());
EXPECT_FALSE(IsOSElCapitan());
EXPECT_FALSE(IsOSElCapitanOrLater());
EXPECT_FALSE(IsOSLaterThanElCapitan_DontCallThis());
} else if (minor == 9) {
EXPECT_FALSE(IsOSMountainLion());
EXPECT_FALSE(IsOSMountainLionOrEarlier());
EXPECT_TRUE(IsOSMountainLionOrLater());
if (minor == 9) {
EXPECT_TRUE(IsOSMavericks());
EXPECT_TRUE(IsOSMavericksOrEarlier());
EXPECT_TRUE(IsOSMavericksOrLater());
EXPECT_FALSE(IsOSYosemite());
EXPECT_TRUE(IsOSYosemiteOrEarlier());
Expand All @@ -172,11 +155,7 @@
EXPECT_FALSE(IsOSElCapitanOrLater());
EXPECT_FALSE(IsOSLaterThanElCapitan_DontCallThis());
} else if (minor == 10) {
EXPECT_FALSE(IsOSMountainLion());
EXPECT_FALSE(IsOSMountainLionOrEarlier());
EXPECT_TRUE(IsOSMountainLionOrLater());
EXPECT_FALSE(IsOSMavericks());
EXPECT_FALSE(IsOSMavericksOrEarlier());
EXPECT_TRUE(IsOSMavericksOrLater());
EXPECT_TRUE(IsOSYosemite());
EXPECT_TRUE(IsOSYosemiteOrEarlier());
Expand All @@ -185,11 +164,7 @@
EXPECT_FALSE(IsOSElCapitanOrLater());
EXPECT_FALSE(IsOSLaterThanElCapitan_DontCallThis());
} else if (minor == 11) {
EXPECT_FALSE(IsOSMountainLion());
EXPECT_FALSE(IsOSMountainLionOrEarlier());
EXPECT_TRUE(IsOSMountainLionOrLater());
EXPECT_FALSE(IsOSMavericks());
EXPECT_FALSE(IsOSMavericksOrEarlier());
EXPECT_TRUE(IsOSMavericksOrLater());
EXPECT_FALSE(IsOSYosemite());
EXPECT_FALSE(IsOSYosemiteOrEarlier());
Expand Down
3 changes: 0 additions & 3 deletions base/memory/memory_pressure_monitor_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ MemoryPressureMonitor::~MemoryPressureMonitor() {

MemoryPressureListener::MemoryPressureLevel
MemoryPressureMonitor::GetCurrentPressureLevel() const {
if (base::mac::IsOSMountainLionOrEarlier()) {
return MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE;
}
int mac_memory_pressure;
size_t length = sizeof(int);
sysctlbyname("kern.memorystatus_vm_pressure_level", &mac_memory_pressure,
Expand Down
3 changes: 1 addition & 2 deletions base/process/memory_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ bool CanGetContextForCFAllocator() {
}

CFAllocatorContext* ContextForCFAllocator(CFAllocatorRef allocator) {
if (base::mac::IsOSMountainLion() ||
base::mac::IsOSMavericks() || base::mac::IsOSYosemite() ||
if (base::mac::IsOSMavericks() || base::mac::IsOSYosemite() ||
base::mac::IsOSElCapitan()) {
ChromeCFAllocatorLions* our_allocator =
const_cast<ChromeCFAllocatorLions*>(
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/browser_keyevents_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -733,8 +733,7 @@ IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) {
#if defined(OS_MACOSX)
IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, EditorKeyBindings) {
// TODO(kbr): re-enable: http://crbug.com/222296
if (base::mac::IsOSMountainLionOrLater())
return;
return;

static const KeyEventTestData kTestCtrlA = {
ui::VKEY_A, true, false, false, false,
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/obsolete_system/obsolete_system_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

// static
bool ObsoleteSystem::IsObsoleteNowOrSoon() {
return base::mac::IsOSMountainLionOrEarlier();
return false;
}

// static
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ void TestControls(AppWindow* app_window) {
// fullscreen action. The above check that collectionBehavior does not include
// NSWindowCollectionBehaviorFullScreenPrimary is sufficient to determine that
// the window can't be fullscreened.
if (base::mac::IsOSMavericksOrEarlier()) {
if (base::mac::IsOSMavericks()) {
EXPECT_EQ(can_fullscreen,
[[ns_window standardWindowButton:NSWindowZoomButton] isEnabled]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
NSAttributedString* title = [self attributedTitle];
if ([title length])
[self drawTitle:title withFrame:titleRect inView:controlView];

[self drawFocusRingWithFrame:cellFrame inView:controlView];
}

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,7 @@ void VerifyFullscreenResizeFlagsAfterTransition() {
IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest,
DISABLED_FloatingBarBelowContentView) {
// TODO(kbr): re-enable: http://crbug.com/222296
if (base::mac::IsOSMountainLionOrLater())
return;
return;

chrome::ToggleFullscreenMode(browser());

Expand Down
4 changes: 0 additions & 4 deletions chrome/browser/ui/cocoa/browser_window_controller_private.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1151,10 +1151,6 @@ - (BOOL)shouldUseMavericksAppKitFullscreenHack {
}

- (BOOL)shouldUseCustomAppKitFullscreenTransition:(BOOL)enterFullScreen {
// Custom fullscreen transitions should only be available in OSX 10.9+.
if (base::mac::IsOSMountainLionOrEarlier())
return NO;

// Disable the custom exit animation in OSX 10.9: http://crbug.com/526327#c3.
if (base::mac::IsOSMavericks() && !enterFullScreen)
return NO;
Expand Down
5 changes: 2 additions & 3 deletions chrome/browser/ui/cocoa/custom_frame_view.mm
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ + (void)load {

// In Yosemite, the fullscreen button replaces the zoom button. We no longer
// need to swizzle out this AppKit private method.
if (!base::mac::IsOSMavericksOrEarlier())
if (!base::mac::IsOSMavericks())
return;

base::mac::ScopedNSAutoreleasePool pool;

// On 10.8+ the background for textured windows are no longer drawn by
// NSGrayFrame, and NSThemeFrame is used instead <http://crbug.com/114745>.
Class borderViewClass = NSClassFromString(
base::mac::IsOSMountainLionOrLater() ? @"NSThemeFrame" : @"NSGrayFrame");
Class borderViewClass = NSClassFromString(@"NSThemeFrame");
DCHECK(borderViewClass);
if (!borderViewClass) return;

Expand Down
9 changes: 3 additions & 6 deletions chrome/browser/ui/cocoa/custom_frame_view_unittest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
CustomFrameViewTest() {
NSRect frame = NSMakeRect(0, 0, 50, 50);
// We create NSGrayFrame instead of CustomFrameView because
// we are swizzling into NSGrayFrame. (NSThemeFrame on Mountain Lion and
// later)
Class customFrameClass = NSClassFromString(
base::mac::IsOSMountainLionOrLater() ? @"NSThemeFrame"
: @"NSGrayFrame");
// we are swizzling into NSThemeFrame.
Class customFrameClass = NSClassFromString(@"NSThemeFrame");
view_.reset([[customFrameClass alloc] initWithFrame:frame]);
}

Expand All @@ -31,7 +28,7 @@
TEST_F(CustomFrameViewTest, SuccessfulClassModifications) {
// In Yosemite, the fullscreen button replaces the zoom button. We no longer
// need to swizzle out this AppKit private method.
if (!base::mac::IsOSMavericksOrEarlier())
if (!base::mac::IsOSMavericks())
return;

unsigned int count;
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/ui/cocoa/image_button_cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ enum ButtonState {
// Draws the cell's image within |cellFrame|.
- (void)drawImageWithFrame:(NSRect)cellFrame inView:(NSView*)controlView;

// If |controlView| is a first responder then draws a blue focus ring.
- (void)drawFocusRingWithFrame:(NSRect)cellFrame inView:(NSView*)controlView;

@end

#endif // CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_
22 changes: 0 additions & 22 deletions chrome/browser/ui/cocoa/image_button_cell.mm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ - (void)drawImageWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
[self drawImageWithFrame:cellFrame inView:controlView];
[self drawFocusRingWithFrame:cellFrame inView:controlView];
}

- (void)setImageID:(NSInteger)imageID
Expand Down Expand Up @@ -134,27 +133,6 @@ - (CGFloat)imageAlphaForWindowState:(NSWindow*)window {
return [window themeProvider];
}

- (void)drawFocusRingWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
// Draw custom focus ring only if AppKit won't draw one automatically.
// The new focus ring APIs became available with 10.7, but did not get
// applied to buttons (only editable text fields) until 10.8.
if (base::mac::IsOSMountainLionOrLater())
return;

if (![self showsFirstResponder])
return;
gfx::ScopedNSGraphicsContextSaveGState scoped_state;
const CGFloat lineWidth = [controlView cr_lineWidth];
rect_path_utils::FrameRectWithInset(rect_path_utils::RoundedCornerAll,
NSInsetRect(cellFrame, 0, lineWidth),
0.0, // insetX
0.0, // insetY
3.0, // outerRadius
lineWidth * 2, // lineWidth
[controlView
cr_keyboardFocusIndicatorColor]);
}

- (image_button_cell::ButtonState)currentButtonState {
bool (^has)(image_button_cell::ButtonState) =
^(image_button_cell::ButtonState state) {
Expand Down
7 changes: 1 addition & 6 deletions chrome/browser/ui/cocoa/presentation_mode_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,8 @@ - (void)windowDidResignMain:(NSNotification*)notification {
}

// On OSX 10.8+, the menu bar shows on the secondary screen in fullscreen.
// On OSX 10.7, fullscreen never fills the secondary screen.
// On OSX 10.6, the menu bar never shows on the secondary screen in fullscreen.
// See http://crbug.com/388906 for full details.
- (CGFloat)floatingBarVerticalOffset {
if (base::mac::IsOSMountainLionOrLater())
return kFloatingBarVerticalOffset;
return [self isWindowOnPrimaryScreen] ? kFloatingBarVerticalOffset : 0;
return kFloatingBarVerticalOffset;
}

- (void)overlayFrameChanged:(NSRect)frame {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ void ContinueWithCertificate(net::X509Certificate* cert) override {
// Flaky on 10.7; crbug.com/313243
IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest, DISABLED_Basic) {
// TODO(kbr): re-enable: http://crbug.com/222296
if (base::mac::IsOSMountainLionOrLater())
return;
return;

content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
Expand Down
2 changes: 0 additions & 2 deletions chrome/browser/ui/cocoa/toolbar/app_toolbar_button_cell.mm
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
[self currentBezelType]);
}
canvas.Restore();

[self drawFocusRingWithFrame:cellFrame inView:controlView];
}

- (void)setSeverity:(AppMenuIconPainter::Severity)severity
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/ui/tests/ui_gfx_image_unittest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
// http://crbug.com/247379
TEST_F(UiGfxImageTest, DISABLED_CheckColor) {
// TODO(kbr): re-enable: http://crbug.com/222296
if (base::mac::IsOSMountainLionOrLater())
return;
return;

gfx::Image image = gfx::Image::CreateFrom1xBitmap(
gfx::test::CreateBitmap(25, 25));
Expand Down
19 changes: 5 additions & 14 deletions content/browser/theme_helper_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,11 @@ + (void)registerAsObserver {
object:nil
suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce];

if (base::mac::IsOSMountainLionOrLater()) {
[distributedCenter addObserver:self
selector:@selector(behaviorPrefsChanged:)
name:@"NSScrollAnimationEnabled"
object:nil
suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce];
} else {
// Register for < 10.8
[distributedCenter addObserver:self
selector:@selector(behaviorPrefsChanged:)
name:@"AppleScrollAnimationEnabled"
object:nil
suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce];
}
[distributedCenter addObserver:self
selector:@selector(behaviorPrefsChanged:)
name:@"NSScrollAnimationEnabled"
object:nil
suspensionBehavior:NSNotificationSuspensionBehaviorCoalesce];

[distributedCenter addObserver:self
selector:@selector(appearancePrefsChanged:)
Expand Down
9 changes: 3 additions & 6 deletions content/common/sandbox_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,11 @@ NOINLINE void FatalStringQuoteException(const std::string& str) {
[color colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
}

if (sandbox_type == SANDBOX_TYPE_RENDERER &&
base::mac::IsOSMountainLionOrLater()) {
if (sandbox_type == SANDBOX_TYPE_RENDERER) {
// Now disconnect from WindowServer, after all objects have been warmed up.
// Shutting down the connection requires connecting to WindowServer,
// so do this before actually engaging the sandbox. This is only done on
// 10.8 and higher because doing it on earlier OSes causes layout tests to
// fail <http://crbug.com/397642#c48>. This may cause two log messages to
// be printed to the system logger on certain OS versions.
// so do this before actually engaging the sandbox. This may cause two log
// messages to be printed to the system logger on certain OS versions.
CGSSetDenyWindowServerConnections(true);
CGSShutdownServerConnections();
}
Expand Down
2 changes: 1 addition & 1 deletion sandbox/mac/os_compatibility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class OSCompatibility_10_10 : public OSCompatibility {

// static
std::unique_ptr<OSCompatibility> OSCompatibility::CreateForPlatform() {
if (base::mac::IsOSMavericksOrEarlier())
if (base::mac::IsOSMavericks())
return base::WrapUnique(new OSCompatibility_10_7());
else
return base::WrapUnique(new OSCompatibility_10_10());
Expand Down
Loading

0 comments on commit 5991e16

Please sign in to comment.