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

Unified Diff: chrome/browser/ui/app_list/app_context_menu.cc

Issue 836673003: Fixed "Open in a Tab" option for apps in Chrome App Launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rewrote CL Created 5 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/app_context_menu.cc
diff --git a/chrome/browser/ui/app_list/app_context_menu.cc b/chrome/browser/ui/app_list/app_context_menu.cc
index 43d3717688f34e56669e452f8c5a071241a65478..0d0dd28dd91842e9b67aefdfe8c15b8990538e96 100644
--- a/chrome/browser/ui/app_list/app_context_menu.cc
+++ b/chrome/browser/ui/app_list/app_context_menu.cc
@@ -181,24 +181,38 @@ bool AppContextMenu::IsItemForCommandIdDynamic(int command_id) const {
}
base::string16 AppContextMenu::GetLabelForCommandId(int command_id) const {
- if (command_id == TOGGLE_PIN) {
- return controller_->IsAppPinned(app_id_) ?
- l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_UNPIN) :
- l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_PIN);
- } else if (command_id == LAUNCH_NEW) {
+ // If streamlined hosted apps are enabled, then we do not need to consider
+ // the case when command_id == TOGGLE_PIN (see AppContextMenu::GetMenuModel).
+ if (extensions::util::IsStreamlinedHostedAppsEnabled()) {
+ if (command_id == LAUNCH_NEW) {
tapted 2015/01/05 23:10:32 nit: instead of the if/else-NOTREACHED, you can ju
mitchellj 2015/01/06 01:41:14 Done.
+ return IsCommandIdChecked(USE_LAUNCH_TYPE_REGULAR) ?
+ l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_TAB) :
+ l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_WINDOW);
+ } else {
+ NOTREACHED();
+ return base::string16();
+ }
+ } else {
tapted 2015/01/05 23:10:32 "Don't use else after return" : http://www.chromiu
mitchellj 2015/01/06 01:41:14 Done.
+ if (command_id == TOGGLE_PIN) {
+ return controller_->IsAppPinned(app_id_) ?
+ l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_UNPIN) :
+ l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_PIN);
+ } else if (command_id == LAUNCH_NEW) {
#if defined(OS_MACOSX)
- // Even fullscreen windows launch in a browser tab on Mac.
- const bool launches_in_tab = true;
+ // Even fullscreen windows launch in a browser tab on Mac.
+ const bool launches_in_tab = true;
#else
- const bool launches_in_tab = IsCommandIdChecked(USE_LAUNCH_TYPE_PINNED) ||
- IsCommandIdChecked(USE_LAUNCH_TYPE_REGULAR);
+ const bool launches_in_tab =
+ IsCommandIdChecked(USE_LAUNCH_TYPE_PINNED) ||
+ IsCommandIdChecked(USE_LAUNCH_TYPE_REGULAR);
#endif
- return launches_in_tab ?
- l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_TAB) :
- l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_WINDOW);
- } else {
- NOTREACHED();
- return base::string16();
+ return launches_in_tab ?
+ l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_TAB) :
+ l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_WINDOW);
+ } else {
+ NOTREACHED();
+ return base::string16();
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698