| 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/shelf/shelf_model.h" | 9 #include "ash/common/shelf/shelf_model.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/common/wallpaper/wallpaper_delegate.h" | 11 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 12 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
| 13 #include "ash/common/wm_window.h" | 13 #include "ash/common/wm_window.h" |
| 14 #include "ash/shell.h" |
| 14 #include "ash/strings/grit/ash_strings.h" | 15 #include "ash/strings/grit/ash_strings.h" |
| 15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 16 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 17 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 17 #include "chrome/browser/fullscreen.h" | 18 #include "chrome/browser/fullscreen.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 20 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 20 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 21 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 21 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" | 22 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" |
| 22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" | 23 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
| 23 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 24 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return false; | 92 return false; |
| 92 } | 93 } |
| 93 | 94 |
| 94 bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const { | 95 bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const { |
| 95 switch (command_id) { | 96 switch (command_id) { |
| 96 case MENU_PIN: | 97 case MENU_PIN: |
| 97 // Users cannot modify the pinned state of apps pinned by policy. | 98 // Users cannot modify the pinned state of apps pinned by policy. |
| 98 return !item_.pinned_by_policy && (item_.type == ash::TYPE_APP_SHORTCUT || | 99 return !item_.pinned_by_policy && (item_.type == ash::TYPE_APP_SHORTCUT || |
| 99 item_.type == ash::TYPE_APP); | 100 item_.type == ash::TYPE_APP); |
| 100 case MENU_CHANGE_WALLPAPER: | 101 case MENU_CHANGE_WALLPAPER: |
| 101 return ash::WmShell::Get() | 102 return ash::Shell::Get()->wallpaper_delegate()->CanOpenSetWallpaperPage(); |
| 102 ->wallpaper_delegate() | |
| 103 ->CanOpenSetWallpaperPage(); | |
| 104 case MENU_AUTO_HIDE: | 103 case MENU_AUTO_HIDE: |
| 105 return CanUserModifyShelfAutoHideBehavior(controller_->profile()); | 104 return CanUserModifyShelfAutoHideBehavior(controller_->profile()); |
| 106 default: | 105 default: |
| 107 DCHECK(command_id < MENU_ITEM_COUNT); | 106 DCHECK(command_id < MENU_ITEM_COUNT); |
| 108 return true; | 107 return true; |
| 109 } | 108 } |
| 110 } | 109 } |
| 111 | 110 |
| 112 void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { | 111 void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { |
| 113 switch (static_cast<MenuItem>(command_id)) { | 112 switch (static_cast<MenuItem>(command_id)) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 case MENU_PIN: | 198 case MENU_PIN: |
| 200 case MENU_AUTO_HIDE: | 199 case MENU_AUTO_HIDE: |
| 201 case MENU_ALIGNMENT_MENU: | 200 case MENU_ALIGNMENT_MENU: |
| 202 case MENU_CHANGE_WALLPAPER: | 201 case MENU_CHANGE_WALLPAPER: |
| 203 LauncherContextMenu::ExecuteCommand(command_id, event_flags); | 202 LauncherContextMenu::ExecuteCommand(command_id, event_flags); |
| 204 return true; | 203 return true; |
| 205 default: | 204 default: |
| 206 return false; | 205 return false; |
| 207 } | 206 } |
| 208 } | 207 } |
| OLD | NEW |