| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" | 5 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 12 #include "ash/desktop_background/user_wallpaper_delegate.h" | 12 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 13 #include "ash/shelf/shelf_widget.h" | 13 #include "ash/shelf/shelf_widget.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/fullscreen.h" | 16 #include "chrome/browser/fullscreen.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 18 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 19 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" | 19 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" |
| 20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" | 20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
| 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
| 21 #include "chrome/browser/ui/ash/launcher/desktop_shell_launcher_context_menu.h" | 22 #include "chrome/browser/ui/ash/launcher/desktop_shell_launcher_context_menu.h" |
| 22 #include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h" | 23 #include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h" |
| 23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 24 #include "chrome/grit/generated_resources.h" | 25 #include "chrome/grit/generated_resources.h" |
| 25 #include "components/prefs/pref_service.h" | 26 #include "components/prefs/pref_service.h" |
| 26 #include "content/public/common/context_menu_params.h" | 27 #include "content/public/common/context_menu_params.h" |
| 27 #include "grit/ash_strings.h" | 28 #include "grit/ash_strings.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 default: | 153 default: |
| 153 NOTREACHED(); | 154 NOTREACHED(); |
| 154 } | 155 } |
| 155 } | 156 } |
| 156 | 157 |
| 157 void LauncherContextMenu::AddPinMenu() { | 158 void LauncherContextMenu::AddPinMenu() { |
| 158 // Expect an item with a none zero id to add pin/unpin menu item. | 159 // Expect an item with a none zero id to add pin/unpin menu item. |
| 159 DCHECK(item_.id); | 160 DCHECK(item_.id); |
| 160 int menu_pin_string_id; | 161 int menu_pin_string_id; |
| 161 const std::string app_id = controller_->GetAppIDForShelfID(item_.id); | 162 const std::string app_id = controller_->GetAppIDForShelfID(item_.id); |
| 162 switch (controller_->GetPinnable(app_id)) { | 163 switch (GetPinnableForAppID(app_id, controller_->GetProfile())) { |
| 163 case AppListControllerDelegate::PIN_EDITABLE: | 164 case AppListControllerDelegate::PIN_EDITABLE: |
| 164 menu_pin_string_id = controller_->IsPinned(item_.id) | 165 menu_pin_string_id = controller_->IsPinned(item_.id) |
| 165 ? IDS_LAUNCHER_CONTEXT_MENU_UNPIN | 166 ? IDS_LAUNCHER_CONTEXT_MENU_UNPIN |
| 166 : IDS_LAUNCHER_CONTEXT_MENU_PIN; | 167 : IDS_LAUNCHER_CONTEXT_MENU_PIN; |
| 167 break; | 168 break; |
| 168 case AppListControllerDelegate::PIN_FIXED: | 169 case AppListControllerDelegate::PIN_FIXED: |
| 169 menu_pin_string_id = IDS_LAUNCHER_CONTEXT_MENU_PIN_ENFORCED_BY_POLICY; | 170 menu_pin_string_id = IDS_LAUNCHER_CONTEXT_MENU_PIN_ENFORCED_BY_POLICY; |
| 170 break; | 171 break; |
| 171 case AppListControllerDelegate::NO_PIN: | 172 case AppListControllerDelegate::NO_PIN: |
| 172 return; | 173 return; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 case MENU_PIN: | 206 case MENU_PIN: |
| 206 case MENU_AUTO_HIDE: | 207 case MENU_AUTO_HIDE: |
| 207 case MENU_ALIGNMENT_MENU: | 208 case MENU_ALIGNMENT_MENU: |
| 208 case MENU_CHANGE_WALLPAPER: | 209 case MENU_CHANGE_WALLPAPER: |
| 209 LauncherContextMenu::ExecuteCommand(command_id, event_flags); | 210 LauncherContextMenu::ExecuteCommand(command_id, event_flags); |
| 210 return true; | 211 return true; |
| 211 default: | 212 default: |
| 212 return false; | 213 return false; |
| 213 } | 214 } |
| 214 } | 215 } |
| OLD | NEW |