Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4818)

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

Issue 107163005: [ash] Add TYPE_DIALOG and its item's LauncherContextMenu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
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 80c4d7f73d8fff9dc9ea2547f777e2284af6dbdd..c85c0ad4291125acfba229e42f617cc420eba1cb 100644
--- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
+++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
@@ -9,6 +9,7 @@
#include "ash/desktop_background/user_wallpaper_delegate.h"
#include "ash/metrics/user_metrics_recorder.h"
#include "ash/root_window_controller.h"
+#include "ash/shelf/shelf_item_delegate.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "base/bind.h"
@@ -42,7 +43,24 @@ LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller,
controller_(controller),
item_(*item),
shelf_alignment_menu_(root),
- root_window_(root) {
+ root_window_(root),
+ item_delegate_(NULL) {
+ DCHECK(item);
+ DCHECK(root_window_);
+ Init();
+}
+
+LauncherContextMenu::LauncherContextMenu(
+ ChromeLauncherController* controller,
+ ash::ShelfItemDelegate* item_delegate,
+ ash::LauncherItem* item,
+ aura::Window* root)
+ : ui::SimpleMenuModel(NULL),
+ controller_(controller),
+ item_(*item),
+ shelf_alignment_menu_(root),
+ root_window_(root),
+ item_delegate_(item_delegate) {
DCHECK(item);
DCHECK(root_window_);
Init();
@@ -57,7 +75,8 @@ LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller,
extension_items_(new extensions::ContextMenuMatcher(
controller->profile(), this, this,
base::Bind(MenuItemHasLauncherContext))),
- root_window_(root) {
+ root_window_(root),
+ item_delegate_(NULL) {
DCHECK(root_window_);
Init();
}
@@ -120,6 +139,9 @@ void LauncherContextMenu::Init() {
AddItem(MENU_NEW_INCOGNITO_WINDOW,
l10n_util::GetStringUTF16(IDS_LAUNCHER_NEW_INCOGNITO_WINDOW));
}
+ } else if (item_.type == ash::TYPE_DIALOG) {
+ AddItem(MENU_CLOSE,
+ l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE));
} else {
if (item_.type == ash::TYPE_PLATFORM_APP) {
AddItem(
@@ -246,7 +268,13 @@ void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) {
controller_->Launch(item_.id, ui::EF_NONE);
break;
case MENU_CLOSE:
- controller_->Close(item_.id);
+ if (item_.type == ash::TYPE_DIALOG) {
+ DCHECK(item_delegate_);
+ item_delegate_->Close();
+ } else {
+ // TODO(simonhong): Use ShelfItemDelegate::Close().
+ controller_->Close(item_.id);
+ }
ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction(
ash::UMA_CLOSE_THROUGH_CONTEXT_MENU);
break;
« no previous file with comments | « chrome/browser/ui/ash/launcher/launcher_context_menu.h ('k') | chrome/browser/ui/ash/launcher/launcher_item_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698