Index: chrome/browser/ui/ash/launcher/launcher_context_menu.cc |
diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc |
index 4369c3dd2fbe72dfbca897310bd7db0dfc84020a..eb7322b0d71f19706b3dd043a19064fc46de4f8c 100644 |
--- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc |
+++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc |
@@ -146,6 +146,7 @@ void LauncherContextMenu::Init() { |
AddItem( |
MENU_PIN, |
l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_PIN)); |
+ AddItem(MENU_INSTALL, l10n_util::GetStringUTF16(IDS_APP_INSTALL_TITLE)); |
} |
if (controller_->IsOpen(item_.id)) { |
AddItem(MENU_CLOSE, |
@@ -260,6 +261,21 @@ bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const { |
} |
} |
+bool LauncherContextMenu::IsCommandIdVisible(int command_id) const { |
+ if (item_.type != ash::TYPE_PLATFORM_APP) |
+ return true; |
+ |
+ switch (command_id) { |
+ case MENU_PIN: |
+ return controller_->IsPinnable(item_.id) && |
+ !controller_->CanInstall(item_.id); |
+ case MENU_INSTALL: |
+ return controller_->CanInstall(item_.id); |
+ default: |
+ return true; |
+ } |
+} |
+ |
bool LauncherContextMenu::GetAcceleratorForCommandId( |
int command_id, |
ui::Accelerator* accelerator) { |
@@ -285,6 +301,9 @@ void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { |
case MENU_PIN: |
controller_->TogglePinned(item_.id); |
break; |
+ case MENU_INSTALL: |
+ controller_->Install(item_.id); |
+ break; |
case LAUNCH_TYPE_PINNED_TAB: |
controller_->SetLaunchType(item_.id, extensions::LAUNCH_TYPE_PINNED); |
break; |