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

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

Issue 1838263002: Arc app integration in shelf launcher context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/arc_launcher_context_menu.cc
diff --git a/chrome/browser/ui/ash/launcher/arc_launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/arc_launcher_context_menu.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9156f5e61999c8395626ba6ddecb7ddb9b0810f6
--- /dev/null
+++ b/chrome/browser/ui/ash/launcher/arc_launcher_context_menu.cc
@@ -0,0 +1,70 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h"
+
+#include <string>
+
+#include "ash/desktop_background/user_wallpaper_delegate.h"
+#include "ash/shelf/shelf.h"
+#include "ash/shelf/shelf_item_types.h"
+#include "ash/shell.h"
+#include "base/macros.h"
+#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/grit/generated_resources.h"
+#include "grit/ash_strings.h"
+#include "ui/base/l10n/l10n_util.h"
+
+ArcLauncherContextMenu::ArcLauncherContextMenu(
+ ChromeLauncherController* controller,
+ const ash::ShelfItem* item,
+ ash::Shelf* shelf)
+ : LauncherContextMenu(controller, item, shelf) {
+ Init();
+}
+
+ArcLauncherContextMenu::~ArcLauncherContextMenu() {}
+
+void ArcLauncherContextMenu::Init() {
+ AddItem(MENU_OPEN_NEW,
+ l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_ACTIVATE_ARC));
+ AddSeparator(ui::NORMAL_SEPARATOR);
+ AddPinMenu();
+ if (controller()->IsOpen(item().id))
+ AddItem(MENU_CLOSE,
+ l10n_util::GetStringUTF16(IDS_LAUNCHER_CONTEXT_MENU_CLOSE));
+ AddSeparator(ui::NORMAL_SEPARATOR);
+ AddAutohideAlignmentWallpaperMenu();
+}
+
+base::string16 ArcLauncherContextMenu::GetLabelForCommandId(
+ int command_id) const {
+ if (command_id == MENU_OPEN_NEW)
+ return l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_ACTIVATE_ARC);
khmel 2016/03/29 20:31:27 Why do you need return label here? it is already s
lgcheng 2016/03/29 22:02:16 Done.
+ NOTREACHED();
+ return base::string16();
+}
+
+bool ArcLauncherContextMenu::IsCommandIdEnabled(int command_id) const {
+ switch (command_id) {
+ case MENU_OPEN_NEW:
+ return true;
+ case MENU_CLOSE:
+ return controller()->IsOpen(item().id);
khmel 2016/03/29 20:31:27 Why not to handle it in base class? MENU_CLOSE, M
lgcheng 2016/03/29 22:02:16 Reimplemented
+ case MENU_PIN:
+ return controller()->IsPinnable(item().id);
+ case MENU_CHANGE_WALLPAPER:
+ return ash::Shell::GetInstance()
+ ->user_wallpaper_delegate()
+ ->CanOpenSetWallpaperPage();
+ case MENU_AUTO_HIDE:
+ return CanUserModifyShelfAutoHideBehavior();
+ case MENU_ALIGNMENT_MENU:
+ return true;
+ default:
+ NOTREACHED();
+ return false;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698