Skip to content

Commit

Permalink
File handling: Hide controls on Chrome OS settings page
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit d6facfb)

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-Original-Commit-Position: refs/heads/main@{#1008022}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3681458
Commit-Queue: Dominick Ng <dominickn@chromium.org>
Auto-Submit: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/branch-heads/5060@{#437}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
Evan Stade authored and Chromium LUCI CQ committed May 31, 2022
1 parent df42301 commit d53547b
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ const char* kAppIdsWithHiddenPinToShelf[] = {
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[] = {
Expand Down Expand Up @@ -443,15 +441,16 @@ app_management::mojom::AppPtr AppManagementPageHandler::CreateUIAppPtr(
std::move(run_on_os_login.value()));
}

if (update.AppType() == apps::AppType::kWeb) {
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)
if (update.AppType() == apps::AppType::kWeb) {
auto* provider =
web_app::WebAppProvider::GetForLocalAppsUnchecked(profile_);
const bool fh_enabled =
fh_enabled =
!provider->registrar().IsAppFileHandlerPermissionBlocked(app->id);
std::string file_handling_types;
std::string file_handling_types_label;
if (provider->os_integration_manager().IsFileHandlingAPIAvailable(
app->id) &&
!provider->registrar().IsSystemApp(app->id) &&
Expand All @@ -478,17 +477,18 @@ app_management::mojom::AppPtr AppManagementPageHandler::CreateUIAppPtr(
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);
// TODO(crbug/1252505): add file handling policy support.
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();

Expand Down

0 comments on commit d53547b

Please sign in to comment.