Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use ScreenCaptureKit exclusively on macOS 14.4 and higher (#41403)
This fixes a nasty warning / permission dialog that pops up to end-users when consuming legacy APIs. Chrome has flipped these flags via field trials as have other Electron apps. It should just be the default. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
- Loading branch information
1 parent
1c3fedd
commit ce2ac1c
Showing
4 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <string> | ||
|
||
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 |