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

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

Issue 1919593003: arc: Prevent showing Opt-in UI when it is not expected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TODO added Created 4 years, 8 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 8635cd8f40fa7414a6ce7b8617ea642695564216..defd9023a8e0696ab58066b6ea56f24fd7acb875 100644
--- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
+++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc
@@ -160,14 +160,23 @@ void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) {
void LauncherContextMenu::AddPinMenu() {
// Expect an item with a none zero id to add pin/unpin menu item.
DCHECK(item_.id);
- const std::string app_id = controller_->GetAppIDForShelfID(item_.id);
int menu_pin_string_id;
- if (!controller_->CanPin(app_id))
- menu_pin_string_id = IDS_LAUNCHER_CONTEXT_MENU_PIN_ENFORCED_BY_POLICY;
- else if (controller_->IsPinned(item_.id))
- menu_pin_string_id = IDS_LAUNCHER_CONTEXT_MENU_UNPIN;
- else
- menu_pin_string_id = IDS_LAUNCHER_CONTEXT_MENU_PIN;
+ const std::string app_id = controller_->GetAppIDForShelfID(item_.id);
+ switch (controller_->GetPinnable(app_id)) {
+ case AppListControllerDelegate::PIN_EDITABLE:
+ menu_pin_string_id = controller_->IsPinned(item_.id)
+ ? IDS_LAUNCHER_CONTEXT_MENU_UNPIN
+ : IDS_LAUNCHER_CONTEXT_MENU_PIN;
+ break;
+ case AppListControllerDelegate::PIN_FIXED:
+ menu_pin_string_id = IDS_LAUNCHER_CONTEXT_MENU_PIN_ENFORCED_BY_POLICY;
+ break;
+ case AppListControllerDelegate::NO_PIN:
+ return;
+ default:
+ NOTREACHED();
+ return;
+ }
AddItemWithStringId(MENU_PIN, menu_pin_string_id);
}

Powered by Google App Engine
This is Rietveld 408576698