Mac's version checking function has changed

This commit is contained in:
Cheng Zhao 2017-01-23 19:05:49 +09:00 committed by Kevin Sawicki
parent 1d29b23662
commit 3224c39371

View file

@ -228,7 +228,7 @@ bool ScopedDisableResize::disable_resize_ = false;
- (void)windowWillEnterFullScreen:(NSNotification*)notification {
// Hide the native toolbar before entering fullscreen, so there is no visual
// artifacts.
if (base::mac::IsOSYosemiteOrLater() &&
if (base::mac::IsOS10_10() &&
shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
NSWindow* window = shell_->GetNativeWindow();
[window setToolbar:nil];
@ -243,7 +243,7 @@ bool ScopedDisableResize::disable_resize_ = false;
// have to set one, because title bar is visible here.
NSWindow* window = shell_->GetNativeWindow();
if ((shell_->transparent() || !shell_->has_frame()) &&
base::mac::IsOSYosemiteOrLater() &&
base::mac::IsOS10_10() &&
// FIXME(zcbenz): Showing titlebar for hiddenInset window is weird under
// fullscreen mode.
shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET) {
@ -252,7 +252,7 @@ bool ScopedDisableResize::disable_resize_ = false;
// Restore the native toolbar immediately after entering fullscreen, if we do
// this before leaving fullscreen, traffic light buttons will be jumping.
if (base::mac::IsOSYosemiteOrLater() &&
if (base::mac::IsOS10_10() &&
shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
base::scoped_nsobject<NSToolbar> toolbar(
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
@ -269,13 +269,13 @@ bool ScopedDisableResize::disable_resize_ = false;
// Restore the titlebar visibility.
NSWindow* window = shell_->GetNativeWindow();
if ((shell_->transparent() || !shell_->has_frame()) &&
base::mac::IsOSYosemiteOrLater() &&
base::mac::IsOS10_10() &&
shell_->title_bar_style() != atom::NativeWindowMac::HIDDEN_INSET) {
[window setTitleVisibility:NSWindowTitleHidden];
}
// Turn off the style for toolbar.
if (base::mac::IsOSYosemiteOrLater() &&
if (base::mac::IsOS10_10() &&
shell_->title_bar_style() == atom::NativeWindowMac::HIDDEN_INSET) {
shell_->SetStyleMask(false, NSFullSizeContentViewWindowMask);
}
@ -712,7 +712,7 @@ NativeWindowMac::NativeWindowMac(
[window_ setDisableKeyOrMainWindow:YES];
if (transparent() || !has_frame()) {
if (base::mac::IsOSYosemiteOrLater()) {
if (base::mac::IsOS10_10()) {
// Don't show title bar.
[window_ setTitleVisibility:NSWindowTitleHidden];
}
@ -725,7 +725,7 @@ NativeWindowMac::NativeWindowMac(
// Hide the title bar.
if (title_bar_style_ == HIDDEN_INSET) {
if (base::mac::IsOSYosemiteOrLater()) {
if (base::mac::IsOS10_10()) {
[window_ setTitlebarAppearsTransparent:YES];
base::scoped_nsobject<NSToolbar> toolbar(
[[NSToolbar alloc] initWithIdentifier:@"titlebarStylingToolbar"]);
@ -1104,7 +1104,7 @@ void NativeWindowMac::Center() {
void NativeWindowMac::SetTitle(const std::string& title) {
// For macOS <= 10.9, the setTitleVisibility API is not available, we have
// to avoid calling setTitle for frameless window.
if (!base::mac::IsOSYosemiteOrLater() && (transparent() || !has_frame()))
if (!base::mac::IsOS10_10() && (transparent() || !has_frame()))
return;
[window_ setTitle:base::SysUTF8ToNSString(title)];
@ -1275,7 +1275,7 @@ void NativeWindowMac::SetAutoHideCursor(bool auto_hide) {
}
void NativeWindowMac::SetVibrancy(const std::string& type) {
if (!base::mac::IsOSYosemiteOrLater()) return;
if (!base::mac::IsOS10_10()) return;
NSView* vibrant_view = [window_ vibrantView];
@ -1314,7 +1314,7 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
vibrancyType = NSVisualEffectMaterialTitlebar;
}
if (base::mac::IsOSElCapitanOrLater()) {
if (base::mac::IsOS10_11()) {
// TODO(kevinsawicki): Use NSVisualEffectMaterial* constants directly once
// they are available in the minimum SDK version
if (type == "selection") {
@ -1419,7 +1419,7 @@ void NativeWindowMac::InstallView() {
// Make sure the bottom corner is rounded for non-modal windows: http://crbug.com/396264.
// But do not enable it on OS X 10.9 for transparent window, otherwise a
// semi-transparent frame would show.
if (!(transparent() && base::mac::IsOSMavericks()) && !is_modal())
if (!(transparent() && base::mac::IsOS10_9()) && !is_modal())
[[window_ contentView] setWantsLayer:YES];
NSView* view = inspectable_web_contents()->GetView()->GetNativeView();
@ -1444,7 +1444,7 @@ void NativeWindowMac::InstallView() {
[[window_ standardWindowButton:NSWindowFullScreenButton] setHidden:YES];
if (title_bar_style_ != NORMAL) {
if (base::mac::IsOSMavericks()) {
if (base::mac::IsOS10_9()) {
ShowWindowButton(NSWindowZoomButton);
ShowWindowButton(NSWindowMiniaturizeButton);
ShowWindowButton(NSWindowCloseButton);