alloy: Remove optimization/prediction service usage (see issue #3352)

This service is required by the "PermissionOnDeviceNotificationPredictions"
feature which is enabled by default in https://crbug.com/1350956. It uses a
Google backend service as described at https://go.dev/solutions/google/chrome.

This change removes the usage of PredictionBasedPermissionUiSelector, which
triggered this dependency, along with related startup complexity that was added
to support the optimization/prediction service in the M106 update.
This commit is contained in:
Marshall Greenblatt
2022-08-23 12:20:45 -04:00
parent 7659dd60ba
commit 5dc69c6cdb
16 changed files with 29 additions and 135 deletions

View File

@@ -256,14 +256,6 @@ patches = [
# https://bitbucket.org/chromiumembedded/cef/issues/2830
'name': 'chrome_browser_net_proxy',
},
{
# alloy: Don't create an optimization model downloads directory when
# cache_path is empty. This is related to Chrome permissions and the
# "PermissionOnDeviceNotificationPredictions" feature which is enabled by
# default in https://crbug.com/1350956.
# https://bitbucket.org/chromiumembedded/cef/issues/3352
'name': 'chrome_browser_optimization_guide',
},
{
# Support override of CreatePermissionPrompt.
# https://bitbucket.org/chromiumembedded/cef/issues/3352

View File

@@ -1,22 +0,0 @@
diff --git chrome/browser/optimization_guide/optimization_guide_keyed_service.cc chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
index bd928f4422f99..f0124ab225b6f 100644
--- chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
+++ chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
@@ -269,7 +269,7 @@ void OptimizationGuideKeyedService::Initialize() {
MaybeCreatePushNotificationManager(profile),
optimization_guide_logger_.get());
base::FilePath model_downloads_dir;
- if (!profile->IsOffTheRecord()) {
+ if (!profile->IsOffTheRecord() && !profile_path.empty()) {
// Do not explicitly hand off the model downloads directory to
// off-the-record profiles. Underneath the hood, this variable is only used
// in non off-the-record profiles to know where to download the model files
@@ -281,7 +281,7 @@ void OptimizationGuideKeyedService::Initialize() {
prediction_manager_ = std::make_unique<optimization_guide::PredictionManager>(
prediction_model_and_features_store, url_loader_factory,
- profile->GetPrefs(), profile->IsOffTheRecord(),
+ profile->GetPrefs(), /*is_off_the_record=*/model_downloads_dir.empty(),
g_browser_process->GetApplicationLocale(), model_downloads_dir,
optimization_guide_logger_.get(),
base::BindOnce(

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/permissions/chrome_permissions_client.cc chrome/browser/permissions/chrome_permissions_client.cc
index 994b78d94de26..b64c1a7506a23 100644
index 994b78d94de26..e51f6f6162f02 100644
--- chrome/browser/permissions/chrome_permissions_client.cc
+++ chrome/browser/permissions/chrome_permissions_client.cc
@@ -12,6 +12,7 @@
@@ -20,6 +20,17 @@ index 994b78d94de26..b64c1a7506a23 100644
return site_engagement::SiteEngagementService::Get(
Profile::FromBrowserContext(browser_context))
->GetScore(origin);
@@ -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;
}
diff --git chrome/browser/permissions/permission_manager_factory.cc chrome/browser/permissions/permission_manager_factory.cc
index 5efee36a48397..bb683b88c5bd6 100644
--- chrome/browser/permissions/permission_manager_factory.cc