| 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/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_model.h" | 10 #include "ash/shelf/shelf_model.h" |
| 11 #include "ash/shelf/shelf_widget.h" |
| 11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 12 #include "ash/shell_port.h" | 13 #include "ash/shell_port.h" |
| 13 #include "ash/strings/grit/ash_strings.h" | 14 #include "ash/strings/grit/ash_strings.h" |
| 14 #include "ash/wallpaper/wallpaper_delegate.h" | 15 #include "ash/wallpaper/wallpaper_delegate.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" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 return CanUserModifyShelfAutoHideBehavior(controller_->profile()); | 101 return CanUserModifyShelfAutoHideBehavior(controller_->profile()); |
| 101 default: | 102 default: |
| 102 DCHECK(command_id < MENU_ITEM_COUNT); | 103 DCHECK(command_id < MENU_ITEM_COUNT); |
| 103 return true; | 104 return true; |
| 104 } | 105 } |
| 105 } | 106 } |
| 106 | 107 |
| 107 void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { | 108 void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { |
| 108 switch (static_cast<MenuItem>(command_id)) { | 109 switch (static_cast<MenuItem>(command_id)) { |
| 109 case MENU_OPEN_NEW: | 110 case MENU_OPEN_NEW: |
| 110 controller_->Launch(item_.id, ui::EF_NONE); | 111 controller_->LaunchApp(item_.id, ash::LAUNCH_FROM_UNKNOWN, ui::EF_NONE, |
| 112 display::Screen::GetScreen() |
| 113 ->GetDisplayNearestWindow( |
| 114 shelf_->shelf_widget()->GetNativeWindow()) |
| 115 .id()); |
| 111 break; | 116 break; |
| 112 case MENU_CLOSE: | 117 case MENU_CLOSE: |
| 113 if (item_.type == ash::TYPE_DIALOG) { | 118 if (item_.type == ash::TYPE_DIALOG) { |
| 114 ash::ShelfItemDelegate* item_delegate = | 119 ash::ShelfItemDelegate* item_delegate = |
| 115 controller_->shelf_model()->GetShelfItemDelegate(item_.id); | 120 controller_->shelf_model()->GetShelfItemDelegate(item_.id); |
| 116 DCHECK(item_delegate); | 121 DCHECK(item_delegate); |
| 117 item_delegate->Close(); | 122 item_delegate->Close(); |
| 118 } else { | 123 } else { |
| 119 // TODO(simonhong): Use ShelfItemDelegate::Close(). | 124 // TODO(simonhong): Use ShelfItemDelegate::Close(). |
| 120 controller_->Close(item_.id); | 125 controller_->Close(item_.id); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 case MENU_PIN: | 202 case MENU_PIN: |
| 198 case MENU_AUTO_HIDE: | 203 case MENU_AUTO_HIDE: |
| 199 case MENU_ALIGNMENT_MENU: | 204 case MENU_ALIGNMENT_MENU: |
| 200 case MENU_CHANGE_WALLPAPER: | 205 case MENU_CHANGE_WALLPAPER: |
| 201 LauncherContextMenu::ExecuteCommand(command_id, event_flags); | 206 LauncherContextMenu::ExecuteCommand(command_id, event_flags); |
| 202 return true; | 207 return true; |
| 203 default: | 208 default: |
| 204 return false; | 209 return false; |
| 205 } | 210 } |
| 206 } | 211 } |
| OLD | NEW |