| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/extensions/context_menu_matcher.h" | 8 #include "chrome/browser/extensions/context_menu_matcher.h" |
| 9 #include "chrome/browser/extensions/extension_util.h" | 9 #include "chrome/browser/extensions/extension_util.h" |
| 10 #include "chrome/browser/extensions/launch_util.h" | 10 #include "chrome/browser/extensions/launch_util.h" |
| 11 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 11 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 13 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
| 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" | 14 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 15 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
| 16 #include "chrome/browser/ui/browser_commands.h" | 16 #include "chrome/browser/ui/browser_commands.h" |
| 17 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
| 18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "content/public/common/context_menu_params.h" | 19 #include "content/public/common/context_menu_params.h" |
| 20 #include "extensions/browser/extension_prefs.h" | 20 #include "extensions/browser/extension_prefs.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 bool MenuItemHasLauncherContext(const extensions::MenuItem* item) { | 25 bool MenuItemHasLauncherContext(const extensions::MenuItem* item) { |
| 26 return item->contexts().Contains(extensions::MenuItem::LAUNCHER); | 26 return item->contexts().Contains(extensions::MenuItem::LAUNCHER); |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 ExtensionLauncherContextMenu::ExtensionLauncherContextMenu( | 31 ExtensionLauncherContextMenu::ExtensionLauncherContextMenu( |
| 32 ChromeLauncherControllerImpl* controller, | 32 ChromeLauncherController* controller, |
| 33 const ash::ShelfItem* item, | 33 const ash::ShelfItem* item, |
| 34 ash::WmShelf* wm_shelf) | 34 ash::WmShelf* wm_shelf) |
| 35 : LauncherContextMenu(controller, item, wm_shelf) { | 35 : LauncherContextMenu(controller, item, wm_shelf) { |
| 36 Init(); | 36 Init(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 ExtensionLauncherContextMenu::~ExtensionLauncherContextMenu() {} | 39 ExtensionLauncherContextMenu::~ExtensionLauncherContextMenu() {} |
| 40 | 40 |
| 41 void ExtensionLauncherContextMenu::Init() { | 41 void ExtensionLauncherContextMenu::Init() { |
| 42 extension_items_.reset(new extensions::ContextMenuMatcher( | 42 extension_items_.reset(new extensions::ContextMenuMatcher( |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 return extensions::LAUNCH_TYPE_DEFAULT; | 219 return extensions::LAUNCH_TYPE_DEFAULT; |
| 220 | 220 |
| 221 return extensions::GetLaunchType( | 221 return extensions::GetLaunchType( |
| 222 extensions::ExtensionPrefs::Get(controller()->profile()), extension); | 222 extensions::ExtensionPrefs::Get(controller()->profile()), extension); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void ExtensionLauncherContextMenu::SetLaunchType(extensions::LaunchType type) { | 225 void ExtensionLauncherContextMenu::SetLaunchType(extensions::LaunchType type) { |
| 226 extensions::SetLaunchType(controller()->profile(), | 226 extensions::SetLaunchType(controller()->profile(), |
| 227 item().app_launch_id.app_id(), type); | 227 item().app_launch_id.app_id(), type); |
| 228 } | 228 } |
| OLD | NEW |