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/shelf_model.h" |
10 #include "ash/common/shelf/wm_shelf.h" | 11 #include "ash/common/shelf/wm_shelf.h" |
11 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
12 #include "ash/desktop_background/user_wallpaper_delegate.h" | 13 #include "ash/desktop_background/user_wallpaper_delegate.h" |
13 #include "ash/shelf/shelf_widget.h" | 14 #include "ash/shelf/shelf_widget.h" |
14 #include "ash/shell.h" | 15 #include "ash/shell.h" |
15 #include "build/build_config.h" | 16 #include "build/build_config.h" |
16 #include "chrome/browser/fullscreen.h" | 17 #include "chrome/browser/fullscreen.h" |
17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 19 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
19 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" | 20 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 116 } |
116 | 117 |
117 void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { | 118 void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { |
118 switch (static_cast<MenuItem>(command_id)) { | 119 switch (static_cast<MenuItem>(command_id)) { |
119 case MENU_OPEN_NEW: | 120 case MENU_OPEN_NEW: |
120 controller_->Launch(item_.id, ui::EF_NONE); | 121 controller_->Launch(item_.id, ui::EF_NONE); |
121 break; | 122 break; |
122 case MENU_CLOSE: | 123 case MENU_CLOSE: |
123 if (item_.type == ash::TYPE_DIALOG) { | 124 if (item_.type == ash::TYPE_DIALOG) { |
124 ash::ShelfItemDelegate* item_delegate = | 125 ash::ShelfItemDelegate* item_delegate = |
125 ash::Shell::GetInstance() | 126 ash::WmShell::Get()->shelf_model()->GetShelfItemDelegate(item_.id); |
126 ->shelf_item_delegate_manager() | |
127 ->GetShelfItemDelegate(item_.id); | |
128 DCHECK(item_delegate); | 127 DCHECK(item_delegate); |
129 item_delegate->Close(); | 128 item_delegate->Close(); |
130 } else { | 129 } else { |
131 // TODO(simonhong): Use ShelfItemDelegate::Close(). | 130 // TODO(simonhong): Use ShelfItemDelegate::Close(). |
132 controller_->Close(item_.id); | 131 controller_->Close(item_.id); |
133 } | 132 } |
134 ash::WmShell::Get()->RecordUserMetricsAction( | 133 ash::WmShell::Get()->RecordUserMetricsAction( |
135 ash::UMA_CLOSE_THROUGH_CONTEXT_MENU); | 134 ash::UMA_CLOSE_THROUGH_CONTEXT_MENU); |
136 break; | 135 break; |
137 case MENU_PIN: | 136 case MENU_PIN: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 case MENU_PIN: | 205 case MENU_PIN: |
207 case MENU_AUTO_HIDE: | 206 case MENU_AUTO_HIDE: |
208 case MENU_ALIGNMENT_MENU: | 207 case MENU_ALIGNMENT_MENU: |
209 case MENU_CHANGE_WALLPAPER: | 208 case MENU_CHANGE_WALLPAPER: |
210 LauncherContextMenu::ExecuteCommand(command_id, event_flags); | 209 LauncherContextMenu::ExecuteCommand(command_id, event_flags); |
211 return true; | 210 return true; |
212 default: | 211 default: |
213 return false; | 212 return false; |
214 } | 213 } |
215 } | 214 } |
OLD | NEW |