| Index: chrome/browser/ui/ash/launcher/launcher_context_menu.cc
|
| diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
|
| index ca1b3ca08a92df0052c616e1ac7d73b326c15cb6..3f0d3b97ab6d0fb7887ddbd9bc94c1dfab77323e 100644
|
| --- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
|
| +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
|
| @@ -7,9 +7,11 @@
|
| #include "ash/launcher/launcher_context_menu.h"
|
| #include "ash/shell.h"
|
| #include "base/command_line.h"
|
| +#include "chrome/browser/extensions/context_menu_manager.h"
|
| #include "chrome/browser/extensions/extension_prefs.h"
|
| #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
|
| #include "chrome/common/chrome_switches.h"
|
| +#include "content/public/common/context_menu_params.h"
|
| #include "grit/ash_strings.h"
|
| #include "grit/generated_resources.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| @@ -18,7 +20,10 @@ LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller,
|
| const ash::LauncherItem* item)
|
| : ui::SimpleMenuModel(NULL),
|
| controller_(controller),
|
| - item_(item ? *item : ash::LauncherItem()) {
|
| + item_(item ? *item : ash::LauncherItem()),
|
| + context_menu_manager_(new extensions::ContextMenuManager(
|
| + controller->profile(), this, this,
|
| + base::Bind(extensions::ContextMenuManager::ContextIsLauncher))) {
|
| set_delegate(this);
|
|
|
| if (is_valid_item()) {
|
| @@ -56,6 +61,11 @@ LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller,
|
| } else {
|
| AddItem(MENU_OPEN, controller->GetTitle(item_));
|
| if (item_.type == ash::TYPE_PLATFORM_APP) {
|
| + int index = 0;
|
| + context_menu_manager_->AppendExtensionItems(
|
| + controller->GetAppIDForLauncherID(item_.id), string16(), &index);
|
| + if (index > 0)
|
| + AddSeparator(ui::NORMAL_SEPARATOR);
|
| AddItem(
|
| MENU_PIN,
|
| l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_PIN));
|
| @@ -97,7 +107,7 @@ bool LauncherContextMenu::IsCommandIdChecked(int command_id) const {
|
| case MENU_AUTO_HIDE:
|
| return ash::LauncherContextMenu::IsAutoHideMenuHideChecked();
|
| default:
|
| - return false;
|
| + return context_menu_manager_->IsCommandIdChecked(command_id);
|
| }
|
| }
|
|
|
| @@ -107,7 +117,7 @@ bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const {
|
| return item_.type == ash::TYPE_PLATFORM_APP ||
|
| controller_->IsPinnable(item_.id);
|
| default:
|
| - return true;
|
| + return context_menu_manager_->IsCommandIdEnabled(command_id);
|
| }
|
| }
|
|
|
| @@ -156,5 +166,10 @@ void LauncherContextMenu::ExecuteCommand(int command_id) {
|
| break;
|
| case MENU_ALIGNMENT_MENU:
|
| break;
|
| + default:
|
| + content::ContextMenuParams params;
|
| + // TODO(mek): maybe make page_url not required?
|
| + params.page_url = GURL("about:blank");
|
| + context_menu_manager_->ExecuteCommand(command_id, params);
|
| }
|
| }
|
|
|