2022-07-07 12:01:24 +02:00
|
|
|
diff --git chrome/browser/permissions/chrome_permissions_client.cc chrome/browser/permissions/chrome_permissions_client.cc
|
2022-08-23 18:20:45 +02:00
|
|
|
index 994b78d94de26..e51f6f6162f02 100644
|
2022-07-07 12:01:24 +02:00
|
|
|
--- chrome/browser/permissions/chrome_permissions_client.cc
|
|
|
|
+++ chrome/browser/permissions/chrome_permissions_client.cc
|
|
|
|
@@ -12,6 +12,7 @@
|
|
|
|
#include "base/strings/string_util.h"
|
|
|
|
#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"
|
|
|
|
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
|
|
|
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
|
2022-08-23 03:37:40 +02:00
|
|
|
@@ -210,6 +211,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);
|
2022-08-23 18:20:45 +02:00
|
|
|
@@ -300,8 +304,10 @@ ChromePermissionsClient::CreatePermissionUiSelectors(
|
|
|
|
std::make_unique<ContextualNotificationPermissionUiSelector>());
|
|
|
|
selectors.emplace_back(std::make_unique<PrefNotificationPermissionUiSelector>(
|
|
|
|
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
|
2022-08-23 03:37:40 +02:00
|
|
|
index 5efee36a48397..bb683b88c5bd6 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"
|
2022-08-23 03:37:40 +02:00
|
|
|
@@ -59,8 +60,10 @@ permissions::PermissionManager::PermissionContextMap CreatePermissionContexts(
|
2022-07-08 13:33:59 +02:00
|
|
|
std::make_unique<GeolocationPermissionContextDelegate>(profile);
|
|
|
|
#endif // BUILDFLAG(IS_ANDROID)
|
|
|
|
#if BUILDFLAG(IS_MAC)
|
|
|
|
+ if (!cef::IsAlloyRuntimeEnabled()) {
|
|
|
|
delegates.geolocation_manager =
|
|
|
|
g_browser_process->platform_part()->geolocation_manager();
|
|
|
|
+ }
|
|
|
|
#endif // BUILDFLAG(IS_MAC)
|
|
|
|
delegates.media_stream_device_enumerator =
|
|
|
|
MediaCaptureDevicesDispatcher::GetInstance();
|
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
|
|
|
|
index c2836d15eba30..0c03c2b4666a6 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,
|
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
|
|
|
|
index eff04a21a7109..daefe93035789 100644
|
|
|
|
--- chrome/browser/ui/views/permissions/permission_prompt_factory.cc
|
|
|
|
+++ chrome/browser/ui/views/permissions/permission_prompt_factory.cc
|
|
|
|
@@ -141,11 +141,28 @@ std::unique_ptr<permissions::PermissionPrompt> CreateQuietPrompt(
|
|
|
|
}
|
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;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
|
|
|
|
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
|
|
|
|
index 75b22de5422b4..9235a20da7812 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"
|
|
|
|
@@ -78,11 +79,18 @@ CreateDefaultPermissionContexts(content::BrowserContext* browser_context,
|
|
|
|
browser_context,
|
|
|
|
std::move(delegates.geolocation_permission_context_delegate));
|
|
|
|
#elif BUILDFLAG(IS_MAC)
|
|
|
|
+ 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] =
|
|
|
|
std::make_unique<permissions::GeolocationPermissionContextMac>(
|
|
|
|
browser_context,
|
|
|
|
std::move(delegates.geolocation_permission_context_delegate),
|
|
|
|
delegates.geolocation_manager);
|
|
|
|
+ }
|
|
|
|
#else
|
|
|
|
permission_contexts[ContentSettingsType::GEOLOCATION] =
|
|
|
|
std::make_unique<permissions::GeolocationPermissionContext>(
|