File handling: Hide controls on Chrome OS settings page
The controls were shown by default when the file handling
state wasn't passed to the page.
With Ash, the controls were simply non-functional. With
Lacros, trying to toggle the setting would lead to a crash.
Bug: 1329150
Change-Id: Ic9010134226b31b32aa3d9ed22d4e949cfe06cc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3668766
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Nancy Wang <nancylingwang@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1008022}
diff --git a/chrome/browser/ui/webui/app_management/app_management_page_handler.cc b/chrome/browser/ui/webui/app_management/app_management_page_handler.cc
index 2f36872..33bc72f 100644
--- a/chrome/browser/ui/webui/app_management/app_management_page_handler.cc
+++ b/chrome/browser/ui/webui/app_management/app_management_page_handler.cc
@@ -68,10 +68,8 @@
app_constants::kLacrosAppId,
};
-#if !BUILDFLAG(IS_CHROMEOS)
const char kFileHandlingLearnMore[] =
"https://support.google.com/chrome/?p=pwa_default_associations";
-#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
constexpr char const* kAppIdsWithHiddenStoragePermission[] = {
@@ -443,15 +441,16 @@
std::move(run_on_os_login.value()));
}
-// Speculative fix for crbug.com/1315958
-#if !BUILDFLAG(IS_CHROMEOS)
if (update.AppType() == apps::AppType::kWeb) {
- auto* provider =
- web_app::WebAppProvider::GetForLocalAppsUnchecked(profile_);
- const bool fh_enabled =
- !provider->registrar().IsAppFileHandlerPermissionBlocked(app->id);
std::string file_handling_types;
std::string file_handling_types_label;
+ bool fh_enabled = false;
+// Speculative fix for crbug.com/1315958
+#if !BUILDFLAG(IS_CHROMEOS)
+ auto* provider =
+ web_app::WebAppProvider::GetForLocalAppsUnchecked(profile_);
+ fh_enabled =
+ !provider->registrar().IsAppFileHandlerPermissionBlocked(app->id);
if (provider->os_integration_manager().IsFileHandlingAPIAvailable(
app->id) &&
!provider->registrar().IsSystemApp(app->id) &&
@@ -478,6 +477,10 @@
static_cast<int>(truncated_extensions.size()),
"LINK", "#"));
}
+
+ app->hide_window_mode = provider->registrar().IsIsolated(app->id);
+#endif
+
absl::optional<GURL> learn_more_url;
if (!CanShowDefaultAppAssociationsUi())
learn_more_url = GURL(kFileHandlingLearnMore);
@@ -485,10 +488,7 @@
app->file_handling_state = app_management::mojom::FileHandlingState::New(
fh_enabled, /*is_managed=*/false, file_handling_types,
file_handling_types_label, learn_more_url);
-
- app->hide_window_mode = provider->registrar().IsIsolated(app->id);
}
-#endif
app->publisher_id = update.PublisherId();