| 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/desktop_background/user_wallpaper_delegate.h" | 12 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 12 #include "ash/metrics/user_metrics_recorder.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/desktop_shell_launcher_context_menu.h" | 21 #include "chrome/browser/ui/ash/launcher/desktop_shell_launcher_context_menu.h" |
| 22 #include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h" | 22 #include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 ash::ShelfItemDelegate* item_delegate = | 123 ash::ShelfItemDelegate* item_delegate = |
| 124 ash::Shell::GetInstance() | 124 ash::Shell::GetInstance() |
| 125 ->shelf_item_delegate_manager() | 125 ->shelf_item_delegate_manager() |
| 126 ->GetShelfItemDelegate(item_.id); | 126 ->GetShelfItemDelegate(item_.id); |
| 127 DCHECK(item_delegate); | 127 DCHECK(item_delegate); |
| 128 item_delegate->Close(); | 128 item_delegate->Close(); |
| 129 } else { | 129 } else { |
| 130 // TODO(simonhong): Use ShelfItemDelegate::Close(). | 130 // TODO(simonhong): Use ShelfItemDelegate::Close(). |
| 131 controller_->Close(item_.id); | 131 controller_->Close(item_.id); |
| 132 } | 132 } |
| 133 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 133 ash::WmShell::Get()->RecordUserMetricsAction( |
| 134 ash::UMA_CLOSE_THROUGH_CONTEXT_MENU); | 134 ash::UMA_CLOSE_THROUGH_CONTEXT_MENU); |
| 135 break; | 135 break; |
| 136 case MENU_PIN: | 136 case MENU_PIN: |
| 137 controller_->TogglePinned(item_.id); | 137 controller_->TogglePinned(item_.id); |
| 138 break; | 138 break; |
| 139 case MENU_AUTO_HIDE: | 139 case MENU_AUTO_HIDE: |
| 140 wm_shelf_->SetAutoHideBehavior( | 140 wm_shelf_->SetAutoHideBehavior( |
| 141 wm_shelf_->GetAutoHideBehavior() == | 141 wm_shelf_->GetAutoHideBehavior() == |
| 142 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS | 142 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS |
| 143 ? ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER | 143 ? ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // In fullscreen, the launcher is either hidden or autohidden depending | 181 // In fullscreen, the launcher is either hidden or autohidden depending |
| 182 // on thethe type of fullscreen. Do not show the auto-hide menu item while in | 182 // on thethe type of fullscreen. Do not show the auto-hide menu item while in |
| 183 // while in fullscreen because it is confusing when the preference appears | 183 // while in fullscreen because it is confusing when the preference appears |
| 184 // not to apply. | 184 // not to apply. |
| 185 if (!IsFullScreenMode() && | 185 if (!IsFullScreenMode() && |
| 186 CanUserModifyShelfAutoHideBehavior(controller_->GetProfile())) { | 186 CanUserModifyShelfAutoHideBehavior(controller_->GetProfile())) { |
| 187 AddCheckItemWithStringId(MENU_AUTO_HIDE, | 187 AddCheckItemWithStringId(MENU_AUTO_HIDE, |
| 188 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE); | 188 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE); |
| 189 } | 189 } |
| 190 if (ash::ShelfWidget::ShelfAlignmentAllowed() && | 190 if (ash::ShelfWidget::ShelfAlignmentAllowed() && |
| 191 !ash::Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) { | 191 !ash::WmShell::Get()->GetSessionStateDelegate()->IsScreenLocked()) { |
| 192 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, | 192 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, |
| 193 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, | 193 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, |
| 194 &shelf_alignment_menu_); | 194 &shelf_alignment_menu_); |
| 195 } | 195 } |
| 196 if (!controller_->GetProfile()->IsGuestSession()) | 196 if (!controller_->GetProfile()->IsGuestSession()) |
| 197 AddItemWithStringId(MENU_CHANGE_WALLPAPER, IDS_AURA_SET_DESKTOP_WALLPAPER); | 197 AddItemWithStringId(MENU_CHANGE_WALLPAPER, IDS_AURA_SET_DESKTOP_WALLPAPER); |
| 198 } | 198 } |
| 199 | 199 |
| 200 bool LauncherContextMenu::ExecuteCommonCommand(int command_id, | 200 bool LauncherContextMenu::ExecuteCommonCommand(int command_id, |
| 201 int event_flags) { | 201 int event_flags) { |
| 202 switch (command_id) { | 202 switch (command_id) { |
| 203 case MENU_OPEN_NEW: | 203 case MENU_OPEN_NEW: |
| 204 case MENU_CLOSE: | 204 case MENU_CLOSE: |
| 205 case MENU_PIN: | 205 case MENU_PIN: |
| 206 case MENU_AUTO_HIDE: | 206 case MENU_AUTO_HIDE: |
| 207 case MENU_ALIGNMENT_MENU: | 207 case MENU_ALIGNMENT_MENU: |
| 208 case MENU_CHANGE_WALLPAPER: | 208 case MENU_CHANGE_WALLPAPER: |
| 209 LauncherContextMenu::ExecuteCommand(command_id, event_flags); | 209 LauncherContextMenu::ExecuteCommand(command_id, event_flags); |
| 210 return true; | 210 return true; |
| 211 default: | 211 default: |
| 212 return false; | 212 return false; |
| 213 } | 213 } |
| 214 } | 214 } |
| OLD | NEW |