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

Side by Side Diff: chrome/browser/ui/ash/launcher/launcher_context_menu.cc

Issue 12288012: Showing launcher items for windowed v1 apps - pinned or not. Also - don't show windowed v1 apps in … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing build breakage with clang Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" 5 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/desktop_background/user_wallpaper_delegate.h" 9 #include "ash/desktop_background/user_wallpaper_delegate.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 Init(); 60 Init();
61 } 61 }
62 62
63 void LauncherContextMenu::Init() { 63 void LauncherContextMenu::Init() {
64 extension_items_.reset(new extensions::ContextMenuMatcher( 64 extension_items_.reset(new extensions::ContextMenuMatcher(
65 controller_->profile(), this, this, 65 controller_->profile(), this, this,
66 base::Bind(MenuItemHasLauncherContext))); 66 base::Bind(MenuItemHasLauncherContext)));
67 set_delegate(this); 67 set_delegate(this);
68 68
69 if (is_valid_item()) { 69 if (is_valid_item()) {
70 if (item_.type == ash::TYPE_APP_SHORTCUT) { 70 if (item_.type == ash::TYPE_APP_SHORTCUT ||
71 DCHECK(controller_->IsPinned(item_.id)); 71 item_.type == ash::TYPE_WINDOWED_APP) {
72 DCHECK(item_.type == ash::TYPE_APP_SHORTCUT &&
73 controller_->IsPinned(item_.id));
72 // V1 apps can be started from the menu - but V2 apps should not. 74 // V1 apps can be started from the menu - but V2 apps should not.
73 if (!controller_->IsPlatformApp(item_.id)) { 75 if (!controller_->IsPlatformApp(item_.id)) {
74 AddItem(MENU_OPEN_NEW, string16()); 76 AddItem(MENU_OPEN_NEW, string16());
75 AddSeparator(ui::NORMAL_SEPARATOR); 77 AddSeparator(ui::NORMAL_SEPARATOR);
76 } 78 }
77 AddItem( 79 AddItem(
78 MENU_PIN, 80 MENU_PIN,
79 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_UNPIN)); 81 l10n_util::GetStringUTF16(controller_->IsPinned(item_.id) ?
82 IDS_LAUNCHER_CONTEXT_MENU_UNPIN :
83 IDS_LAUNCHER_CONTEXT_MENU_PIN));
80 if (controller_->IsOpen(item_.id)) { 84 if (controller_->IsOpen(item_.id)) {
81 AddItem(MENU_CLOSE, 85 AddItem(MENU_CLOSE,
82 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE)); 86 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE));
83 } 87 }
84 if (!controller_->IsPlatformApp(item_.id)) { 88 if (!controller_->IsPlatformApp(item_.id)) {
85 AddSeparator(ui::NORMAL_SEPARATOR); 89 AddSeparator(ui::NORMAL_SEPARATOR);
86 AddCheckItemWithStringId( 90 AddCheckItemWithStringId(
87 LAUNCH_TYPE_REGULAR_TAB, 91 LAUNCH_TYPE_REGULAR_TAB,
88 IDS_APP_CONTEXT_MENU_OPEN_REGULAR); 92 IDS_APP_CONTEXT_MENU_OPEN_REGULAR);
89 AddCheckItemWithStringId( 93 AddCheckItemWithStringId(
(...skipping 21 matching lines...) Expand all
111 MENU_PIN, 115 MENU_PIN,
112 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_PIN)); 116 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_PIN));
113 } 117 }
114 if (controller_->IsOpen(item_.id)) { 118 if (controller_->IsOpen(item_.id)) {
115 AddItem(MENU_CLOSE, 119 AddItem(MENU_CLOSE,
116 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE)); 120 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE));
117 } 121 }
118 } 122 }
119 AddSeparator(ui::NORMAL_SEPARATOR); 123 AddSeparator(ui::NORMAL_SEPARATOR);
120 if (item_.type == ash::TYPE_APP_SHORTCUT || 124 if (item_.type == ash::TYPE_APP_SHORTCUT ||
125 item_.type == ash::TYPE_WINDOWED_APP ||
121 item_.type == ash::TYPE_PLATFORM_APP) { 126 item_.type == ash::TYPE_PLATFORM_APP) {
122 std::string app_id = controller_->GetAppIDForLauncherID(item_.id); 127 std::string app_id = controller_->GetAppIDForLauncherID(item_.id);
123 if (!app_id.empty()) { 128 if (!app_id.empty()) {
124 int index = 0; 129 int index = 0;
125 extension_items_->AppendExtensionItems( 130 extension_items_->AppendExtensionItems(
126 app_id, string16(), &index); 131 app_id, string16(), &index);
127 AddSeparator(ui::NORMAL_SEPARATOR); 132 AddSeparator(ui::NORMAL_SEPARATOR);
128 } 133 }
129 } 134 }
130 } 135 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 break; 269 break;
265 case MENU_CHANGE_WALLPAPER: 270 case MENU_CHANGE_WALLPAPER:
266 ash::Shell::GetInstance()->user_wallpaper_delegate()-> 271 ash::Shell::GetInstance()->user_wallpaper_delegate()->
267 OpenSetWallpaperPage(); 272 OpenSetWallpaperPage();
268 break; 273 break;
269 default: 274 default:
270 extension_items_->ExecuteCommand(command_id, NULL, 275 extension_items_->ExecuteCommand(command_id, NULL,
271 content::ContextMenuParams()); 276 content::ContextMenuParams());
272 } 277 }
273 } 278 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698