| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/extension_launcher_context_menu.h" | 5 #include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_item_delegate.h" | 7 #include "ash/common/shelf/shelf_item_delegate.h" |
| 8 #include "ash/shelf/shelf.h" | |
| 9 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 9 #include "base/bind.h" |
| 11 #include "chrome/browser/extensions/context_menu_matcher.h" | 10 #include "chrome/browser/extensions/context_menu_matcher.h" |
| 12 #include "chrome/browser/extensions/extension_util.h" | 11 #include "chrome/browser/extensions/extension_util.h" |
| 13 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 12 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 14 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
| 16 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 17 #include "chrome/common/extensions/extension_constants.h" | 16 #include "chrome/common/extensions/extension_constants.h" |
| 18 #include "chrome/grit/generated_resources.h" | 17 #include "chrome/grit/generated_resources.h" |
| 19 #include "content/public/common/context_menu_params.h" | 18 #include "content/public/common/context_menu_params.h" |
| 20 #include "grit/ash_strings.h" | 19 #include "grit/ash_strings.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 22 | 21 |
| 23 namespace { | 22 namespace { |
| 24 | 23 |
| 25 bool MenuItemHasLauncherContext(const extensions::MenuItem* item) { | 24 bool MenuItemHasLauncherContext(const extensions::MenuItem* item) { |
| 26 return item->contexts().Contains(extensions::MenuItem::LAUNCHER); | 25 return item->contexts().Contains(extensions::MenuItem::LAUNCHER); |
| 27 } | 26 } |
| 28 | 27 |
| 29 } // namespace | 28 } // namespace |
| 30 | 29 |
| 31 ExtensionLauncherContextMenu::ExtensionLauncherContextMenu( | 30 ExtensionLauncherContextMenu::ExtensionLauncherContextMenu( |
| 32 ChromeLauncherController* controller, | 31 ChromeLauncherController* controller, |
| 33 const ash::ShelfItem* item, | 32 const ash::ShelfItem* item, |
| 34 ash::Shelf* shelf) | 33 ash::WmShelf* wm_shelf) |
| 35 : LauncherContextMenu(controller, item, shelf) { | 34 : LauncherContextMenu(controller, item, wm_shelf) { |
| 36 Init(); | 35 Init(); |
| 37 } | 36 } |
| 38 | 37 |
| 39 ExtensionLauncherContextMenu::~ExtensionLauncherContextMenu() {} | 38 ExtensionLauncherContextMenu::~ExtensionLauncherContextMenu() {} |
| 40 | 39 |
| 41 void ExtensionLauncherContextMenu::Init() { | 40 void ExtensionLauncherContextMenu::Init() { |
| 42 extension_items_.reset(new extensions::ContextMenuMatcher( | 41 extension_items_.reset(new extensions::ContextMenuMatcher( |
| 43 controller()->profile(), this, this, | 42 controller()->profile(), this, this, |
| 44 base::Bind(MenuItemHasLauncherContext))); | 43 base::Bind(MenuItemHasLauncherContext))); |
| 45 if (item().type == ash::TYPE_APP_SHORTCUT || | 44 if (item().type == ash::TYPE_APP_SHORTCUT || |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 case MENU_NEW_INCOGNITO_WINDOW: | 218 case MENU_NEW_INCOGNITO_WINDOW: |
| 220 controller()->CreateNewIncognitoWindow(); | 219 controller()->CreateNewIncognitoWindow(); |
| 221 break; | 220 break; |
| 222 default: | 221 default: |
| 223 if (extension_items_) { | 222 if (extension_items_) { |
| 224 extension_items_->ExecuteCommand(command_id, nullptr, nullptr, | 223 extension_items_->ExecuteCommand(command_id, nullptr, nullptr, |
| 225 content::ContextMenuParams()); | 224 content::ContextMenuParams()); |
| 226 } | 225 } |
| 227 } | 226 } |
| 228 } | 227 } |
| OLD | NEW |