diff --git a/filenames.gni b/filenames.gni index 2ac50143e6e5d..e39cb840dea4b 100644 --- a/filenames.gni +++ b/filenames.gni @@ -383,6 +383,7 @@ filenames = { "shell/browser/extended_web_contents_observer.h", "shell/browser/feature_list.cc", "shell/browser/feature_list.h", + "shell/browser/feature_list_mac.mm", "shell/browser/file_select_helper.cc", "shell/browser/file_select_helper.h", "shell/browser/file_select_helper_mac.mm", diff --git a/shell/browser/feature_list.cc b/shell/browser/feature_list.cc index e282bf6f1b3f4..6705ded51841d 100644 --- a/shell/browser/feature_list.cc +++ b/shell/browser/feature_list.cc @@ -49,6 +49,11 @@ void InitializeFeatureList() { // 'custom dictionary word list API' spec to crash. std::string(",") + spellcheck::kWinDelaySpellcheckServiceInit.name; #endif + std::string platform_specific_enable_features = + EnablePlatformSpecificFeatures(); + if (platform_specific_enable_features.size() > 0) { + enable_features += std::string(",") + platform_specific_enable_features; + } base::FeatureList::InitInstance(enable_features, disable_features); } @@ -60,4 +65,10 @@ void InitializeFieldTrials() { base::FieldTrialList::CreateTrialsFromString(force_fieldtrials); } +#if !BUILDFLAG(IS_MAC) +std::string EnablePlatformSpecificFeatures() { + return ""; +} +#endif + } // namespace electron diff --git a/shell/browser/feature_list.h b/shell/browser/feature_list.h index cd70456cc2b22..34fdeb5850b9d 100644 --- a/shell/browser/feature_list.h +++ b/shell/browser/feature_list.h @@ -5,9 +5,12 @@ #ifndef ELECTRON_SHELL_BROWSER_FEATURE_LIST_H_ #define ELECTRON_SHELL_BROWSER_FEATURE_LIST_H_ +#include + namespace electron { void InitializeFeatureList(); void InitializeFieldTrials(); +std::string EnablePlatformSpecificFeatures(); } // namespace electron #endif // ELECTRON_SHELL_BROWSER_FEATURE_LIST_H_ diff --git a/shell/browser/feature_list_mac.mm b/shell/browser/feature_list_mac.mm new file mode 100644 index 0000000000000..5d6bc45d324d6 --- /dev/null +++ b/shell/browser/feature_list_mac.mm @@ -0,0 +1,28 @@ +// Copyright (c) 2024 Salesforce, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "electron/shell/browser/feature_list.h" + +#include + +namespace electron { + +std::string EnablePlatformSpecificFeatures() { + if (@available(macOS 14.4, *)) { + // These flags aren't exported so reference them by name directly, they are + // used to ensure that screen and window capture exclusive use + // ScreenCaptureKit APIs to avoid warning dialogs on macOS 14.4 and higher. + // kScreenCaptureKitPickerScreen, + // chrome/browser/media/webrtc/thumbnail_capturer_mac.mm + // kScreenCaptureKitStreamPickerSonoma, + // chrome/browser/media/webrtc/thumbnail_capturer_mac.mm + // kThumbnailCapturerMac, + // chrome/browser/media/webrtc/thumbnail_capturer_mac.mm + return "ScreenCaptureKitPickerScreen,ScreenCaptureKitStreamPickerSonoma," + "ThumbnailCapturerMac:capture_mode/sc_screenshot_manager"; + } + return ""; +} + +} // namespace electron