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

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

Issue 298303002: Add option to install an ephemeral app to ChromeOS shelf context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed asargent's review comments Created 6 years, 7 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
« no previous file with comments | « chrome/browser/ui/ash/launcher/launcher_context_menu.h ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c63743be5cf91e8b3c93da15079b1c47a6ef1c54 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,20 @@ 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_->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 +300,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;
« no previous file with comments | « chrome/browser/ui/ash/launcher/launcher_context_menu.h ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698