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

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

Issue 152223002: Renames LauncherID, LauncherItem and LauncherItems... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: OWNERS Created 6 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/metrics/user_metrics_recorder.h" 10 #include "ash/metrics/user_metrics_recorder.h"
(...skipping 19 matching lines...) Expand all
30 30
31 namespace { 31 namespace {
32 32
33 bool MenuItemHasLauncherContext(const extensions::MenuItem* item) { 33 bool MenuItemHasLauncherContext(const extensions::MenuItem* item) {
34 return item->contexts().Contains(extensions::MenuItem::LAUNCHER); 34 return item->contexts().Contains(extensions::MenuItem::LAUNCHER);
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, 39 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller,
40 const ash::LauncherItem* item, 40 const ash::ShelfItem* item,
41 aura::Window* root) 41 aura::Window* root)
42 : ui::SimpleMenuModel(NULL), 42 : ui::SimpleMenuModel(NULL),
43 controller_(controller), 43 controller_(controller),
44 item_(*item), 44 item_(*item),
45 shelf_alignment_menu_(root), 45 shelf_alignment_menu_(root),
46 root_window_(root), 46 root_window_(root),
47 item_delegate_(NULL) { 47 item_delegate_(NULL) {
48 DCHECK(item); 48 DCHECK(item);
49 DCHECK(root_window_); 49 DCHECK(root_window_);
50 Init(); 50 Init();
51 } 51 }
52 52
53 LauncherContextMenu::LauncherContextMenu( 53 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller,
54 ChromeLauncherController* controller, 54 ash::ShelfItemDelegate* item_delegate,
55 ash::ShelfItemDelegate* item_delegate, 55 ash::ShelfItem* item,
56 ash::LauncherItem* item, 56 aura::Window* root)
57 aura::Window* root)
58 : ui::SimpleMenuModel(NULL), 57 : ui::SimpleMenuModel(NULL),
59 controller_(controller), 58 controller_(controller),
60 item_(*item), 59 item_(*item),
61 shelf_alignment_menu_(root), 60 shelf_alignment_menu_(root),
62 root_window_(root), 61 root_window_(root),
63 item_delegate_(item_delegate) { 62 item_delegate_(item_delegate) {
64 DCHECK(item); 63 DCHECK(item);
65 DCHECK(root_window_); 64 DCHECK(root_window_);
66 Init(); 65 Init();
67 } 66 }
68 67
69 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, 68 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller,
70 aura::Window* root) 69 aura::Window* root)
71 : ui::SimpleMenuModel(NULL), 70 : ui::SimpleMenuModel(NULL),
72 controller_(controller), 71 controller_(controller),
73 item_(ash::LauncherItem()), 72 item_(ash::ShelfItem()),
74 shelf_alignment_menu_(root), 73 shelf_alignment_menu_(root),
75 extension_items_(new extensions::ContextMenuMatcher( 74 extension_items_(new extensions::ContextMenuMatcher(
76 controller->profile(), this, this, 75 controller->profile(), this, this,
77 base::Bind(MenuItemHasLauncherContext))), 76 base::Bind(MenuItemHasLauncherContext))),
78 root_window_(root), 77 root_window_(root),
79 item_delegate_(NULL) { 78 item_delegate_(NULL) {
80 DCHECK(root_window_); 79 DCHECK(root_window_);
81 Init(); 80 Init();
82 } 81 }
83 82
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 149 }
151 if (controller_->IsOpen(item_.id)) { 150 if (controller_->IsOpen(item_.id)) {
152 AddItem(MENU_CLOSE, 151 AddItem(MENU_CLOSE,
153 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE)); 152 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE));
154 } 153 }
155 } 154 }
156 AddSeparator(ui::NORMAL_SEPARATOR); 155 AddSeparator(ui::NORMAL_SEPARATOR);
157 if (item_.type == ash::TYPE_APP_SHORTCUT || 156 if (item_.type == ash::TYPE_APP_SHORTCUT ||
158 item_.type == ash::TYPE_WINDOWED_APP || 157 item_.type == ash::TYPE_WINDOWED_APP ||
159 item_.type == ash::TYPE_PLATFORM_APP) { 158 item_.type == ash::TYPE_PLATFORM_APP) {
160 std::string app_id = controller_->GetAppIDForLauncherID(item_.id); 159 std::string app_id = controller_->GetAppIDForShelfID(item_.id);
161 if (!app_id.empty()) { 160 if (!app_id.empty()) {
162 int index = 0; 161 int index = 0;
163 extension_items_->AppendExtensionItems( 162 extension_items_->AppendExtensionItems(
164 app_id, base::string16(), &index); 163 app_id, base::string16(), &index);
165 AddSeparator(ui::NORMAL_SEPARATOR); 164 AddSeparator(ui::NORMAL_SEPARATOR);
166 } 165 }
167 } 166 }
168 } 167 }
169 // In fullscreen, the launcher is either hidden or autohidden depending on 168 // In fullscreen, the launcher is either hidden or autohidden depending on
170 // the type of fullscreen. Do not show the auto-hide menu item while in 169 // the type of fullscreen. Do not show the auto-hide menu item while in
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 case MENU_CHANGE_WALLPAPER: 323 case MENU_CHANGE_WALLPAPER:
325 ash::Shell::GetInstance()->user_wallpaper_delegate()-> 324 ash::Shell::GetInstance()->user_wallpaper_delegate()->
326 OpenSetWallpaperPage(); 325 OpenSetWallpaperPage();
327 break; 326 break;
328 #endif 327 #endif
329 default: 328 default:
330 extension_items_->ExecuteCommand(command_id, NULL, 329 extension_items_->ExecuteCommand(command_id, NULL,
331 content::ContextMenuParams()); 330 content::ContextMenuParams());
332 } 331 }
333 } 332 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698