disable-capture-all-screens.patch 4.35 KB
Newer Older
1
Index: chromium-128.0.6613.137/chrome/browser/media/webrtc/capture_policy_utils.cc
2
===================================================================
3 4
--- chromium-128.0.6613.137.orig/chrome/browser/media/webrtc/capture_policy_utils.cc
+++ chromium-128.0.6613.137/chrome/browser/media/webrtc/capture_policy_utils.cc
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
@@ -63,46 +63,7 @@ void IsMultiCaptureAllowedForAnyOriginOn
     base::OnceCallback<void(bool)> callback,
     content::BrowserContext* context,
     bool is_multi_capture_allowed_for_any_origin_on_main_profile) {
-  // If the new MultiScreenCaptureAllowedForUrls policy permits access, exit
-  // early. If not, check the legacy
-  // GetDisplayMediaSetSelectAllScreensAllowedForUrls policy.
-  if (is_multi_capture_allowed_for_any_origin_on_main_profile) {
-    std::move(callback).Run(true);
-    return;
-  }
-
-  // TODO(b/329064666): Remove the checks below once the pivot to IWAs is
-  // complete.
-  Profile* profile = Profile::FromBrowserContext(context);
-  if (!profile) {
-    std::move(callback).Run(false);
-    return;
-  }
-
-#if BUILDFLAG(IS_CHROMEOS_LACROS)
-  // To ensure that a user is informed at login time that capturing of all
-  // screens can happen (for privacy reasons), this API is only available on
-  // primary profiles.
-  if (!profile->IsMainProfile()) {
-    std::move(callback).Run(false);
-    return;
-  }
-#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)
-
-  HostContentSettingsMap* host_content_settings_map =
-      HostContentSettingsMapFactory::GetForProfile(profile);
-  if (!host_content_settings_map) {
     std::move(callback).Run(false);
-    return;
-  }
-  ContentSettingsForOneType content_settings =
-      host_content_settings_map->GetSettingsForOneType(
-          ContentSettingsType::ALL_SCREEN_CAPTURE);
-  std::move(callback).Run(base::ranges::any_of(
-      content_settings, [](const ContentSettingPatternSource& source) {
-        return source.GetContentSetting() ==
-               ContentSetting::CONTENT_SETTING_ALLOW;
-      }));
 }
 
 void CheckAllScreensMediaAllowedForIwaResultReceived(
@@ -290,58 +251,13 @@ void RegisterProfilePrefs(PrefRegistrySi
 void CheckGetAllScreensMediaAllowedForAnyOrigin(
     content::BrowserContext* context,
     base::OnceCallback<void(bool)> callback) {
-#if BUILDFLAG(IS_CHROMEOS)
-  if (crosapi::mojom::MultiCaptureService* multi_capture_service =
-          GetMultiCaptureService()) {
-    multi_capture_service->IsMultiCaptureAllowedForAnyOriginOnMainProfile(
-        base::BindOnce(
-            IsMultiCaptureAllowedForAnyOriginOnMainProfileResultReceived,
-            std::move(callback), context));
-  } else {
-    // If the multi capture service is not available with the required version,
-    // fall back to the original flow using the deprecated policy.
-    IsMultiCaptureAllowedForAnyOriginOnMainProfileResultReceived(
-        std::move(callback), context, /*result=*/false);
-  }
-#else
   std::move(callback).Run(false);
-#endif  // BUILDFLAG(IS_CHROMEOS)
 }
 
 void CheckGetAllScreensMediaAllowed(content::BrowserContext* context,
                                     const GURL& url,
                                     base::OnceCallback<void(bool)> callback) {
-#if BUILDFLAG(IS_CHROMEOS_LACROS)
-  Profile* profile = Profile::FromBrowserContext(context);
-  if (!profile) {
-    std::move(callback).Run(false);
-    return;
-  }
-  // To ensure that a user is informed at login time that capturing of all
-  // screens can happen (for privacy reasons), this API is only available on
-  // primary profiles.
-  if (!profile->IsMainProfile()) {
-    std::move(callback).Run(false);
-    return;
-  }
-#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)
-
-#if BUILDFLAG(IS_CHROMEOS)
-  crosapi::mojom::MultiCaptureService* multi_capture_service =
-      GetMultiCaptureService();
-  if (multi_capture_service) {
-    multi_capture_service->IsMultiCaptureAllowed(
-        url, base::BindOnce(&CheckAllScreensMediaAllowedForIwaResultReceived,
-                            std::move(callback), std::move(url), context));
-  } else {
-    // If the multi capture service is not available with the required version,
-    // fall back to the original flow using the deprecated policy.
-    CheckAllScreensMediaAllowedForIwaResultReceived(
-        std::move(callback), std::move(url), context, /*result=*/false);
-  }
-#else
   std::move(callback).Run(false);
-#endif  // BUILDFLAG(IS_CHROMEOS)
 }
 
 #if !BUILDFLAG(IS_ANDROID)