mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-11 09:08:06 +01:00
230 lines
10 KiB
Diff
230 lines
10 KiB
Diff
diff --git chrome/browser/background_fetch/background_fetch_permission_context.cc chrome/browser/background_fetch/background_fetch_permission_context.cc
|
|
index fbc2dccbeb46d..9eea3a3c5c64c 100644
|
|
--- 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"
|
|
@@ -25,7 +26,11 @@ ContentSetting BackgroundFetchPermissionContext::GetPermissionStatusInternal(
|
|
const GURL& embedding_origin) const {
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
|
- if (render_frame_host && !render_frame_host->GetParent()) {
|
|
+ if (
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ !cef::IsAlloyRuntimeEnabled() &&
|
|
+#endif
|
|
+ render_frame_host && !render_frame_host->GetParent()) {
|
|
DownloadRequestLimiter* limiter =
|
|
g_browser_process->download_request_limiter();
|
|
DCHECK(limiter);
|
|
diff --git chrome/browser/background_sync/periodic_background_sync_permission_context.cc chrome/browser/background_sync/periodic_background_sync_permission_context.cc
|
|
index c45e337c0c746..948cbbc9e3d7a 100644
|
|
--- 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/profiles/profile.h"
|
|
#include "chrome/browser/search_engines/template_url_service_factory.h"
|
|
@@ -89,6 +90,12 @@ PeriodicBackgroundSyncPermissionContext::GetPermissionStatusInternal(
|
|
return CONTENT_SETTING_ALLOW;
|
|
#endif
|
|
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ if (cef::IsAlloyRuntimeEnabled()) {
|
|
+ return CONTENT_SETTING_BLOCK;
|
|
+ }
|
|
+#endif
|
|
+
|
|
bool can_bypass_install_requirement =
|
|
base::FeatureList::IsEnabled(
|
|
features::kPeriodicSyncPermissionForDefaultSearchEngine) &&
|
|
diff --git chrome/browser/permissions/chrome_permissions_client.cc chrome/browser/permissions/chrome_permissions_client.cc
|
|
index 1123ef8c5aa52..51f42541b3d7b 100644
|
|
--- chrome/browser/permissions/chrome_permissions_client.cc
|
|
+++ chrome/browser/permissions/chrome_permissions_client.cc
|
|
@@ -15,6 +15,7 @@
|
|
#include "base/time/time.h"
|
|
#include "build/build_config.h"
|
|
#include "build/chromeos_buildflags.h"
|
|
+#include "cef/libcef/features/runtime.h"
|
|
#include "chrome/browser/ash/shimless_rma/chrome_shimless_rma_delegate.h"
|
|
#include "chrome/browser/bluetooth/bluetooth_chooser_context_factory.h"
|
|
#include "chrome/browser/browser_process.h"
|
|
@@ -199,6 +200,11 @@ ChromePermissionsClient::GetPermissionDecisionAutoBlocker(
|
|
double ChromePermissionsClient::GetSiteEngagementScore(
|
|
content::BrowserContext* browser_context,
|
|
const GURL& origin) {
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ // No SiteEngagementService with the Alloy runtime.
|
|
+ if (cef::IsAlloyRuntimeEnabled())
|
|
+ return 0.0;
|
|
+#endif
|
|
return site_engagement::SiteEngagementService::Get(
|
|
Profile::FromBrowserContext(browser_context))
|
|
->GetScore(origin);
|
|
@@ -369,8 +375,14 @@ ChromePermissionsClient::CreatePermissionUiSelectors(
|
|
std::make_unique<ContextualNotificationPermissionUiSelector>());
|
|
selectors.emplace_back(std::make_unique<PrefBasedQuietPermissionUiSelector>(
|
|
Profile::FromBrowserContext(browser_context)));
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ if (!cef::IsAlloyRuntimeEnabled()) {
|
|
+#endif
|
|
selectors.emplace_back(std::make_unique<PredictionBasedPermissionUiSelector>(
|
|
Profile::FromBrowserContext(browser_context)));
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ }
|
|
+#endif
|
|
return selectors;
|
|
}
|
|
|
|
diff --git chrome/browser/permissions/permission_manager_factory.cc chrome/browser/permissions/permission_manager_factory.cc
|
|
index 8cadbddb47767..879ed1cab0558 100644
|
|
--- 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"
|
|
@@ -68,9 +69,15 @@ permissions::PermissionManager::PermissionContextMap CreatePermissionContexts(
|
|
std::make_unique<GeolocationPermissionContextDelegate>(profile);
|
|
#endif // BUILDFLAG(IS_ANDROID)
|
|
#if BUILDFLAG(OS_LEVEL_GEOLOCATION_PERMISSION_SUPPORTED)
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ if (!cef::IsAlloyRuntimeEnabled()) {
|
|
+#endif
|
|
delegates.geolocation_system_permission_manager =
|
|
device::GeolocationSystemPermissionManager::GetInstance();
|
|
DCHECK(delegates.geolocation_system_permission_manager);
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ }
|
|
+#endif
|
|
#endif
|
|
delegates.media_stream_device_enumerator =
|
|
MediaCaptureDevicesDispatcher::GetInstance();
|
|
diff --git chrome/browser/storage/durable_storage_permission_context.cc chrome/browser/storage/durable_storage_permission_context.cc
|
|
index 9934727f31a59..9ab13938d39c2 100644
|
|
--- 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"
|
|
@@ -56,7 +57,13 @@ void DurableStoragePermissionContext::DecidePermission(
|
|
|
|
// Durable is only allowed to be granted to the top-level origin. Embedding
|
|
// origin is the last committed navigation origin to the web contents.
|
|
- if (request_data.requesting_origin != request_data.embedding_origin) {
|
|
+ // Permission depends on PWA and site engagement subsystems which are not
|
|
+ // supported by the Alloy runtime (see issue #3379).
|
|
+ if (
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ cef::IsAlloyRuntimeEnabled() ||
|
|
+#endif
|
|
+ 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,
|
|
diff --git chrome/browser/ui/permission_bubble/permission_prompt.h chrome/browser/ui/permission_bubble/permission_prompt.h
|
|
index fbce13c16ad10..0512b2f09937e 100644
|
|
--- 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,
|
|
diff --git chrome/browser/ui/views/permissions/permission_prompt_factory.cc chrome/browser/ui/views/permissions/permission_prompt_factory.cc
|
|
index 7f976b5bc5c44..ee2faa5c297a7 100644
|
|
--- chrome/browser/ui/views/permissions/permission_prompt_factory.cc
|
|
+++ chrome/browser/ui/views/permissions/permission_prompt_factory.cc
|
|
@@ -222,11 +222,28 @@ std::unique_ptr<permissions::PermissionPrompt> CreateQuietPrompt(
|
|
}
|
|
}
|
|
|
|
+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;
|
|
+ }
|
|
+
|
|
Browser* browser = chrome::FindBrowserWithTab(web_contents);
|
|
if (!browser) {
|
|
DLOG(WARNING) << "Permission prompt suppressed because the WebContents is "
|
|
diff --git components/embedder_support/permission_context_utils.cc components/embedder_support/permission_context_utils.cc
|
|
index 063b8e6c0747d..0b7deda8a97b3 100644
|
|
--- 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"
|
|
@@ -79,10 +80,21 @@ CreateDefaultPermissionContexts(content::BrowserContext* browser_context,
|
|
std::move(delegates.geolocation_permission_context_delegate),
|
|
is_regular_profile);
|
|
#elif BUILDFLAG(OS_LEVEL_GEOLOCATION_PERMISSION_SUPPORTED)
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ if (cef::IsAlloyRuntimeEnabled()) {
|
|
+ permission_contexts[ContentSettingsType::GEOLOCATION] =
|
|
+ std::make_unique<permissions::GeolocationPermissionContext>(
|
|
+ browser_context,
|
|
+ std::move(delegates.geolocation_permission_context_delegate));
|
|
+ } else {
|
|
+#endif
|
|
permission_contexts[ContentSettingsType::GEOLOCATION] =
|
|
std::make_unique<permissions::GeolocationPermissionContextSystem>(
|
|
browser_context,
|
|
std::move(delegates.geolocation_permission_context_delegate));
|
|
+#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP)
|
|
+ }
|
|
+#endif
|
|
#else
|
|
permission_contexts[ContentSettingsType::GEOLOCATION] =
|
|
std::make_unique<permissions::GeolocationPermissionContext>(
|