Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3520)

Unified Diff: chrome/browser/ui/ash/launcher/arc_launcher_context_menu.cc

Issue 2257923002: arc: Handle non-launchable apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/launcher/arc_launcher_context_menu.cc
diff --git a/chrome/browser/ui/ash/launcher/arc_launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/arc_launcher_context_menu.cc
index 8081f871f24ca08139d2d3da57a07210b5b07fbb..d4ceb30af105d0ff6520b07650b389eecf53f879 100644
--- a/chrome/browser/ui/ash/launcher/arc_launcher_context_menu.cc
+++ b/chrome/browser/ui/ash/launcher/arc_launcher_context_menu.cc
@@ -5,6 +5,8 @@
#include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h"
#include "ash/common/shelf/shelf_item_types.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
#include "chrome/grit/generated_resources.h"
@@ -19,12 +21,28 @@ ArcLauncherContextMenu::ArcLauncherContextMenu(
ArcLauncherContextMenu::~ArcLauncherContextMenu() {}
void ArcLauncherContextMenu::Init() {
+ const ArcAppListPrefs* arc_list_prefs =
+ ArcAppListPrefs::Get(controller()->GetProfile());
+ DCHECK(arc_list_prefs);
+
+ const std::string app_id = controller()->GetAppIDForShelfID(item().id);
+ std::unique_ptr<ArcAppListPrefs::AppInfo> app_info =
+ arc_list_prefs->GetApp(app_id);
+ if (!app_info) {
+ NOTREACHED();
+ return;
+ }
+
const bool app_is_open = controller()->IsOpen(item().id);
if (!app_is_open) {
+ DCHECK(app_info->launchable);
AddItemWithStringId(MENU_OPEN_NEW, IDS_APP_CONTEXT_MENU_ACTIVATE_ARC);
AddSeparator(ui::NORMAL_SEPARATOR);
}
- AddPinMenu();
+
+ if (app_info->launchable)
+ AddPinMenu();
+
if (app_is_open)
AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE);
AddSeparator(ui::NORMAL_SEPARATOR);

Powered by Google App Engine
This is Rietveld 408576698