Commit 99344eed authored by nancy's avatar nancy Committed by Commit Bot

Add ExtensionShelfContextMenu back to handle extensions.

BUG=1038487

Change-Id: Ib7aa3b9795dc037577086e9d4199b24cdb805a6c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032698Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737985}
parent 5a5160b3
......@@ -83,6 +83,15 @@ AppServiceShelfContextMenu::AppServiceShelfContextMenu(
apps::AppServiceProxyFactory::GetForProfile(controller->profile());
DCHECK(proxy);
if (base::StartsWith(item->id.app_id, crostini::kCrostiniAppIdPrefix,
base::CompareCase::SENSITIVE)) {
// For Crostini app_id with the prefix "crostini:", set app_type as Unknown
// to skip the ArcAppShelfId valid. App type can't be set as Crostini,
// because the pin item should not be added for it.
app_type_ = apps::mojom::AppType::kUnknown;
return;
}
// Remove the ARC shelf group Prefix.
const arc::ArcAppShelfId arc_shelf_id =
arc::ArcAppShelfId::FromString(item->id.app_id);
......
......@@ -55,8 +55,24 @@ std::unique_ptr<ShelfContextMenu> ShelfContextMenu::Create(
DCHECK(!item->id.IsNull());
if (base::FeatureList::IsEnabled(features::kAppServiceContextMenu)) {
return std::make_unique<AppServiceShelfContextMenu>(controller, item,
display_id);
apps::AppServiceProxy* proxy =
apps::AppServiceProxyFactory::GetForProfile(controller->profile());
// AppServiceShelfContextMenu supports context menus for apps registered in
// AppService, Arc shortcuts and Crostini apps with the prefix "crostini:".
if (proxy &&
(proxy->AppRegistryCache().GetAppType(item->id.app_id) !=
apps::mojom::AppType::kUnknown ||
base::StartsWith(item->id.app_id, crostini::kCrostiniAppIdPrefix,
base::CompareCase::SENSITIVE) ||
arc::IsArcItem(controller->profile(), item->id.app_id))) {
return std::make_unique<AppServiceShelfContextMenu>(controller, item,
display_id);
}
// Create an ExtensionShelfContextMenu for other items.
return std::make_unique<ExtensionShelfContextMenu>(controller, item,
display_id);
}
// Create an ArcShelfContextMenu if the item is an ARC app.
......
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