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

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

Issue 2870683002: ash: Remove ShelfModel id conversion functions. (Closed)
Patch Set: Sync and rebase. Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/extension_launcher_context_menu.h" 5 #include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/extensions/context_menu_matcher.h" 8 #include "chrome/browser/extensions/context_menu_matcher.h"
9 #include "chrome/browser/extensions/extension_util.h" 9 #include "chrome/browser/extensions/extension_util.h"
10 #include "chrome/browser/extensions/launch_util.h" 10 #include "chrome/browser/extensions/launch_util.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 AddItem(MENU_CLOSE, 87 AddItem(MENU_CLOSE,
88 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE)); 88 l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE));
89 } 89 }
90 } else if (item().type == ash::TYPE_DIALOG) { 90 } else if (item().type == ash::TYPE_DIALOG) {
91 AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE); 91 AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE);
92 } else if (controller()->IsOpen(item().id)) { 92 } else if (controller()->IsOpen(item().id)) {
93 AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE); 93 AddItemWithStringId(MENU_CLOSE, IDS_LAUNCHER_CONTEXT_MENU_CLOSE);
94 } 94 }
95 AddSeparator(ui::NORMAL_SEPARATOR); 95 AddSeparator(ui::NORMAL_SEPARATOR);
96 if (item().type == ash::TYPE_PINNED_APP || item().type == ash::TYPE_APP) { 96 if (item().type == ash::TYPE_PINNED_APP || item().type == ash::TYPE_APP) {
97 const extensions::MenuItem::ExtensionKey app_key( 97 const extensions::MenuItem::ExtensionKey app_key(item().id.app_id);
98 controller()->GetAppIDForShelfID(item().id));
James Cook 2017/05/10 15:56:34 Global praise: It's so awesome we don't have to do
msw 2017/05/10 18:21:54 I agree!
99 if (!app_key.empty()) { 98 if (!app_key.empty()) {
100 int index = 0; 99 int index = 0;
101 extension_items_->AppendExtensionItems(app_key, base::string16(), &index, 100 extension_items_->AppendExtensionItems(app_key, base::string16(), &index,
102 false); // is_action_menu 101 false); // is_action_menu
103 AddSeparator(ui::NORMAL_SEPARATOR); 102 AddSeparator(ui::NORMAL_SEPARATOR);
104 } 103 }
105 } 104 }
106 AddShelfOptionsMenu(); 105 AddShelfOptionsMenu();
107 } 106 }
108 107
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (!extension) 217 if (!extension)
219 return extensions::LAUNCH_TYPE_DEFAULT; 218 return extensions::LAUNCH_TYPE_DEFAULT;
220 219
221 return extensions::GetLaunchType( 220 return extensions::GetLaunchType(
222 extensions::ExtensionPrefs::Get(controller()->profile()), extension); 221 extensions::ExtensionPrefs::Get(controller()->profile()), extension);
223 } 222 }
224 223
225 void ExtensionLauncherContextMenu::SetLaunchType(extensions::LaunchType type) { 224 void ExtensionLauncherContextMenu::SetLaunchType(extensions::LaunchType type) {
226 extensions::SetLaunchType(controller()->profile(), item().id.app_id, type); 225 extensions::SetLaunchType(controller()->profile(), item().id.app_id, type);
227 } 226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698