base::mac::IsOSSierra() -> base::mac::IsOS10_12(), etc.
BUG=636093 TBR=jam@chromium.org Review-Url: https://codereview.chromium.org/2271653006 Cr-Commit-Position: refs/heads/master@{#415359}
This commit is contained in:
base
chrome/browser
app_controller_mac.mm
ui
cocoa
apps
bookmarks
browser_window_controller.mmbrowser_window_controller_private.mmbrowser_window_fullscreen_transition.mmbrowser_window_layout.mmcustom_frame_view.mmcustom_frame_view_unittest.mmlocation_bar
omnibox
renderer_context_menu
tabs
toolbar
components
content
browser
common
renderer
device/bluetooth
sandbox/mac
third_party/WebKit/Source
core
layout
platform
ui
@ -5,7 +5,6 @@
|
||||
#ifndef BASE_MAC_MAC_UTIL_H_
|
||||
#define BASE_MAC_MAC_UTIL_H_
|
||||
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
@ -108,85 +107,77 @@ BASE_EXPORT bool WasLaunchedAsHiddenLoginItem();
|
||||
// an error, or true otherwise.
|
||||
BASE_EXPORT bool RemoveQuarantineAttribute(const FilePath& file_path);
|
||||
|
||||
namespace internal {
|
||||
|
||||
// Returns the system's Mac OS X minor version. This is the |y| value
|
||||
// in 10.y or 10.y.z.
|
||||
BASE_EXPORT int MacOSXMinorVersion();
|
||||
|
||||
} // namespace internal
|
||||
|
||||
// Run-time OS version checks. Use these instead of
|
||||
// base::SysInfo::OperatingSystemVersionNumbers. Prefer the "OrEarlier" and
|
||||
// "OrLater" variants to those that check for a specific version, unless you
|
||||
// base::SysInfo::OperatingSystemVersionNumbers. Prefer the "AtLeast" and
|
||||
// "AtMost" variants to those that check for a specific version, unless you
|
||||
// know for sure that you need to check for a specific version.
|
||||
|
||||
// Mavericks is OS X 10.9, Darwin 13.
|
||||
BASE_EXPORT bool IsOSMavericks();
|
||||
#define _DEFINE_IS_OS_FUNCS(V, ID) \
|
||||
inline bool IsOS10_##V() { \
|
||||
return MAC_OS_X_VERSION_MIN_REQUIRED <= ID && \
|
||||
internal::MacOSXMinorVersion() == V; \
|
||||
} \
|
||||
inline bool IsAtLeastOS10_##V() { \
|
||||
return MAC_OS_X_VERSION_MIN_REQUIRED >= ID || \
|
||||
internal::MacOSXMinorVersion() >= V; \
|
||||
} \
|
||||
inline bool IsAtMostOS10_##V() { \
|
||||
return MAC_OS_X_VERSION_MIN_REQUIRED <= ID && \
|
||||
internal::MacOSXMinorVersion() <= V; \
|
||||
}
|
||||
|
||||
// Yosemite is OS X 10.10, Darwin 14.
|
||||
BASE_EXPORT bool IsOSYosemite();
|
||||
BASE_EXPORT bool IsOSYosemiteOrEarlier();
|
||||
BASE_EXPORT bool IsOSYosemiteOrLater();
|
||||
// Apple adopted this format in 10.10: 10.11.0 becomes 101100
|
||||
#define OS_X_VERSION_ID(V) 10##V##00
|
||||
#define DEFINE_IS_OS_FUNCS(V) _DEFINE_IS_OS_FUNCS(V, OS_X_VERSION_ID(V))
|
||||
|
||||
// El Capitan is OS X 10.11, Darwin 15.
|
||||
BASE_EXPORT bool IsOSElCapitan();
|
||||
BASE_EXPORT bool IsOSElCapitanOrEarlier();
|
||||
BASE_EXPORT bool IsOSElCapitanOrLater();
|
||||
// Sanity check that our computed IDs match the SDK
|
||||
#define STR(S) _STR(S)
|
||||
#define _STR(S) #S
|
||||
#define ASSERT_OS_ID_CONSTANT(V) \
|
||||
static_assert(OS_X_VERSION_ID(V) == MAC_OS_X_VERSION_10_##V, \
|
||||
"ID for macOS 10." #V \
|
||||
" (" STR(OS_X_VERSION_ID(V)) ") doesn't match the SDK (" STR( \
|
||||
MAC_OS_X_VERSION_10_##V) ").");
|
||||
|
||||
// Sierra is macOS 10.12, Darwin 16.
|
||||
BASE_EXPORT bool IsOSSierra();
|
||||
BASE_EXPORT bool IsOSSierraOrLater();
|
||||
// 10.9 uses an old format.
|
||||
// TODO(sdy): Ditch, most callers are better served by !IsAtLeastOS10_10().
|
||||
_DEFINE_IS_OS_FUNCS(9, MAC_OS_X_VERSION_10_9)
|
||||
|
||||
DEFINE_IS_OS_FUNCS(10)
|
||||
ASSERT_OS_ID_CONSTANT(10)
|
||||
|
||||
DEFINE_IS_OS_FUNCS(11)
|
||||
#ifdef MAC_OS_X_VERSION_10_11
|
||||
ASSERT_OS_ID_CONSTANT(11)
|
||||
#endif
|
||||
|
||||
DEFINE_IS_OS_FUNCS(12)
|
||||
#ifdef MAC_OS_X_VERSION_10_12
|
||||
ASSERT_OS_ID_CONSTANT(12)
|
||||
#endif
|
||||
|
||||
#undef ASSERT_OS_ID_CONSTANT
|
||||
#undef _STR
|
||||
#undef STR
|
||||
|
||||
#undef DEFINE_IS_OS_FUNCS
|
||||
#undef MAC_OS_X_VERISON_ID
|
||||
#undef _DEFINE_IS_OS_FUNCS
|
||||
|
||||
// This should be infrequently used. It only makes sense to use this to avoid
|
||||
// codepaths that are very likely to break on future (unreleased, untested,
|
||||
// unborn) OS releases, or to log when the OS is newer than any known version.
|
||||
BASE_EXPORT bool IsOSLaterThanSierra_DontCallThis();
|
||||
|
||||
// Inline functions that are redundant due to version ranges being mutually-
|
||||
// exclusive.
|
||||
inline bool IsOSYosemiteOrEarlier() { return !IsOSElCapitanOrLater(); }
|
||||
inline bool IsOSElCapitanOrEarlier() { return !IsOSSierraOrLater(); }
|
||||
|
||||
// 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_9) && \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9
|
||||
#define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_9
|
||||
inline bool IsOSMavericks() { return false; }
|
||||
#endif
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_10) && \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_10
|
||||
#define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_10
|
||||
inline bool IsOSYosemiteOrLater() { return true; }
|
||||
#endif
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_10) && \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_10
|
||||
#define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_10
|
||||
inline bool IsOSYosemite() { return false; }
|
||||
#endif
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_11) && \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_11
|
||||
#define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_11
|
||||
inline bool IsOSElCapitanOrLater() { return true; }
|
||||
#endif
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_11) && \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_11
|
||||
#define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_11
|
||||
inline bool IsOSElCapitan() { return false; }
|
||||
#endif
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_12) && \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
|
||||
#define BASE_MAC_MAC_UTIL_H_INLINED_GE_10_12
|
||||
inline bool IsOSSierraOrLater() { return true; }
|
||||
#endif
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_12) && \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_12
|
||||
#define BASE_MAC_MAC_UTIL_H_INLINED_GT_10_12
|
||||
inline bool IsOSSierra() { return false; }
|
||||
inline bool IsOSLaterThanSierra_DontCallThis() { return true; }
|
||||
#endif
|
||||
inline bool IsOSLaterThan10_12_DontCallThis() {
|
||||
return !IsAtMostOS10_12();
|
||||
}
|
||||
|
||||
// Retrieve the system's model identifier string from the IOKit registry:
|
||||
// for example, "MacPro4,1", "MacBookPro6,1". Returns empty string upon
|
||||
|
@ -448,69 +448,14 @@ int MacOSXMinorVersionInternal() {
|
||||
return mac_os_x_minor_version;
|
||||
}
|
||||
|
||||
// Returns the running system's Mac OS X minor version. This is the |y| value
|
||||
// in 10.y or 10.y.z.
|
||||
} // namespace
|
||||
|
||||
namespace internal {
|
||||
int MacOSXMinorVersion() {
|
||||
static int mac_os_x_minor_version = MacOSXMinorVersionInternal();
|
||||
return mac_os_x_minor_version;
|
||||
}
|
||||
|
||||
enum {
|
||||
MAVERICKS_MINOR_VERSION = 9,
|
||||
YOSEMITE_MINOR_VERSION = 10,
|
||||
EL_CAPITAN_MINOR_VERSION = 11,
|
||||
SIERRA_MINOR_VERSION = 12,
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_9)
|
||||
bool IsOSMavericks() {
|
||||
return MacOSXMinorVersion() == MAVERICKS_MINOR_VERSION;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_10)
|
||||
bool IsOSYosemite() {
|
||||
return MacOSXMinorVersion() == YOSEMITE_MINOR_VERSION;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_10)
|
||||
bool IsOSYosemiteOrLater() {
|
||||
return MacOSXMinorVersion() >= YOSEMITE_MINOR_VERSION;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_11)
|
||||
bool IsOSElCapitan() {
|
||||
return MacOSXMinorVersion() == EL_CAPITAN_MINOR_VERSION;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_11)
|
||||
bool IsOSElCapitanOrLater() {
|
||||
return MacOSXMinorVersion() >= EL_CAPITAN_MINOR_VERSION;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_12)
|
||||
bool IsOSSierra() {
|
||||
return MacOSXMinorVersion() == SIERRA_MINOR_VERSION;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GE_10_12)
|
||||
bool IsOSSierraOrLater() {
|
||||
return MacOSXMinorVersion() >= SIERRA_MINOR_VERSION;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_12)
|
||||
bool IsOSLaterThanSierra_DontCallThis() {
|
||||
return MacOSXMinorVersion() > SIERRA_MINOR_VERSION;
|
||||
}
|
||||
#endif
|
||||
} // namespace internal
|
||||
|
||||
std::string GetModelIdentifier() {
|
||||
std::string return_string;
|
||||
|
@ -146,49 +146,61 @@ TEST_F(MacUtilTest, IsOSEllipsis) {
|
||||
|
||||
if (major == 10) {
|
||||
if (minor == 9) {
|
||||
EXPECT_TRUE(IsOSMavericks());
|
||||
EXPECT_FALSE(IsOSYosemite());
|
||||
EXPECT_TRUE(IsOSYosemiteOrEarlier());
|
||||
EXPECT_FALSE(IsOSYosemiteOrLater());
|
||||
EXPECT_FALSE(IsOSElCapitan());
|
||||
EXPECT_TRUE(IsOSElCapitanOrEarlier());
|
||||
EXPECT_FALSE(IsOSElCapitanOrLater());
|
||||
EXPECT_FALSE(IsOSSierra());
|
||||
EXPECT_FALSE(IsOSSierraOrLater());
|
||||
EXPECT_FALSE(IsOSLaterThanSierra_DontCallThis());
|
||||
EXPECT_TRUE(IsOS10_9());
|
||||
EXPECT_TRUE(IsAtMostOS10_9());
|
||||
EXPECT_TRUE(IsAtLeastOS10_9());
|
||||
EXPECT_FALSE(IsOS10_10());
|
||||
EXPECT_TRUE(IsAtMostOS10_10());
|
||||
EXPECT_FALSE(IsAtLeastOS10_10());
|
||||
EXPECT_FALSE(IsOS10_11());
|
||||
EXPECT_TRUE(IsAtMostOS10_11());
|
||||
EXPECT_FALSE(IsAtLeastOS10_11());
|
||||
EXPECT_FALSE(IsOS10_12());
|
||||
EXPECT_FALSE(IsAtLeastOS10_12());
|
||||
EXPECT_TRUE(IsAtMostOS10_12());
|
||||
EXPECT_FALSE(IsOSLaterThan10_12_DontCallThis());
|
||||
} else if (minor == 10) {
|
||||
EXPECT_FALSE(IsOSMavericks());
|
||||
EXPECT_TRUE(IsOSYosemite());
|
||||
EXPECT_TRUE(IsOSYosemiteOrEarlier());
|
||||
EXPECT_TRUE(IsOSYosemiteOrLater());
|
||||
EXPECT_FALSE(IsOSElCapitan());
|
||||
EXPECT_TRUE(IsOSElCapitanOrEarlier());
|
||||
EXPECT_FALSE(IsOSElCapitanOrLater());
|
||||
EXPECT_FALSE(IsOSSierra());
|
||||
EXPECT_FALSE(IsOSSierraOrLater());
|
||||
EXPECT_FALSE(IsOSLaterThanSierra_DontCallThis());
|
||||
EXPECT_FALSE(IsOS10_9());
|
||||
EXPECT_FALSE(IsAtMostOS10_9());
|
||||
EXPECT_TRUE(IsAtLeastOS10_9());
|
||||
EXPECT_TRUE(IsOS10_10());
|
||||
EXPECT_TRUE(IsAtMostOS10_10());
|
||||
EXPECT_TRUE(IsAtLeastOS10_10());
|
||||
EXPECT_FALSE(IsOS10_11());
|
||||
EXPECT_TRUE(IsAtMostOS10_11());
|
||||
EXPECT_FALSE(IsAtLeastOS10_11());
|
||||
EXPECT_FALSE(IsOS10_12());
|
||||
EXPECT_FALSE(IsAtLeastOS10_12());
|
||||
EXPECT_TRUE(IsAtMostOS10_12());
|
||||
EXPECT_FALSE(IsOSLaterThan10_12_DontCallThis());
|
||||
} else if (minor == 11) {
|
||||
EXPECT_FALSE(IsOSMavericks());
|
||||
EXPECT_FALSE(IsOSYosemite());
|
||||
EXPECT_FALSE(IsOSYosemiteOrEarlier());
|
||||
EXPECT_TRUE(IsOSYosemiteOrLater());
|
||||
EXPECT_TRUE(IsOSElCapitan());
|
||||
EXPECT_TRUE(IsOSElCapitanOrEarlier());
|
||||
EXPECT_TRUE(IsOSElCapitanOrLater());
|
||||
EXPECT_FALSE(IsOSSierra());
|
||||
EXPECT_FALSE(IsOSSierraOrLater());
|
||||
EXPECT_FALSE(IsOSLaterThanSierra_DontCallThis());
|
||||
EXPECT_FALSE(IsOS10_9());
|
||||
EXPECT_FALSE(IsAtMostOS10_9());
|
||||
EXPECT_TRUE(IsAtLeastOS10_9());
|
||||
EXPECT_FALSE(IsOS10_10());
|
||||
EXPECT_FALSE(IsAtMostOS10_10());
|
||||
EXPECT_TRUE(IsAtLeastOS10_10());
|
||||
EXPECT_TRUE(IsOS10_11());
|
||||
EXPECT_TRUE(IsAtMostOS10_11());
|
||||
EXPECT_TRUE(IsAtLeastOS10_11());
|
||||
EXPECT_FALSE(IsOS10_12());
|
||||
EXPECT_FALSE(IsAtLeastOS10_12());
|
||||
EXPECT_TRUE(IsAtMostOS10_12());
|
||||
EXPECT_FALSE(IsOSLaterThan10_12_DontCallThis());
|
||||
} else if (minor == 12) {
|
||||
EXPECT_FALSE(IsOSMavericks());
|
||||
EXPECT_FALSE(IsOSYosemite());
|
||||
EXPECT_FALSE(IsOSYosemiteOrEarlier());
|
||||
EXPECT_TRUE(IsOSYosemiteOrLater());
|
||||
EXPECT_FALSE(IsOSElCapitan());
|
||||
EXPECT_FALSE(IsOSElCapitanOrEarlier());
|
||||
EXPECT_TRUE(IsOSElCapitanOrLater());
|
||||
EXPECT_TRUE(IsOSSierra());
|
||||
EXPECT_TRUE(IsOSSierraOrLater());
|
||||
EXPECT_FALSE(IsOSLaterThanSierra_DontCallThis());
|
||||
EXPECT_FALSE(IsOS10_9());
|
||||
EXPECT_FALSE(IsAtMostOS10_9());
|
||||
EXPECT_TRUE(IsAtLeastOS10_9());
|
||||
EXPECT_FALSE(IsOS10_10());
|
||||
EXPECT_FALSE(IsAtMostOS10_10());
|
||||
EXPECT_TRUE(IsAtLeastOS10_10());
|
||||
EXPECT_FALSE(IsOS10_11());
|
||||
EXPECT_FALSE(IsAtMostOS10_11());
|
||||
EXPECT_TRUE(IsAtLeastOS10_11());
|
||||
EXPECT_TRUE(IsOS10_12());
|
||||
EXPECT_TRUE(IsAtMostOS10_12());
|
||||
EXPECT_TRUE(IsAtLeastOS10_12());
|
||||
EXPECT_FALSE(IsOSLaterThan10_12_DontCallThis());
|
||||
} else {
|
||||
// Not nine, ten, eleven, or twelve. Ah, ah, ah.
|
||||
EXPECT_TRUE(false);
|
||||
|
@ -248,7 +248,7 @@ void oom_killer_new() {
|
||||
// === Core Foundation CFAllocators ===
|
||||
|
||||
bool CanGetContextForCFAllocator() {
|
||||
return !base::mac::IsOSLaterThanSierra_DontCallThis();
|
||||
return !base::mac::IsOSLaterThan10_12_DontCallThis();
|
||||
}
|
||||
|
||||
CFAllocatorContext* ContextForCFAllocator(CFAllocatorRef allocator) {
|
||||
|
@ -51,7 +51,7 @@ void SysInfo::OperatingSystemVersionNumbers(int32_t* major_version,
|
||||
// cases in 10.9, rely on ::Gestalt(..). Since this code is only needed for
|
||||
// 10.9.0 and 10.9.1 and uses the recommended replacement thereafter,
|
||||
// suppress the warning for this fallback case.
|
||||
DCHECK(base::mac::IsOSMavericks());
|
||||
DCHECK(base::mac::IsOS10_9());
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
Gestalt(gestaltSystemVersionMajor,
|
||||
|
@ -1642,7 +1642,7 @@ class AppControllerProfileObserver : public ProfileAttributesStorage::Observer {
|
||||
#pragma mark - Handoff Manager
|
||||
|
||||
- (BOOL)shouldUseHandoff {
|
||||
return base::mac::IsOSYosemiteOrLater();
|
||||
return base::mac::IsAtLeastOS10_10();
|
||||
}
|
||||
|
||||
- (void)passURLToHandoffManager:(const GURL&)handoffURL {
|
||||
|
@ -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::IsOSMavericks()) {
|
||||
if (base::mac::IsOS10_9()) {
|
||||
EXPECT_EQ(can_fullscreen,
|
||||
[[ns_window standardWindowButton:NSWindowZoomButton] isEnabled]);
|
||||
}
|
||||
@ -636,7 +636,7 @@ NSBitmapImageRep* ScreenshotNSWindow(NSWindow* window) {
|
||||
// NOTE: This doesn't work with Views, but the regular test does, so use that.
|
||||
bool mac_views = base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kEnableMacViewsNativeAppWindows);
|
||||
if (base::mac::IsOSMavericks() && !mac_views) {
|
||||
if (base::mac::IsOS10_9() && !mac_views) {
|
||||
// -[NSView setNeedsDisplay:YES] doesn't synchronously display the view, it
|
||||
// gets drawn by another event in the queue, so let that run first.
|
||||
content::RunAllPendingInMessageLoop();
|
||||
|
@ -468,7 +468,7 @@ CGFloat BookmarkRightMargin() {
|
||||
if (bridge_) {
|
||||
// When running on 10.10, expect both -awakeFromNib and -viewDidLoad to be
|
||||
// called, but only initialize once.
|
||||
DCHECK(base::mac::IsOSYosemiteOrLater());
|
||||
DCHECK(base::mac::IsAtLeastOS10_10());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1640,10 +1640,10 @@ TEST_F(BookmarkBarControllerTest, DISABLED_LastBookmarkResizeBehavior) {
|
||||
153.0, 143.0, 142.0 };
|
||||
CGFloat* view_widths = NULL;
|
||||
bool is_mode_material = ui::MaterialDesignController::IsModeMaterial();
|
||||
if (base::mac::IsOSElCapitan()) {
|
||||
if (base::mac::IsOS10_11()) {
|
||||
view_widths = is_mode_material ? material_view_widths_el_capitan
|
||||
: view_widths_el_capitan;
|
||||
} else if (base::mac::IsOSYosemite()) {
|
||||
} else if (base::mac::IsOS10_10()) {
|
||||
view_widths = is_mode_material ? material_view_widths_yosemite
|
||||
: view_widths_yosemite;
|
||||
} else {
|
||||
|
@ -1934,7 +1934,7 @@ willAnimateFromState:(BookmarkBar::State)oldState
|
||||
// that the other monitors won't blank out.
|
||||
display::Screen* screen = display::Screen::GetScreen();
|
||||
BOOL hasMultipleMonitors = screen && screen->GetNumDisplays() > 1;
|
||||
if (base::mac::IsOSYosemiteOrLater() &&
|
||||
if (base::mac::IsAtLeastOS10_10() &&
|
||||
!(hasMultipleMonitors && ![NSScreen screensHaveSeparateSpaces])) {
|
||||
[self enterAppKitFullscreen];
|
||||
} else {
|
||||
|
@ -680,7 +680,7 @@ willPositionSheet:(NSWindow*)sheet
|
||||
// full-screen mode. We do not want either to show. Search for the window that
|
||||
// contains the views, and hide it. There is no need to ever unhide the view.
|
||||
// http://crbug.com/380235
|
||||
if (base::mac::IsOSYosemiteOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_10()) {
|
||||
for (NSWindow* window in [[NSApplication sharedApplication] windows]) {
|
||||
if ([window
|
||||
isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) {
|
||||
@ -1116,7 +1116,7 @@ willPositionSheet:(NSWindow*)sheet
|
||||
}
|
||||
|
||||
+ (BOOL)systemSettingsRequireMavericksAppKitFullscreenHack {
|
||||
if (!base::mac::IsOSMavericks())
|
||||
if (!base::mac::IsOS10_9())
|
||||
return NO;
|
||||
return [NSScreen respondsToSelector:@selector(screensHaveSeparateSpaces)] &&
|
||||
[NSScreen screensHaveSeparateSpaces];
|
||||
@ -1135,7 +1135,7 @@ willPositionSheet:(NSWindow*)sheet
|
||||
|
||||
- (BOOL)shouldUseCustomAppKitFullscreenTransition:(BOOL)enterFullScreen {
|
||||
// Disable the custom exit animation in OSX 10.9: http://crbug.com/526327#c3.
|
||||
if (base::mac::IsOSMavericks() && !enterFullScreen)
|
||||
if (base::mac::IsOS10_9() && !enterFullScreen)
|
||||
return NO;
|
||||
|
||||
NSView* root = [[self.window contentView] superview];
|
||||
|
@ -239,7 +239,7 @@ class FrameAndStyleLock {
|
||||
}
|
||||
|
||||
- (void)startCustomFullScreenAnimationWithDuration:(NSTimeInterval)duration {
|
||||
CGFloat durationFraction = base::mac::IsOSYosemite()
|
||||
CGFloat durationFraction = base::mac::IsOS10_10()
|
||||
? kAnimationDurationFractionYosemite
|
||||
: kAnimationDurationFraction;
|
||||
CGFloat animationDuration = duration * durationFraction;
|
||||
|
@ -61,7 +61,7 @@ const CGFloat kLocationBarRightOffset = 35;
|
||||
|
||||
- (instancetype)init {
|
||||
if ((self = [super init])) {
|
||||
parameters_.isOSYosemiteOrLater = base::mac::IsOSYosemiteOrLater();
|
||||
parameters_.isOSYosemiteOrLater = base::mac::IsAtLeastOS10_10();
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
// In Yosemite, the fullscreen button replaces the zoom button. We no longer
|
||||
// need to swizzle out this AppKit private method.
|
||||
if (!base::mac::IsOSMavericks())
|
||||
if (!base::mac::IsOS10_9())
|
||||
return;
|
||||
|
||||
base::mac::ScopedNSAutoreleasePool pool;
|
||||
|
@ -28,7 +28,7 @@ class CustomFrameViewTest : public PlatformTest {
|
||||
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::IsOSMavericks())
|
||||
if (!base::mac::IsOS10_9())
|
||||
return;
|
||||
|
||||
unsigned int count;
|
||||
|
@ -52,7 +52,7 @@ const CGFloat kAnimationDuration = 0.2;
|
||||
// Also, because NSPressureConfiguration is not in the original 10.10 SDK,
|
||||
// use NSClassFromString() to instantiate it (otherwise there's a
|
||||
// linker error).
|
||||
if (base::mac::IsOSYosemiteOrLater() &&
|
||||
if (base::mac::IsAtLeastOS10_10() &&
|
||||
[self respondsToSelector:@selector(setPressureConfiguration:)]) {
|
||||
NSPressureConfiguration* pressureConfiguration =
|
||||
[[[NSClassFromString(@"NSPressureConfiguration") alloc]
|
||||
|
@ -320,7 +320,7 @@ void OmniboxPopupViewMac::PositionPopup(const CGFloat matrixHeight) {
|
||||
// the window does not get redrawn. Use a completion handler to make sure
|
||||
// |popup_| gets redrawn once the animation completes. See
|
||||
// http://crbug.com/538590 and http://crbug.com/551007 .
|
||||
if (base::mac::IsOSElCapitanOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_11()) {
|
||||
NSWindow* popup = popup_.get();
|
||||
[[NSAnimationContext currentContext] setCompletionHandler:^{
|
||||
[popup display];
|
||||
|
@ -98,6 +98,6 @@ IN_PROC_BROWSER_TEST_F(RenderViewContextMenuMacBrowserTest, ServicesFiltering) {
|
||||
// Confirm that Services items were removed from the contextual menu. This
|
||||
// check was failing on the 10.10 bot, for some reason. Most-important is
|
||||
// making sure it continues to work as OS X evolves.
|
||||
if (base::mac::IsOSElCapitanOrLater())
|
||||
if (base::mac::IsAtLeastOS10_11())
|
||||
EXPECT_LT(0LU, [filteredItems_ count]);
|
||||
}
|
||||
|
@ -374,7 +374,7 @@
|
||||
// NSVisualEffectView is only used in Material Design, and only available on
|
||||
// OS X 10.10 and higher.
|
||||
if (!ui::MaterialDesignController::IsModeMaterial() ||
|
||||
!base::mac::IsOSYosemiteOrLater()) {
|
||||
!base::mac::IsAtLeastOS10_10()) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ class NotificationBridge : public AppMenuIconController::Delegate {
|
||||
// When linking and running on 10.10+, both -awakeFromNib and -viewDidLoad may
|
||||
// be called, don't initialize twice.
|
||||
if (locationBarView_) {
|
||||
DCHECK(base::mac::IsOSYosemiteOrLater());
|
||||
DCHECK(base::mac::IsAtLeastOS10_10());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ void InitCrashReporter(const std::string& process_type) {
|
||||
// Temporarily run Breakpad in-process on 10.10 and later because APIs that
|
||||
// it depends on got broken (http://crbug.com/386208).
|
||||
// This can catch crashes in the browser process only.
|
||||
if (is_browser && base::mac::IsOSYosemiteOrLater()) {
|
||||
if (is_browser && base::mac::IsAtLeastOS10_10()) {
|
||||
[breakpad_config setObject:[NSNumber numberWithBool:YES]
|
||||
forKey:@BREAKPAD_IN_PROCESS];
|
||||
}
|
||||
|
@ -58,7 +58,7 @@
|
||||
|
||||
#if defined(OS_MACOSX) && !defined(OS_IOS)
|
||||
// Handoff is only available on OSX 10.10+.
|
||||
DCHECK(base::mac::IsOSYosemiteOrLater());
|
||||
DCHECK(base::mac::IsAtLeastOS10_10());
|
||||
#endif
|
||||
|
||||
_activeURL = url;
|
||||
|
@ -213,7 +213,7 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent(
|
||||
NSAccessibilityPostNotification(ToBrowserAccessibilityCocoa(focus),
|
||||
mac_notification);
|
||||
|
||||
if (base::mac::IsOSElCapitanOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_11()) {
|
||||
// |NSAccessibilityPostNotificationWithUserInfo| should be used on OS X
|
||||
// 10.11 or later to notify Voiceover about text selection changes. This
|
||||
// API has been present on versions of OS X since 10.7 but doesn't
|
||||
@ -238,7 +238,7 @@ void BrowserAccessibilityManagerMac::NotifyAccessibilityEvent(
|
||||
break;
|
||||
case ui::AX_EVENT_VALUE_CHANGED:
|
||||
mac_notification = NSAccessibilityValueChangedNotification;
|
||||
if (base::mac::IsOSElCapitanOrLater() && text_edits_.size()) {
|
||||
if (base::mac::IsAtLeastOS10_11() && text_edits_.size()) {
|
||||
// It seems that we don't need to distinguish between deleted and
|
||||
// inserted text for now.
|
||||
base::string16 deleted_text;
|
||||
|
@ -80,7 +80,7 @@ void BootstrapSandboxManager::RegisterRendererPolicy() {
|
||||
|
||||
// Allow access to launchservicesd on 10.10+ otherwise the renderer will crash
|
||||
// attempting to get its ASN. http://crbug.com/533537
|
||||
if (base::mac::IsOSYosemiteOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_10()) {
|
||||
policy.rules["com.apple.coreservices.launchservicesd"] =
|
||||
sandbox::Rule(sandbox::POLICY_ALLOW);
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ bool Sandbox::EnableSandbox(int sandbox_type,
|
||||
if (!compiler.InsertStringParam("USER_HOMEDIR_AS_LITERAL", quoted_home_dir))
|
||||
return false;
|
||||
|
||||
bool elcap_or_later = base::mac::IsOSElCapitanOrLater();
|
||||
bool elcap_or_later = base::mac::IsAtLeastOS10_11();
|
||||
if (!compiler.InsertBooleanParam("ELCAP_OR_LATER", elcap_or_later))
|
||||
return false;
|
||||
|
||||
|
@ -116,7 +116,7 @@ RendererMainPlatformDelegate::~RendererMainPlatformDelegate() {
|
||||
// running a renderer needs to also be reflected in chrome_main.cc for
|
||||
// --single-process support.
|
||||
void RendererMainPlatformDelegate::PlatformInitialize() {
|
||||
if (base::mac::IsOSYosemiteOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_10()) {
|
||||
// This is needed by the NSAnimations run for the scrollbars. If we switch
|
||||
// from native scrollers to drawing them in some other way, this warmup can
|
||||
// be removed <http://crbug.com/306348>.
|
||||
|
@ -68,7 +68,7 @@ base::WeakPtr<BluetoothAdapterMac> BluetoothAdapterMac::CreateAdapterForTest(
|
||||
// static
|
||||
BluetoothUUID BluetoothAdapterMac::BluetoothUUIDWithCBUUID(CBUUID* uuid) {
|
||||
// UUIDString only available OS X >= 10.10.
|
||||
DCHECK(base::mac::IsOSYosemiteOrLater());
|
||||
DCHECK(base::mac::IsAtLeastOS10_10());
|
||||
std::string uuid_c_string = base::SysNSStringToUTF8([uuid UUIDString]);
|
||||
return device::BluetoothUUID(uuid_c_string);
|
||||
}
|
||||
@ -241,7 +241,7 @@ void BluetoothAdapterMac::DeviceConnected(IOBluetoothDevice* device) {
|
||||
|
||||
// static
|
||||
bool BluetoothAdapterMac::IsLowEnergyAvailable() {
|
||||
return base::mac::IsOSYosemiteOrLater();
|
||||
return base::mac::IsAtLeastOS10_10();
|
||||
}
|
||||
|
||||
void BluetoothAdapterMac::RemovePairingDelegateInternal(
|
||||
|
@ -138,7 +138,7 @@ TEST_F(BootstrapSandboxTest, DistributedNotifications_Unsandboxed) {
|
||||
// Run the test with the sandbox enabled without notifications on the policy
|
||||
// whitelist.
|
||||
TEST_F(BootstrapSandboxTest, DistributedNotifications_SandboxDeny) {
|
||||
if (base::mac::IsOSSierraOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_12()) {
|
||||
LOG(ERROR) << "BootstrapSandbox does not work on macOS Sierra or later.";
|
||||
return;
|
||||
}
|
||||
@ -156,7 +156,7 @@ TEST_F(BootstrapSandboxTest, DistributedNotifications_SandboxDeny) {
|
||||
|
||||
// Run the test with notifications permitted.
|
||||
TEST_F(BootstrapSandboxTest, DistributedNotifications_SandboxAllow) {
|
||||
if (base::mac::IsOSSierraOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_12()) {
|
||||
LOG(ERROR) << "BootstrapSandbox does not work on macOS Sierra or later.";
|
||||
return;
|
||||
}
|
||||
@ -191,7 +191,7 @@ MULTIPROCESS_TEST_MAIN(PostNotification) {
|
||||
const char kTestServer[] = "org.chromium.test_bootstrap_server";
|
||||
|
||||
TEST_F(BootstrapSandboxTest, PolicyDenyError) {
|
||||
if (base::mac::IsOSSierraOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_12()) {
|
||||
LOG(ERROR) << "BootstrapSandbox does not work on macOS Sierra or later.";
|
||||
return;
|
||||
}
|
||||
@ -218,7 +218,7 @@ MULTIPROCESS_TEST_MAIN(PolicyDenyError) {
|
||||
}
|
||||
|
||||
TEST_F(BootstrapSandboxTest, PolicyDenyDummyPort) {
|
||||
if (base::mac::IsOSSierraOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_12()) {
|
||||
LOG(ERROR) << "BootstrapSandbox does not work on macOS Sierra or later.";
|
||||
return;
|
||||
}
|
||||
@ -250,7 +250,7 @@ struct SubstitutePortAckRecv : public SubstitutePortAckSend {
|
||||
const char kSubstituteAck[] = "Hello, this is doge!";
|
||||
|
||||
TEST_F(BootstrapSandboxTest, PolicySubstitutePort) {
|
||||
if (base::mac::IsOSSierraOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_12()) {
|
||||
LOG(ERROR) << "BootstrapSandbox does not work on macOS Sierra or later.";
|
||||
return;
|
||||
}
|
||||
@ -371,7 +371,7 @@ const char kDefaultRuleTestDeny[] =
|
||||
"org.chromium.sandbox.test.DefaultRuleAllow.Deny";
|
||||
|
||||
TEST_F(BootstrapSandboxTest, DefaultRuleAllow) {
|
||||
if (base::mac::IsOSSierraOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_12()) {
|
||||
LOG(ERROR) << "BootstrapSandbox does not work on macOS Sierra or later.";
|
||||
return;
|
||||
}
|
||||
@ -443,7 +443,7 @@ MULTIPROCESS_TEST_MAIN(DefaultRuleAllow) {
|
||||
}
|
||||
|
||||
TEST_F(BootstrapSandboxTest, ChildOutliveSandbox) {
|
||||
if (base::mac::IsOSSierraOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_12()) {
|
||||
LOG(ERROR) << "BootstrapSandbox does not work on macOS Sierra or later.";
|
||||
return;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ bool LaunchdInterceptionServer::Initialize(mach_port_t server_receive_right) {
|
||||
}
|
||||
sandbox_send_port_.reset(sandbox_port_.get());
|
||||
|
||||
if (base::mac::IsOSYosemiteOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_10()) {
|
||||
message_server_.reset(new XPCMessageServer(this, server_receive_right));
|
||||
xpc_launchd_ = true;
|
||||
} else {
|
||||
|
@ -181,7 +181,7 @@ class OSCompatibility_10_10 : public OSCompatibility {
|
||||
|
||||
// static
|
||||
std::unique_ptr<OSCompatibility> OSCompatibility::CreateForPlatform() {
|
||||
if (base::mac::IsOSMavericks())
|
||||
if (base::mac::IsOS10_9())
|
||||
return base::WrapUnique(new OSCompatibility_10_7());
|
||||
else
|
||||
return base::WrapUnique(new OSCompatibility_10_10());
|
||||
|
@ -22,9 +22,8 @@ PreExecDelegate::PreExecDelegate(
|
||||
sandbox_server_bootstrap_name_ptr_(
|
||||
sandbox_server_bootstrap_name_.c_str()),
|
||||
sandbox_token_(sandbox_token),
|
||||
is_yosemite_or_later_(base::mac::IsOSYosemiteOrLater()),
|
||||
look_up_message_(CreateBootstrapLookUpMessage()) {
|
||||
}
|
||||
is_yosemite_or_later_(base::mac::IsAtLeastOS10_10()),
|
||||
look_up_message_(CreateBootstrapLookUpMessage()) {}
|
||||
|
||||
PreExecDelegate::~PreExecDelegate() {}
|
||||
|
||||
|
@ -256,7 +256,7 @@ bool LayoutThemeMac::needsHackForTextControlWithFontFamily(const AtomicString& f
|
||||
{
|
||||
// This hack is only applied on OSX 10.9.
|
||||
// https://code.google.com/p/chromium/issues/detail?id=515989#c8
|
||||
return IsOSMavericks() && family == "BlinkMacSystemFont";
|
||||
return IsOS10_9() && family == "BlinkMacSystemFont";
|
||||
}
|
||||
|
||||
static RGBA32 convertNSColorToColor(NSColor *color)
|
||||
@ -478,7 +478,7 @@ bool LayoutThemeMac::isControlStyled(const ComputedStyle& style) const
|
||||
return true;
|
||||
// NSPopUpButtonCell on macOS 10.9 doesn't support
|
||||
// NSUserInterfaceLayoutDirectionRightToLeft.
|
||||
if (IsOSMavericks() && style.direction() == RTL)
|
||||
if (IsOS10_9() && style.direction() == RTL)
|
||||
return true;
|
||||
}
|
||||
// Some other cells don't work well when scaled.
|
||||
|
@ -138,7 +138,7 @@ NSFont* MatchNSFontFamily(NSString* desiredFamily, NSFontTraitMask desiredTraits
|
||||
// so force layout tests to use "Lucida Grande". Once the 10.10 SDK
|
||||
// switch is made, this should be changed to return .LucidaGrandeUI and
|
||||
// the Layout Expectations should be updated. http://crbug.com/515836.
|
||||
if (LayoutTestSupport::isRunningLayoutTest() && IsOSMavericks()) {
|
||||
if (LayoutTestSupport::isRunningLayoutTest() && IsOS10_9()) {
|
||||
if (desiredWeight >= blink::FontWeightBold)
|
||||
return [NSFont fontWithName:@"Lucida Grande Bold" size:size];
|
||||
else
|
||||
@ -146,7 +146,7 @@ NSFont* MatchNSFontFamily(NSString* desiredFamily, NSFontTraitMask desiredTraits
|
||||
}
|
||||
|
||||
NSFont* font = nil;
|
||||
if (IsOSMavericks()) {
|
||||
if (IsOS10_9()) {
|
||||
// On older OSX versions, only bold and regular are available.
|
||||
if (desiredWeight >= blink::FontWeightBold)
|
||||
font = [NSFont boldSystemFontOfSize:size];
|
||||
|
@ -23,7 +23,7 @@ void TestSystemFontContainsString(FontWeight desiredWeight, NSString* substring)
|
||||
|
||||
TEST(FontFamilyMatcherMacTest, YosemiteFontWeights)
|
||||
{
|
||||
if (!IsOSYosemite())
|
||||
if (!IsOS10_10())
|
||||
return;
|
||||
|
||||
TestSystemFontContainsString(FontWeight100, @"-UltraLight");
|
||||
|
@ -7,16 +7,26 @@
|
||||
|
||||
#include "platform/PlatformExport.h"
|
||||
|
||||
#include <AvailabilityMacros.h>
|
||||
|
||||
namespace blink {
|
||||
|
||||
// Mavericks is Mac OS X 10.9, Darwin 13.
|
||||
PLATFORM_EXPORT bool IsOSMavericks();
|
||||
namespace internal {
|
||||
|
||||
// Yosemite is Mac OS X 10.10, Darwin 14.
|
||||
PLATFORM_EXPORT bool IsOSYosemite();
|
||||
PLATFORM_EXPORT int MacOSXMinorVersion();
|
||||
|
||||
// El Capitan is Mac OS X 10.11, Darwin 15.
|
||||
PLATFORM_EXPORT bool IsOSElCapitan();
|
||||
template <int V, int ID>
|
||||
constexpr bool IsOS()
|
||||
{
|
||||
return MAC_OS_X_VERSION_MIN_REQUIRED <= ID && MacOSXMinorVersion() == V;
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
const auto IsOS10_9 = internal::IsOS<9, 1090>;
|
||||
const auto IsOS10_10 = internal::IsOS<10, 101000>;
|
||||
const auto IsOS10_11 = internal::IsOS<11, 101100>;
|
||||
const auto IsOS10_12 = internal::IsOS<12, 101200>;
|
||||
|
||||
} // namespace blink
|
||||
|
||||
|
@ -48,37 +48,12 @@ int MacOSXMinorVersionInternal()
|
||||
return darwinMajorVersion - 4;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// Returns the running system's Mac OS X minor version. This is the |y| value
|
||||
// in 10.y or 10.y.z.
|
||||
int MacOSXMinorVersion()
|
||||
int blink::internal::MacOSXMinorVersion()
|
||||
{
|
||||
static int minorVersion = MacOSXMinorVersionInternal();
|
||||
return minorVersion;
|
||||
}
|
||||
|
||||
enum {
|
||||
MAVERICKS_MINOR_VERSION = 9,
|
||||
YOSEMITE_MINOR_VERSION = 10,
|
||||
EL_CAPITAN_MINOR_VERSION = 11,
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace blink {
|
||||
|
||||
bool IsOSMavericks()
|
||||
{
|
||||
return MacOSXMinorVersion() == MAVERICKS_MINOR_VERSION;
|
||||
}
|
||||
|
||||
bool IsOSYosemite()
|
||||
{
|
||||
return MacOSXMinorVersion() == YOSEMITE_MINOR_VERSION;
|
||||
}
|
||||
|
||||
bool IsOSElCapitan()
|
||||
{
|
||||
return MacOSXMinorVersion() == EL_CAPITAN_MINOR_VERSION;
|
||||
}
|
||||
|
||||
} // namespace blink
|
||||
|
@ -29,24 +29,24 @@
|
||||
TEST(VersionUtilMac, AppKitVersions)
|
||||
{
|
||||
if (floor(NSAppKitVersionNumber) == NSAppKitVersionNumber10_9) {
|
||||
EXPECT_TRUE(blink::IsOSMavericks());
|
||||
EXPECT_FALSE(blink::IsOSYosemite());
|
||||
EXPECT_FALSE(blink::IsOSElCapitan());
|
||||
EXPECT_TRUE(blink::IsOS10_9());
|
||||
EXPECT_FALSE(blink::IsOS10_10());
|
||||
EXPECT_FALSE(blink::IsOS10_11());
|
||||
return;
|
||||
}
|
||||
|
||||
if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_10Max &&
|
||||
floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_10) {
|
||||
EXPECT_FALSE(blink::IsOSMavericks());
|
||||
EXPECT_TRUE(blink::IsOSYosemite());
|
||||
EXPECT_FALSE(blink::IsOSElCapitan());
|
||||
EXPECT_FALSE(blink::IsOS10_9());
|
||||
EXPECT_TRUE(blink::IsOS10_10());
|
||||
EXPECT_FALSE(blink::IsOS10_11());
|
||||
return;
|
||||
}
|
||||
|
||||
if (floor(NSAppKitVersionNumber) == NSAppKitVersionNumber10_11Max) {
|
||||
EXPECT_FALSE(blink::IsOSMavericks());
|
||||
EXPECT_FALSE(blink::IsOSYosemite());
|
||||
EXPECT_TRUE(blink::IsOSElCapitan());
|
||||
EXPECT_FALSE(blink::IsOS10_9());
|
||||
EXPECT_FALSE(blink::IsOS10_10());
|
||||
EXPECT_TRUE(blink::IsOS10_11());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ NSImage* GetImage(int image_id) {
|
||||
DoubleClickAction WindowTitleBarDoubleClickAction() {
|
||||
// El Capitan introduced a Dock preference to configure the window title bar
|
||||
// double-click action (Minimize, Maximize, or nothing).
|
||||
if (base::mac::IsOSElCapitanOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_11()) {
|
||||
NSString* doubleClickAction = [[NSUserDefaults standardUserDefaults]
|
||||
objectForKey:@"AppleActionOnDoubleClick"];
|
||||
|
||||
@ -60,8 +60,8 @@ DoubleClickAction WindowTitleBarDoubleClickAction() {
|
||||
// At this point _shouldMiniaturizeOnDoubleClick has returned |NO|. On
|
||||
// Yosemite, that means a double-click should Maximize the window, and on
|
||||
// all prior OSes a double-click should do nothing.
|
||||
return base::mac::IsOSYosemite() ? DoubleClickAction::MAXIMIZE
|
||||
: DoubleClickAction::NONE;
|
||||
return base::mac::IsOS10_10() ? DoubleClickAction::MAXIMIZE
|
||||
: DoubleClickAction::NONE;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -61,7 +61,7 @@ NSString* kSelectionDirection = @"Chromium.kSelectionDirection";
|
||||
// Work around it by reinstalling the tracking area after window resize.
|
||||
// This AppKit bug is fixed on Yosemite, so we only apply this workaround on
|
||||
// 10.9.
|
||||
if (base::mac::IsOSMavericks()) {
|
||||
if (base::mac::IsOS10_9()) {
|
||||
[self disableTracking];
|
||||
[self enableTracking];
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ IOSurfaceRef CreateIOSurface(const gfx::Size& size, gfx::BufferFormat format) {
|
||||
// https://crbug.com/594343.
|
||||
// IOSurface clearing causes significant performance regression on about half
|
||||
// of all devices running Yosemite. https://crbug.com/606850#c22.
|
||||
bool should_clear = !base::mac::IsOSMavericks() && !base::mac::IsOSYosemite();
|
||||
bool should_clear = !base::mac::IsOS10_9() && !base::mac::IsOS10_10();
|
||||
|
||||
if (should_clear) {
|
||||
// Zero-initialize the IOSurface. Calling IOSurfaceLock/IOSurfaceUnlock
|
||||
|
@ -20,7 +20,7 @@ namespace gfx {
|
||||
class ScopedCocoaDisableScreenUpdates {
|
||||
public:
|
||||
ScopedCocoaDisableScreenUpdates() {
|
||||
if (base::mac::IsOSElCapitanOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_11()) {
|
||||
// Beginning with OS X 10.11, [NSAnimationContext beginGrouping] is the
|
||||
// preferred way of disabling screen updates. Use of
|
||||
// NSDisableScreenUpdates() is discouraged.
|
||||
@ -30,7 +30,7 @@ class ScopedCocoaDisableScreenUpdates {
|
||||
}
|
||||
}
|
||||
~ScopedCocoaDisableScreenUpdates() {
|
||||
if (base::mac::IsOSElCapitanOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_11()) {
|
||||
[NSAnimationContext endGrouping];
|
||||
} else {
|
||||
NSEnableScreenUpdates();
|
||||
|
@ -29,7 +29,7 @@ namespace {
|
||||
// 10.10.
|
||||
base::ScopedCFTypeRef<CTFontRef> CopyFontWithSymbolicTraits(CTFontRef font,
|
||||
int sym_traits) {
|
||||
if (base::mac::IsOSElCapitanOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_11()) {
|
||||
return base::ScopedCFTypeRef<CTFontRef>(CTFontCreateCopyWithSymbolicTraits(
|
||||
font, 0, nullptr, sym_traits, sym_traits));
|
||||
}
|
||||
|
@ -225,12 +225,12 @@ TYPED_TEST_P(GLImageZeroInitializeTest, ZeroInitialize) {
|
||||
#if defined(OS_MACOSX)
|
||||
// This functionality is disabled on Mavericks because it breaks PDF
|
||||
// rendering. https://crbug.com/594343.
|
||||
if (base::mac::IsOSMavericks())
|
||||
if (base::mac::IsOS10_9())
|
||||
return;
|
||||
|
||||
// This functionality is disabled on Yosemite because it is suspected of
|
||||
// causing performance regressions on old hardware. https://crbug.com/606850.
|
||||
if (base::mac::IsOSYosemite())
|
||||
if (base::mac::IsOS10_10())
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
@ -188,8 +188,8 @@ SkColor NativeThemeMac::GetSystemColor(ColorId color_id) const {
|
||||
case kColorId_MenuBackgroundColor:
|
||||
return kMenuPopupBackgroundColor;
|
||||
case kColorId_MenuSeparatorColor:
|
||||
return base::mac::IsOSMavericks() ? kMenuSeparatorColorMavericks
|
||||
: kMenuSeparatorColor;
|
||||
return base::mac::IsOS10_9() ? kMenuSeparatorColorMavericks
|
||||
: kMenuSeparatorColor;
|
||||
case kColorId_MenuBorderColor:
|
||||
return kMenuBorderColor;
|
||||
|
||||
@ -250,7 +250,7 @@ void NativeThemeMac::PaintMenuPopupBackground(
|
||||
const MenuBackgroundExtraParams& menu_background) const {
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
if (base::mac::IsOSMavericks())
|
||||
if (base::mac::IsOS10_9())
|
||||
paint.setColor(kMenuPopupBackgroundColorMavericks);
|
||||
else
|
||||
paint.setColor(kMenuPopupBackgroundColor);
|
||||
|
@ -41,7 +41,7 @@ TEST_F(NativeThemeMacTest, SystemColorSpotChecks) {
|
||||
const SkColor kWindowColorYosemite = SkColorSetARGB(255, 236, 236, 236);
|
||||
SkColor dialogColor =
|
||||
native_theme->GetSystemColor(NativeTheme::kColorId_WindowBackground);
|
||||
if (base::mac::IsOSYosemiteOrLater())
|
||||
if (base::mac::IsAtLeastOS10_10())
|
||||
EXPECT_EQ(dialogColor, kWindowColorYosemite);
|
||||
else
|
||||
EXPECT_EQ(dialogColor, kWindowColorCatsMavericks);
|
||||
|
@ -345,7 +345,7 @@ ui::KeyEvent GetCharacterEventFromNSEvent(NSEvent* event) {
|
||||
|
||||
- (void)updateWindowMask {
|
||||
DCHECK(![self inLiveResize]);
|
||||
DCHECK(base::mac::IsOSMavericks());
|
||||
DCHECK(base::mac::IsOS10_9());
|
||||
DCHECK(hostedView_);
|
||||
|
||||
views::Widget* widget = hostedView_->GetWidget();
|
||||
@ -606,7 +606,7 @@ ui::KeyEvent GetCharacterEventFromNSEvent(NSEvent* event) {
|
||||
// We prevent updating the window mask and clipping the border around the
|
||||
// view, during a live resize. Hence update the window mask and redraw the
|
||||
// view after resize has completed.
|
||||
if (base::mac::IsOSMavericks()) {
|
||||
if (base::mac::IsOS10_9()) {
|
||||
[self updateWindowMask];
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
@ -633,7 +633,7 @@ ui::KeyEvent GetCharacterEventFromNSEvent(NSEvent* event) {
|
||||
// crbug.com/543671.
|
||||
if (windowMask_ && ![self inLiveResize] &&
|
||||
!IsRectInsidePath(dirtyRect, windowMask_)) {
|
||||
DCHECK(base::mac::IsOSMavericks());
|
||||
DCHECK(base::mac::IsOS10_9());
|
||||
gfx::ScopedNSGraphicsContextSaveGState state;
|
||||
|
||||
// The outer rectangular path corresponding to the window.
|
||||
|
@ -782,7 +782,7 @@ void BridgedNativeWidget::OnSizeChanged() {
|
||||
// We don't update the window mask during a live resize, instead it is done
|
||||
// after the resize is completed in viewDidEndLiveResize: in
|
||||
// BridgedContentView.
|
||||
if (base::mac::IsOSMavericks() && ![window_ inLiveResize])
|
||||
if (base::mac::IsOS10_9() && ![window_ inLiveResize])
|
||||
[bridged_view_ updateWindowMask];
|
||||
}
|
||||
|
||||
@ -979,7 +979,7 @@ void BridgedNativeWidget::CreateLayer(ui::LayerType layer_type,
|
||||
// to generate a window shadow from the composited CALayer. To get around
|
||||
// this, let the window background remain opaque and clip the window
|
||||
// boundary in drawRect method of BridgedContentView. See crbug.com/543671.
|
||||
if (base::mac::IsOSYosemiteOrLater())
|
||||
if (base::mac::IsAtLeastOS10_10())
|
||||
[window_ setBackgroundColor:[NSColor clearColor]];
|
||||
}
|
||||
|
||||
@ -1270,7 +1270,7 @@ void BridgedNativeWidget::AddCompositorSuperview() {
|
||||
if (widget_type_ == Widget::InitParams::TYPE_MENU) {
|
||||
// Giving the canvas opacity messes up subpixel font rendering, so use a
|
||||
// solid background, but make the CALayer transparent.
|
||||
if (base::mac::IsOSYosemiteOrLater()) {
|
||||
if (base::mac::IsAtLeastOS10_10()) {
|
||||
[background_layer setOpacity:kYosemiteMenuOpacity];
|
||||
CGSSetWindowBackgroundBlurRadius(
|
||||
_CGSDefaultConnection(), [window_ windowNumber], kYosemiteMenuBlur);
|
||||
|
@ -31,9 +31,8 @@ void MenuConfig::Init() {
|
||||
separator_height = 13;
|
||||
separator_upper_height = 7;
|
||||
separator_lower_height = 6;
|
||||
separator_thickness = base::mac::IsOSMavericks()
|
||||
? kMenuSeparatorHeightMavericks
|
||||
: kMenuSeparatorHeight;
|
||||
separator_thickness = base::mac::IsOS10_9() ? kMenuSeparatorHeightMavericks
|
||||
: kMenuSeparatorHeight;
|
||||
align_arrow_and_shortcut = true;
|
||||
icons_in_label = true;
|
||||
check_selected_combobox_item = true;
|
||||
|
Reference in New Issue
Block a user