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

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

Issue 2608013002: mash: Replace ShelfItemDelegate::CanPin with ShelfItem::pinned_by_policy. (Closed)
Patch Set: Fix test. Created 3 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 aa70210eac001e319a02822122bc7a2959a8aa76..760ff4fc74d40f41072eca35d5d70443ec880050 100644
--- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
+++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
@@ -14,6 +14,7 @@
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
#include "build/build_config.h"
+#include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
#include "chrome/browser/fullscreen.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
@@ -28,10 +29,6 @@
#include "components/prefs/pref_service.h"
#include "content/public/common/context_menu_params.h"
-#if defined(OS_CHROMEOS)
-#include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
-#endif // defined(OS_CHROMEOS)
-
namespace {
// Returns true if the user can modify the |shelf|'s auto-hide behavior.
@@ -74,8 +71,7 @@ LauncherContextMenu::LauncherContextMenu(
set_delegate(this);
}
-LauncherContextMenu::~LauncherContextMenu() {
-}
+LauncherContextMenu::~LauncherContextMenu() {}
bool LauncherContextMenu::IsItemForCommandIdDynamic(int command_id) const {
return false;
@@ -98,15 +94,13 @@ bool LauncherContextMenu::IsCommandIdChecked(int command_id) const {
bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const {
switch (command_id) {
case MENU_PIN:
- return controller_->IsPinnable(item_.id);
+ // Users cannot modify the pinned state of apps pinned by policy.
+ return !item_.pinned_by_policy && (item_.type == ash::TYPE_APP_SHORTCUT ||
+ item_.type == ash::TYPE_APP);
case MENU_CHANGE_WALLPAPER:
-#if defined(OS_CHROMEOS)
return ash::WmShell::Get()
->wallpaper_delegate()
->CanOpenSetWallpaperPage();
-#else
- return false;
-#endif // defined(OS_CHROMEOS)
case MENU_AUTO_HIDE:
return CanUserModifyShelfAutoHideBehavior(controller_->profile());
default:
@@ -146,9 +140,7 @@ void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) {
case MENU_ALIGNMENT_MENU:
break;
case MENU_CHANGE_WALLPAPER:
-#if defined(OS_CHROMEOS)
chromeos::WallpaperManager::Get()->Open();
-#endif // defined(OS_CHROMEOS)
break;
default:
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698