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

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

Issue 2518423003: Combine shelf platform and windowed app types. (Closed)
Patch Set: Update platform-app test support; address comment; format. Created 4 years, 1 month 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/extension_launcher_context_menu.cc
diff --git a/chrome/browser/ui/ash/launcher/extension_launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/extension_launcher_context_menu.cc
index 38cd811160c05302bd05e9cf1447cc6f610b893c..4d2553031f4b9f9e7059c3fd311401451f157544 100644
--- a/chrome/browser/ui/ash/launcher/extension_launcher_context_menu.cc
+++ b/chrome/browser/ui/ash/launcher/extension_launcher_context_menu.cc
@@ -41,19 +41,23 @@ void ExtensionLauncherContextMenu::Init() {
extension_items_.reset(new extensions::ContextMenuMatcher(
controller()->profile(), this, this,
base::Bind(MenuItemHasLauncherContext)));
- if (item().type == ash::TYPE_APP_SHORTCUT ||
- item().type == ash::TYPE_WINDOWED_APP) {
+ if (item().type == ash::TYPE_APP_SHORTCUT || item().type == ash::TYPE_APP) {
// V1 apps can be started from the menu - but V2 apps should not.
if (!controller()->IsPlatformApp(item().id)) {
AddItem(MENU_OPEN_NEW, base::string16());
AddSeparator(ui::NORMAL_SEPARATOR);
}
+
AddPinMenu();
- if (controller()->IsOpen(item().id))
+
+ if (controller()->IsOpen(item().id) &&
+ !extension_misc::IsImeMenuExtensionId(
James Cook 2016/11/28 22:57:48 Likewise, I wonder if this code is still used. Not
msw 2016/11/28 23:47:41 +azurewei@ for thoughts and/or followup.
+ controller()->GetAppIDForShelfID(item().id))) {
AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE);
+ }
if (!controller()->IsPlatformApp(item().id) &&
- item().type != ash::TYPE_WINDOWED_APP) {
+ item().type == ash::TYPE_APP_SHORTCUT) {
AddSeparator(ui::NORMAL_SEPARATOR);
if (extensions::util::IsNewBookmarkAppsEnabled()) {
// With bookmark apps enabled, hosted apps launch in a window by
@@ -89,21 +93,14 @@ void ExtensionLauncherContextMenu::Init() {
} else if (item().type == ash::TYPE_DIALOG) {
AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE);
} else {
- if (item().type == ash::TYPE_PLATFORM_APP)
- AddPinMenu();
- bool show_close_button = controller()->IsOpen(item().id);
- if (extension_misc::IsImeMenuExtensionId(
+ if (controller()->IsOpen(item().id) &&
+ !extension_misc::IsImeMenuExtensionId(
controller()->GetAppIDForShelfID(item().id))) {
- show_close_button = false;
- }
-
- if (show_close_button)
AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE);
+ }
}
AddSeparator(ui::NORMAL_SEPARATOR);
- if (item().type == ash::TYPE_APP_SHORTCUT ||
- item().type == ash::TYPE_WINDOWED_APP ||
- item().type == ash::TYPE_PLATFORM_APP) {
+ if (item().type == ash::TYPE_APP_SHORTCUT || item().type == ash::TYPE_APP) {
const extensions::MenuItem::ExtensionKey app_key(
controller()->GetAppIDForShelfID(item().id));
if (!app_key.empty()) {
@@ -124,7 +121,7 @@ bool ExtensionLauncherContextMenu::IsItemForCommandIdDynamic(
base::string16 ExtensionLauncherContextMenu::GetLabelForCommandId(
int command_id) const {
if (command_id == MENU_OPEN_NEW) {
- if (item().type == ash::TYPE_PLATFORM_APP)
+ if (controller()->IsPlatformApp(item().id))
return l10n_util::GetStringUTF16(IDS_APP_LIST_CONTEXT_MENU_NEW_WINDOW);
switch (controller()->GetLaunchType(item().id)) {
case extensions::LAUNCH_TYPE_PINNED:

Powered by Google App Engine
This is Rietveld 408576698