Remove 10.13, 10.14 support in chrome/

These macOS releases are no longer supported by Chromium.

Bug: 1410851
Change-Id: Ia3f3308ef4294bd0eb063c0b731cb8381e660fd4
Cq-Include-Trybots: luci.chrome.try:mac-chrome
Validate-Test-Flakiness: skip
Low-Coverage-Reason: Doing core refactoring across all of Chromium; I do not own this code
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4673677
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1168728}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index ddebc8e..a21ac39 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -6098,6 +6098,7 @@
       "Accelerate.framework",
       "AudioUnit.framework",
       "AVFoundation.framework",
+      "AuthenticationServices.framework",
       "DiskArbitration.framework",
       "IOKit.framework",
       "ImageCaptureCore.framework",
@@ -6106,11 +6107,10 @@
       "QuartzCore.framework",
       "SafariServices.framework",
       "SecurityInterface.framework",
+      "UserNotifications.framework",
     ]
     weak_frameworks = [
-      "AuthenticationServices.framework",  # macOS 10.15
       "UniformTypeIdentifiers.framework",  # macOS 11
-      "UserNotifications.framework",  # macOS 10.14
     ]
     public_deps += [ "//chrome/browser/mac:keystone_glue" ]
   }
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 485c688..a03c280 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -142,7 +142,7 @@
 // Stores the pending web auth requests (typically while the profile is being
 // loaded) until they are passed to the AuthSessionRequest class.
 NSMutableDictionary<NSUUID*, ASWebAuthenticationSessionRequest*>*
-GetPendingWebAuthRequests() API_AVAILABLE(macos(10.15)) {
+GetPendingWebAuthRequests() {
   static NSMutableDictionary* g_pending_requests =
       [[NSMutableDictionary alloc] init];
   return g_pending_requests;
@@ -158,7 +158,7 @@
 // Starts a web authentication session request.
 void BeginHandlingWebAuthenticationSessionRequestWithProfile(
     ASWebAuthenticationSessionRequest* request,
-    Profile* profile) API_AVAILABLE(macos(10.15)) {
+    Profile* profile) {
   NSUUID* key = request.UUID;
   if (![GetPendingWebAuthRequests() objectForKey:key])
     return;  // The request has been canceled, do not start the session.
@@ -1066,10 +1066,8 @@
 
   _handoffObserver = std::make_unique<HandoffObserver>(self);
 
-  if (@available(macOS 10.15, *)) {
-    ASWebAuthenticationSessionWebBrowserSessionManager.sharedManager
-        .sessionHandler = self;
-  }
+  ASWebAuthenticationSessionWebBrowserSessionManager.sharedManager
+      .sessionHandler = self;
 }
 
 // Helper function for populating and displaying the in progress downloads at
@@ -2043,7 +2041,7 @@
 // worker thread, so it's important to hop to the main thread.
 
 - (void)beginHandlingWebAuthenticationSessionRequest:
-    (ASWebAuthenticationSessionRequest*)request API_AVAILABLE(macos(10.15)) {
+    (ASWebAuthenticationSessionRequest*)request {
   dispatch_async(dispatch_get_main_queue(), ^(void) {
     // Start tracking the pending request, so it's possible to cancel it before
     // the session actually starts.
@@ -2060,7 +2058,7 @@
 }
 
 - (void)cancelWebAuthenticationSessionRequest:
-    (ASWebAuthenticationSessionRequest*)request API_AVAILABLE(macos(10.15)) {
+    (ASWebAuthenticationSessionRequest*)request {
   dispatch_async(dispatch_get_main_queue(), ^(void) {
     NSUUID* key = request.UUID;
     if ([GetPendingWebAuthRequests() objectForKey:key]) {
diff --git a/chrome/browser/apps/intent_helper/mac_intent_picker_helpers.mm b/chrome/browser/apps/intent_helper/mac_intent_picker_helpers.mm
index fad9406..5a38381 100644
--- a/chrome/browser/apps/intent_helper/mac_intent_picker_helpers.mm
+++ b/chrome/browser/apps/intent_helper/mac_intent_picker_helpers.mm
@@ -74,15 +74,15 @@
   if (!universal_links_enabled)
     return absl::nullopt;
 
-  if (@available(macOS 10.15, *)) {
-    NSURL* nsurl = net::NSURLWithGURL(url);
-    if (!nsurl)
-      return absl::nullopt;
+  NSURL* nsurl = net::NSURLWithGURL(url);
+  if (!nsurl) {
+    return absl::nullopt;
+  }
 
-    SFUniversalLink* link = [[SFUniversalLink alloc] initWithWebpageURL:nsurl];
+  SFUniversalLink* link = [[SFUniversalLink alloc] initWithWebpageURL:nsurl];
 
-    if (link)
-      return AppInfoForAppUrl(link.applicationURL);
+  if (link) {
+    return AppInfoForAppUrl(link.applicationURL);
   }
 
   return absl::nullopt;
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 6c6639e..ce912a9 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -5110,9 +5110,7 @@
 #endif
 
 #if BUILDFLAG(IS_MAC)
-  if (__builtin_available(macOS 10.15, *)) {
-    MaybeAddThrottle(MaybeCreateAuthSessionThrottleFor(handle), &throttles);
-  }
+  MaybeAddThrottle(MaybeCreateAuthSessionThrottleFor(handle), &throttles);
 #endif
 
   auto* performance_manager_registry =
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 4b0f9e84..7dcba481 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -1103,8 +1103,7 @@
 const char kNewMacNotificationAPIName[] =
     "Determines which notification API to use on macOS devices";
 const char kNewMacNotificationAPIDescription[] =
-    "Enables the usage of Apple's new notification API which will run on macOS "
-    "10.14+";
+    "Enables the usage of Apple's new notification API";
 
 const char kWinrtGeolocationImplementationName[] =
     "WinRT Geolocation Implementation";
diff --git a/chrome/browser/platform_util_mac.mm b/chrome/browser/platform_util_mac.mm
index 43040bd..61292177f 100644
--- a/chrome/browser/platform_util_mac.mm
+++ b/chrome/browser/platform_util_mac.mm
@@ -60,20 +60,10 @@
   if (!url)
     return;
 
-  if (@available(macOS 10.15, *)) {
-    [[NSWorkspace sharedWorkspace]
-                  openURL:url
-            configuration:[NSWorkspaceOpenConfiguration configuration]
-        completionHandler:nil];
-  } else {
-    const NSWorkspaceLaunchOptions launch_options =
-        NSWorkspaceLaunchAsync | NSWorkspaceLaunchWithErrorPresentation;
-    [[NSWorkspace sharedWorkspace] openURLs:@[ url ]
-                    withAppBundleIdentifier:nil
-                                    options:launch_options
-             additionalEventParamDescriptor:nil
-                          launchIdentifiers:nil];
-  }
+  [[NSWorkspace sharedWorkspace]
+                openURL:url
+          configuration:[NSWorkspaceOpenConfiguration configuration]
+      completionHandler:nil];
 }
 
 namespace internal {
diff --git a/chrome/browser/ui/views/eye_dropper/eye_dropper_view.h b/chrome/browser/ui/views/eye_dropper/eye_dropper_view.h
index 26157fa..712fc5d 100644
--- a/chrome/browser/ui/views/eye_dropper/eye_dropper_view.h
+++ b/chrome/browser/ui/views/eye_dropper/eye_dropper_view.h
@@ -18,9 +18,7 @@
 #include "ui/gfx/geometry/point.h"
 #include "ui/views/widget/widget_delegate.h"
 
-// EyeDropperView is used on Aura platforms and on the Mac before 10.15.
-// Starting with macOS 10.15, EyeDropperViewMac is used as it relies on the new
-// NSColorSampler API.
+// EyeDropperView is used on Aura platforms.
 class EyeDropperView : public content::EyeDropper,
                        public views::WidgetDelegateView {
  public:
@@ -56,10 +54,6 @@
     class KeyboardHandler;
     std::unique_ptr<KeyboardHandler> keyboard_handler_;
 #endif
-#if BUILDFLAG(IS_MAC)
-    struct ObjCStorage;
-    std::unique_ptr<ObjCStorage> objc_storage_;
-#endif
   };
 
   // Moves the view to the cursor position.
diff --git a/chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm b/chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm
index b9039be..2ab02864 100644
--- a/chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm
+++ b/chrome/browser/ui/views/eye_dropper/eye_dropper_view_mac.mm
@@ -9,7 +9,6 @@
 
 #include <memory>
 
-#include "chrome/browser/ui/views/eye_dropper/eye_dropper_view.h"
 #include "content/public/browser/render_frame_host.h"
 #include "skia/ext/skia_utils_mac.h"
 #include "ui/base/ui_base_features.h"
@@ -20,114 +19,27 @@
 
 EyeDropperViewMac::EyeDropperViewMac(content::EyeDropperListener* listener)
     : listener_(listener), weak_ptr_factory_(this) {
-  if (!listener_)
+  if (!listener_) {
     return;
-  if (@available(macOS 10.15, *)) {
-    color_sampler_ = [[NSColorSampler alloc] init];
-    // Used to ensure that EyeDropperViewMac is still alive when the handler is
-    // called.
-    base::WeakPtr<EyeDropperViewMac> weak_this = weak_ptr_factory_.GetWeakPtr();
-    [color_sampler_ showSamplerWithSelectionHandler:^(NSColor* selectedColor) {
-      if (!weak_this)
-        return;
-      if (!selectedColor) {
-        listener_->ColorSelectionCanceled();
-      } else {
-        listener_->ColorSelected(skia::NSSystemColorToSkColor(selectedColor));
-      }
-    }];
   }
+  color_sampler_ = [[NSColorSampler alloc] init];
+  // Used to ensure that EyeDropperViewMac is still alive when the handler is
+  // called.
+  base::WeakPtr<EyeDropperViewMac> weak_this = weak_ptr_factory_.GetWeakPtr();
+  [color_sampler_ showSamplerWithSelectionHandler:^(NSColor* selectedColor) {
+    if (!weak_this) {
+      return;
+    }
+    if (!selectedColor) {
+      listener_->ColorSelectionCanceled();
+    } else {
+      listener_->ColorSelected(skia::NSSystemColorToSkColor(selectedColor));
+    }
+  }];
 }
 
 EyeDropperViewMac::~EyeDropperViewMac() = default;
 
-struct EyeDropperView::PreEventDispatchHandler::ObjCStorage {
-  id __strong click_event_tap = nil;
-  id __strong notification_observer = nil;
-};
-
-EyeDropperView::PreEventDispatchHandler::PreEventDispatchHandler(
-    EyeDropperView* view,
-    gfx::NativeView parent)
-    : view_(view), objc_storage_(std::make_unique<ObjCStorage>()) {
-  // Ensure that this handler is called before color popup handler.
-  objc_storage_->click_event_tap = [NSEvent
-      addLocalMonitorForEventsMatchingMask:NSEventMaskAny
-                                   handler:^NSEvent*(NSEvent* event) {
-                                     NSEventType eventType = [event type];
-                                     if (eventType ==
-                                             NSEventTypeLeftMouseDown ||
-                                         eventType ==
-                                             NSEventTypeRightMouseDown) {
-                                       view_->OnColorSelected();
-                                       return nil;
-                                     } else if (eventType ==
-                                                    NSEventTypeKeyDown &&
-                                                [event keyCode] == kVK_Escape) {
-                                       view_->OnColorSelectionCanceled();
-                                       return nil;
-                                     }
-
-                                     return event;
-                                   }];
-
-  // Needed because the local event monitor doesn't see the click on the
-  // menubar.
-  objc_storage_->notification_observer = [NSNotificationCenter.defaultCenter
-      addObserverForName:NSMenuDidBeginTrackingNotification
-                  object:NSApp.mainMenu
-                   queue:NSOperationQueue.mainQueue
-              usingBlock:^(NSNotification* note) {
-                view_->OnColorSelected();
-              }];
-}
-
-EyeDropperView::PreEventDispatchHandler::~PreEventDispatchHandler() {
-  if (objc_storage_->click_event_tap) {
-    [NSEvent removeMonitor:objc_storage_->click_event_tap];
-    objc_storage_->click_event_tap = nil;
-  }
-
-  if (objc_storage_->notification_observer) {
-    [NSNotificationCenter.defaultCenter
-        removeObserver:objc_storage_->notification_observer];
-    objc_storage_->notification_observer = nil;
-  }
-}
-
-void EyeDropperView::PreEventDispatchHandler::OnMouseEvent(
-    ui::MouseEvent* event) {
-  // The event monitor already provides a handler.
-}
-
-void EyeDropperView::MoveViewToFront() {
-  // Moves the window to the front of the screen list within the popup level
-  // since the eye dropper can be opened from the color picker.
-  NSWindow* window = GetWidget()->GetNativeWindow().GetNativeNSWindow();
-  window.level = NSPopUpMenuWindowLevel;
-  [window makeKeyAndOrderFront:nil];
-}
-
-void EyeDropperView::CaptureInputIfNeeded() {
-  // There is no need to capture input on Mac.
-}
-
-void EyeDropperView::HideCursor() {
-  [NSCursor hide];
-}
-
-void EyeDropperView::ShowCursor() {
-  [NSCursor unhide];
-}
-
-gfx::Size EyeDropperView::GetSize() const {
-  return gfx::Size(90, 90);
-}
-
-float EyeDropperView::GetDiameter() const {
-  return 90;
-}
-
 std::unique_ptr<content::EyeDropper> ShowEyeDropper(
     content::RenderFrameHost* frame,
     content::EyeDropperListener* listener) {
@@ -135,8 +47,5 @@
     return nullptr;
   }
 
-  if (@available(macOS 10.15, *)) {
-    return std::make_unique<EyeDropperViewMac>(listener);
-  }
-  return std::make_unique<EyeDropperView>(frame, listener);
+  return std::make_unique<EyeDropperViewMac>(listener);
 }
diff --git a/chrome/services/speech/soda/soda_client.cc b/chrome/services/speech/soda/soda_client.cc
index 35cca1e..075657d 100644
--- a/chrome/services/speech/soda/soda_client.cc
+++ b/chrome/services/speech/soda/soda_client.cc
@@ -10,10 +10,6 @@
 #include "base/metrics/histogram_functions.h"
 #include "build/build_config.h"
 
-#if BUILDFLAG(IS_MAC)
-#include "base/mac/mac_util.h"
-#endif
-
 namespace soda {
 
 SodaClient::SodaClient(base::FilePath library_path)
@@ -71,16 +67,6 @@
 
   if (IsInitialized())
     delete_soda_func_(soda_async_handle_);
-
-#if BUILDFLAG(IS_MAC)
-  // Intentionally do not unload the libsoda.so library after the SodaClient
-  // is destroyed to prevent global destructor functions from running on an
-  // unloaded library. This only applies to older versions of MacOS since
-  // there have been no crashes on 10.15+, likely due to a change in the
-  // __cxa_atexit implementation.
-  if (base::mac::IsAtMostOS10_14())
-    std::ignore = lib_.release();
-#endif  // BUILDFLAG(IS_MAC)
 }
 
 NO_SANITIZE("cfi-icall")