Commit b49f750a authored by Rahul Singh (EDGE)'s avatar Rahul Singh (EDGE) Committed by Commit Bot

DPWA: RegisterShortcutsMenuWithOs() only when WebApplicationInfo's

shortcut_infos() is populated.

This fixes an issue where we were calling RegisterShortcutsMenuWithOs()
even when shortcuts weren't provided in the PWA's web app manifest.

Bug: 1113324
Change-Id: Ib3965ee85643c12f29dbebf67db2f3862bba57e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339704Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
Commit-Queue: Rahul Singh <rahsin@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#796131}
parent 6622916f
...@@ -215,14 +215,19 @@ void OsIntegrationManager::OnShortcutsCreated( ...@@ -215,14 +215,19 @@ void OsIntegrationManager::OnShortcutsCreated(
ui_manager_->CanAddAppToQuickLaunchBar()) { ui_manager_->CanAddAppToQuickLaunchBar()) {
ui_manager_->AddAppToQuickLaunchBar(app_id); ui_manager_->AddAppToQuickLaunchBar(app_id);
} }
if (shortcuts_created) { if (shortcuts_created && base::FeatureList::IsEnabled(
features::kDesktopPWAsAppIconShortcutsMenu)) {
if (web_app_info) { if (web_app_info) {
shortcut_manager_->RegisterShortcutsMenuWithOs( if (web_app_info->shortcut_infos.empty()) {
app_id, web_app_info->shortcut_infos, barrier_callback.Run(OsHookType::kShortcutsMenu, /*completed=*/false);
web_app_info->shortcuts_menu_icons_bitmaps); } else {
// TODO(https://crbug.com/1098471): fix RegisterShortcutsMenuWithOs to shortcut_manager_->RegisterShortcutsMenuWithOs(
// take callback. app_id, web_app_info->shortcut_infos,
barrier_callback.Run(OsHookType::kShortcutsMenu, /*completed=*/true); web_app_info->shortcuts_menu_icons_bitmaps);
// TODO(https://crbug.com/1098471): fix RegisterShortcutsMenuWithOs to
// take callback.
barrier_callback.Run(OsHookType::kShortcutsMenu, /*completed=*/true);
}
} else { } else {
shortcut_manager_->ReadAllShortcutsMenuIconsAndRegisterShortcutsMenu( shortcut_manager_->ReadAllShortcutsMenuIconsAndRegisterShortcutsMenu(
app_id, base::BindOnce(barrier_callback, OsHookType::kShortcutsMenu)); app_id, base::BindOnce(barrier_callback, OsHookType::kShortcutsMenu));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment