2022-08-26 18:23:48 +02:00
|
|
|
diff --git chrome/browser/background_fetch/background_fetch_permission_context.cc chrome/browser/background_fetch/background_fetch_permission_context.cc
|
2023-09-15 21:51:43 +02:00
|
|
|
index 429739d7b8dfe..0f4bff365f62b 100644
|
2022-08-26 18:23:48 +02:00
|
|
|
--- chrome/browser/background_fetch/background_fetch_permission_context.cc
|
|
|
|
+++ chrome/browser/background_fetch/background_fetch_permission_context.cc
|
|
|
|
@@ -4,6 +4,7 @@
|
|
|
|
|
|
|
|
#include "chrome/browser/background_fetch/background_fetch_permission_context.h"
|
|
|
|
|
|
|
|
+#include "cef/libcef/features/runtime.h"
|
|
|
|
#include "chrome/browser/browser_process.h"
|
|
|
|
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
|
|
|
#include "chrome/browser/download/download_request_limiter.h"
|
2022-10-17 19:27:40 +02:00
|
|
|
@@ -25,7 +26,8 @@ ContentSetting BackgroundFetchPermissionContext::GetPermissionStatusInternal(
|
2022-08-26 18:23:48 +02:00
|
|
|
const GURL& embedding_origin) const {
|
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
|
|
|
|
|
- if (render_frame_host && !render_frame_host->GetParent()) {
|
|
|
|
+ if (!cef::IsAlloyRuntimeEnabled() &&
|
|
|
|
+ render_frame_host && !render_frame_host->GetParent()) {
|
|
|
|
DownloadRequestLimiter* limiter =
|
|
|
|
g_browser_process->download_request_limiter();
|
|
|
|
DCHECK(limiter);
|
2022-09-09 17:58:22 +02:00
|
|
|
diff --git chrome/browser/background_sync/periodic_background_sync_permission_context.cc chrome/browser/background_sync/periodic_background_sync_permission_context.cc
|
2023-09-15 21:51:43 +02:00
|
|
|
index ea1467d09700d..5537a99500e7f 100644
|
2022-09-09 17:58:22 +02:00
|
|
|
--- chrome/browser/background_sync/periodic_background_sync_permission_context.cc
|
|
|
|
+++ chrome/browser/background_sync/periodic_background_sync_permission_context.cc
|
|
|
|
@@ -6,6 +6,7 @@
|
|
|
|
|
|
|
|
#include "base/feature_list.h"
|
|
|
|
#include "build/build_config.h"
|
|
|
|
+#include "cef/libcef/features/runtime.h"
|
|
|
|
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
|
|
|
#include "chrome/browser/installable/installable_utils.h"
|
|
|
|
#include "chrome/browser/profiles/profile.h"
|
2022-10-17 19:27:40 +02:00
|
|
|
@@ -89,6 +90,10 @@ PeriodicBackgroundSyncPermissionContext::GetPermissionStatusInternal(
|
2022-09-09 17:58:22 +02:00
|
|
|
return CONTENT_SETTING_ALLOW;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+ if (cef::IsAlloyRuntimeEnabled()) {
|
|
|
|
+ return CONTENT_SETTING_BLOCK;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
bool can_bypass_install_requirement =
|
|
|
|
base::FeatureList::IsEnabled(
|
|
|
|
features::kPeriodicSyncPermissionForDefaultSearchEngine) &&
|
2022-07-07 12:01:24 +02:00
|
|
|
diff --git chrome/browser/permissions/chrome_permissions_client.cc chrome/browser/permissions/chrome_permissions_client.cc
|
2024-02-22 19:36:15 +01:00
|
|
|
index b6afdced9d0af..e189d08ecdd46 100644
|
2022-07-07 12:01:24 +02:00
|
|
|
--- chrome/browser/permissions/chrome_permissions_client.cc
|
|
|
|
+++ chrome/browser/permissions/chrome_permissions_client.cc
|
2023-01-30 18:43:54 +01:00
|
|
|
@@ -14,6 +14,7 @@
|
|
|
|
#include "base/time/time.h"
|
2022-07-07 12:01:24 +02:00
|
|
|
#include "build/build_config.h"
|
|
|
|
#include "build/chromeos_buildflags.h"
|
|
|
|
+#include "cef/libcef/features/runtime.h"
|
|
|
|
#include "chrome/browser/bluetooth/bluetooth_chooser_context_factory.h"
|
2024-02-22 19:36:15 +01:00
|
|
|
#include "chrome/browser/browser_process.h"
|
2022-07-07 12:01:24 +02:00
|
|
|
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
2024-02-22 19:36:15 +01:00
|
|
|
@@ -189,6 +190,9 @@ ChromePermissionsClient::GetPermissionDecisionAutoBlocker(
|
2022-07-07 12:01:24 +02:00
|
|
|
double ChromePermissionsClient::GetSiteEngagementScore(
|
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
const GURL& origin) {
|
|
|
|
+ // No SiteEngagementService with the Alloy runtime.
|
|
|
|
+ if (cef::IsAlloyRuntimeEnabled())
|
|
|
|
+ return 0.0;
|
|
|
|
return site_engagement::SiteEngagementService::Get(
|
|
|
|
Profile::FromBrowserContext(browser_context))
|
|
|
|
->GetScore(origin);
|
2024-02-22 19:36:15 +01:00
|
|
|
@@ -359,8 +363,10 @@ ChromePermissionsClient::CreatePermissionUiSelectors(
|
2022-08-23 18:20:45 +02:00
|
|
|
std::make_unique<ContextualNotificationPermissionUiSelector>());
|
2023-09-15 21:51:43 +02:00
|
|
|
selectors.emplace_back(std::make_unique<PrefBasedQuietPermissionUiSelector>(
|
2022-08-23 18:20:45 +02:00
|
|
|
Profile::FromBrowserContext(browser_context)));
|
|
|
|
+ if (!cef::IsAlloyRuntimeEnabled()) {
|
|
|
|
selectors.emplace_back(std::make_unique<PredictionBasedPermissionUiSelector>(
|
|
|
|
Profile::FromBrowserContext(browser_context)));
|
|
|
|
+ }
|
|
|
|
return selectors;
|
|
|
|
}
|
|
|
|
|
2022-07-08 13:33:59 +02:00
|
|
|
diff --git chrome/browser/permissions/permission_manager_factory.cc chrome/browser/permissions/permission_manager_factory.cc
|
2024-03-19 22:11:42 +01:00
|
|
|
index c75f396997e17..b219e122ffb5c 100644
|
2022-07-08 13:33:59 +02:00
|
|
|
--- chrome/browser/permissions/permission_manager_factory.cc
|
|
|
|
+++ chrome/browser/permissions/permission_manager_factory.cc
|
|
|
|
@@ -6,6 +6,7 @@
|
|
|
|
|
|
|
|
#include "build/build_config.h"
|
|
|
|
#include "build/chromeos_buildflags.h"
|
|
|
|
+#include "cef/libcef/features/runtime.h"
|
|
|
|
#include "chrome/browser/background_fetch/background_fetch_permission_context.h"
|
|
|
|
#include "chrome/browser/background_sync/periodic_background_sync_permission_context.h"
|
|
|
|
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
2024-03-19 22:11:42 +01:00
|
|
|
@@ -62,9 +63,11 @@ permissions::PermissionManager::PermissionContextMap CreatePermissionContexts(
|
2022-07-08 13:33:59 +02:00
|
|
|
std::make_unique<GeolocationPermissionContextDelegate>(profile);
|
|
|
|
#endif // BUILDFLAG(IS_ANDROID)
|
2023-04-04 20:00:13 +02:00
|
|
|
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
|
2022-07-08 13:33:59 +02:00
|
|
|
+ if (!cef::IsAlloyRuntimeEnabled()) {
|
2024-03-19 22:11:42 +01:00
|
|
|
delegates.geolocation_system_permission_manager =
|
|
|
|
device::GeolocationSystemPermissionManager::GetInstance();
|
|
|
|
DCHECK(delegates.geolocation_system_permission_manager);
|
2022-07-08 13:33:59 +02:00
|
|
|
+ }
|
2023-04-04 20:00:13 +02:00
|
|
|
#endif
|
2022-07-08 13:33:59 +02:00
|
|
|
delegates.media_stream_device_enumerator =
|
|
|
|
MediaCaptureDevicesDispatcher::GetInstance();
|
2022-08-26 18:23:48 +02:00
|
|
|
diff --git chrome/browser/storage/durable_storage_permission_context.cc chrome/browser/storage/durable_storage_permission_context.cc
|
2023-09-15 21:51:43 +02:00
|
|
|
index 9934727f31a59..765b822241e4d 100644
|
2022-08-26 18:23:48 +02:00
|
|
|
--- chrome/browser/storage/durable_storage_permission_context.cc
|
|
|
|
+++ chrome/browser/storage/durable_storage_permission_context.cc
|
|
|
|
@@ -8,6 +8,7 @@
|
|
|
|
|
|
|
|
#include "base/check_op.h"
|
|
|
|
#include "base/containers/contains.h"
|
|
|
|
+#include "cef/libcef/features/runtime.h"
|
|
|
|
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
|
|
|
|
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
|
|
|
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
2023-09-15 21:51:43 +02:00
|
|
|
@@ -56,7 +57,10 @@ void DurableStoragePermissionContext::DecidePermission(
|
2022-08-26 18:23:48 +02:00
|
|
|
|
|
|
|
// Durable is only allowed to be granted to the top-level origin. Embedding
|
|
|
|
// origin is the last committed navigation origin to the web contents.
|
2023-09-15 21:51:43 +02:00
|
|
|
- if (request_data.requesting_origin != request_data.embedding_origin) {
|
2022-08-26 18:23:48 +02:00
|
|
|
+ // Permission depends on PWA and site engagement subsystems which are not
|
|
|
|
+ // supported by the Alloy runtime (see issue #3379).
|
2023-09-15 21:51:43 +02:00
|
|
|
+ if (cef::IsAlloyRuntimeEnabled() ||
|
|
|
|
+ request_data.requesting_origin != request_data.embedding_origin) {
|
|
|
|
NotifyPermissionSet(request_data.id, request_data.requesting_origin,
|
|
|
|
request_data.embedding_origin, std::move(callback),
|
|
|
|
/*persist=*/false, CONTENT_SETTING_DEFAULT,
|
2022-07-07 12:01:24 +02:00
|
|
|
diff --git chrome/browser/ui/permission_bubble/permission_prompt.h chrome/browser/ui/permission_bubble/permission_prompt.h
|
2022-09-26 21:30:45 +02:00
|
|
|
index fbce13c16ad10..0512b2f09937e 100644
|
2022-07-07 12:01:24 +02:00
|
|
|
--- chrome/browser/ui/permission_bubble/permission_prompt.h
|
|
|
|
+++ chrome/browser/ui/permission_bubble/permission_prompt.h
|
|
|
|
@@ -11,6 +11,13 @@ namespace content {
|
|
|
|
class WebContents;
|
|
|
|
}
|
|
|
|
|
|
|
|
+using CreatePermissionPromptFunctionPtr =
|
|
|
|
+ std::unique_ptr<permissions::PermissionPrompt> (*)(
|
|
|
|
+ content::WebContents* web_contents,
|
|
|
|
+ permissions::PermissionPrompt::Delegate* delegate,
|
|
|
|
+ bool* default_handling);
|
|
|
|
+void SetCreatePermissionPromptFunction(CreatePermissionPromptFunctionPtr);
|
|
|
|
+
|
|
|
|
// Factory function to create permission prompts for chrome.
|
|
|
|
std::unique_ptr<permissions::PermissionPrompt> CreatePermissionPrompt(
|
|
|
|
content::WebContents* web_contents,
|
2022-07-25 19:49:32 +02:00
|
|
|
diff --git chrome/browser/ui/views/permissions/permission_prompt_factory.cc chrome/browser/ui/views/permissions/permission_prompt_factory.cc
|
2024-02-22 19:36:15 +01:00
|
|
|
index 07720bc3faccb..546325f2b5558 100644
|
2022-07-25 19:49:32 +02:00
|
|
|
--- chrome/browser/ui/views/permissions/permission_prompt_factory.cc
|
|
|
|
+++ chrome/browser/ui/views/permissions/permission_prompt_factory.cc
|
2024-02-22 19:36:15 +01:00
|
|
|
@@ -186,11 +186,28 @@ std::unique_ptr<permissions::PermissionPrompt> CreateQuietPrompt(
|
2022-07-25 19:49:32 +02:00
|
|
|
}
|
2022-07-07 12:01:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+CreatePermissionPromptFunctionPtr g_create_permission_prompt_ptr = nullptr;
|
|
|
|
+
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
+void SetCreatePermissionPromptFunction(
|
|
|
|
+ CreatePermissionPromptFunctionPtr ptr) {
|
|
|
|
+ g_create_permission_prompt_ptr = ptr;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
std::unique_ptr<permissions::PermissionPrompt> CreatePermissionPrompt(
|
|
|
|
content::WebContents* web_contents,
|
|
|
|
permissions::PermissionPrompt::Delegate* delegate) {
|
|
|
|
+ if (g_create_permission_prompt_ptr) {
|
|
|
|
+ bool default_handling = true;
|
|
|
|
+ auto prompt = g_create_permission_prompt_ptr(web_contents, delegate,
|
|
|
|
+ &default_handling);
|
|
|
|
+ if (prompt)
|
|
|
|
+ return prompt;
|
|
|
|
+ if (!default_handling)
|
|
|
|
+ return nullptr;
|
|
|
|
+ }
|
|
|
|
+
|
2023-11-21 20:17:55 +01:00
|
|
|
Browser* browser = chrome::FindBrowserWithTab(web_contents);
|
2022-07-07 12:01:24 +02:00
|
|
|
if (!browser) {
|
|
|
|
DLOG(WARNING) << "Permission prompt suppressed because the WebContents is "
|
2022-07-08 13:33:59 +02:00
|
|
|
diff --git components/embedder_support/permission_context_utils.cc components/embedder_support/permission_context_utils.cc
|
2024-03-19 22:11:42 +01:00
|
|
|
index 9c0ec651d494f..e5c6126adeea7 100644
|
2022-07-08 13:33:59 +02:00
|
|
|
--- components/embedder_support/permission_context_utils.cc
|
|
|
|
+++ components/embedder_support/permission_context_utils.cc
|
|
|
|
@@ -5,6 +5,7 @@
|
|
|
|
#include "components/embedder_support/permission_context_utils.h"
|
|
|
|
|
|
|
|
#include "build/build_config.h"
|
|
|
|
+#include "cef/libcef/features/runtime.h"
|
|
|
|
#include "components/background_sync/background_sync_permission_context.h"
|
|
|
|
#include "components/permissions/contexts/accessibility_permission_context.h"
|
|
|
|
#include "components/permissions/contexts/camera_pan_tilt_zoom_permission_context.h"
|
2024-03-19 22:11:42 +01:00
|
|
|
@@ -79,10 +80,17 @@ CreateDefaultPermissionContexts(content::BrowserContext* browser_context,
|
2023-07-21 00:11:34 +02:00
|
|
|
std::move(delegates.geolocation_permission_context_delegate),
|
|
|
|
is_regular_profile);
|
2023-04-04 20:00:13 +02:00
|
|
|
#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
|
2022-07-08 13:33:59 +02:00
|
|
|
+ if (cef::IsAlloyRuntimeEnabled()) {
|
|
|
|
+ permission_contexts[ContentSettingsType::GEOLOCATION] =
|
|
|
|
+ std::make_unique<permissions::GeolocationPermissionContext>(
|
|
|
|
+ browser_context,
|
|
|
|
+ std::move(delegates.geolocation_permission_context_delegate));
|
|
|
|
+ } else {
|
|
|
|
permission_contexts[ContentSettingsType::GEOLOCATION] =
|
2023-04-04 20:00:13 +02:00
|
|
|
std::make_unique<permissions::GeolocationPermissionContextSystem>(
|
2022-07-08 13:33:59 +02:00
|
|
|
browser_context,
|
2024-01-26 03:12:43 +01:00
|
|
|
std::move(delegates.geolocation_permission_context_delegate));
|
2022-07-08 13:33:59 +02:00
|
|
|
+ }
|
|
|
|
#else
|
|
|
|
permission_contexts[ContentSettingsType::GEOLOCATION] =
|
|
|
|
std::make_unique<permissions::GeolocationPermissionContext>(
|