Browse Source

chore: remove redundant 10.11 @avilable checks (#31184)

Shelley Vohr 3 years ago
parent
commit
e07d74cf29

+ 2 - 4
shell/browser/mac/electron_application.mm

@@ -99,10 +99,8 @@ inline void dispatch_sync_main(dispatch_block_t block) {
 }
 
 - (void)resignCurrentActivity {
-  if (@available(macOS 10.11, *)) {
-    if (currentActivity_)
-      [currentActivity_ resignCurrent];
-  }
+  if (currentActivity_)
+    [currentActivity_ resignCurrent];
 }
 
 - (void)updateCurrentActivity:(NSString*)type

+ 15 - 18
shell/browser/native_window_mac.mm

@@ -1408,24 +1408,21 @@ void NativeWindowMac::SetVibrancy(const std::string& type) {
     vibrancyType = NSVisualEffectMaterialTitlebar;
   }
 
-  if (@available(macOS 10.11, *)) {
-    if (type == "selection") {
-      vibrancyType = NSVisualEffectMaterialSelection;
-    } else if (type == "menu") {
-      vibrancyType = NSVisualEffectMaterialMenu;
-    } else if (type == "popover") {
-      vibrancyType = NSVisualEffectMaterialPopover;
-    } else if (type == "sidebar") {
-      vibrancyType = NSVisualEffectMaterialSidebar;
-    } else if (type == "medium-light") {
-      EmitWarning(env, "NSVisualEffectMaterialMediumLight" + dep_warn,
-                  "electron");
-      vibrancyType = NSVisualEffectMaterialMediumLight;
-    } else if (type == "ultra-dark") {
-      EmitWarning(env, "NSVisualEffectMaterialUltraDark" + dep_warn,
-                  "electron");
-      vibrancyType = NSVisualEffectMaterialUltraDark;
-    }
+  if (type == "selection") {
+    vibrancyType = NSVisualEffectMaterialSelection;
+  } else if (type == "menu") {
+    vibrancyType = NSVisualEffectMaterialMenu;
+  } else if (type == "popover") {
+    vibrancyType = NSVisualEffectMaterialPopover;
+  } else if (type == "sidebar") {
+    vibrancyType = NSVisualEffectMaterialSidebar;
+  } else if (type == "medium-light") {
+    EmitWarning(env, "NSVisualEffectMaterialMediumLight" + dep_warn,
+                "electron");
+    vibrancyType = NSVisualEffectMaterialMediumLight;
+  } else if (type == "ultra-dark") {
+    EmitWarning(env, "NSVisualEffectMaterialUltraDark" + dep_warn, "electron");
+    vibrancyType = NSVisualEffectMaterialUltraDark;
   }
 
   if (@available(macOS 10.14, *)) {

+ 7 - 10
shell/browser/ui/tray_icon_cocoa.mm

@@ -125,16 +125,13 @@
                   range:NSMakeRange(0, [attributed_title length])];
     }
   } else if ([font_type isEqualToString:@"monospacedDigit"]) {
-    if (@available(macOS 10.11, *)) {
-      NSDictionary* attributes = @{
-        NSFontAttributeName :
-            [NSFont monospacedDigitSystemFontOfSize:existing_size
-                                             weight:NSFontWeightRegular]
-      };
-      [attributed_title
-          addAttributes:attributes
-                  range:NSMakeRange(0, [attributed_title length])];
-    }
+    NSDictionary* attributes = @{
+      NSFontAttributeName :
+          [NSFont monospacedDigitSystemFontOfSize:existing_size
+                                           weight:NSFontWeightRegular]
+    };
+    [attributed_title addAttributes:attributes
+                              range:NSMakeRange(0, [attributed_title length])];
   }
 
   // Set title