| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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 ChromeLauncherController* controller, | 32 ChromeLauncherController* controller, |
| 33 const ash::ShelfItem* item, | 33 const ash::ShelfItem* item, |
| 34 ash::WmShelf* wm_shelf) | 34 ash::Shelf* shelf) |
| 35 : LauncherContextMenu(controller, item, wm_shelf) { | 35 : LauncherContextMenu(controller, item, 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( |
| 43 controller()->profile(), this, this, | 43 controller()->profile(), this, this, |
| 44 base::Bind(MenuItemHasLauncherContext))); | 44 base::Bind(MenuItemHasLauncherContext))); |
| 45 if (item().type == ash::TYPE_PINNED_APP || item().type == ash::TYPE_APP) { | 45 if (item().type == ash::TYPE_PINNED_APP || item().type == ash::TYPE_APP) { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 if (!extension) | 217 if (!extension) |
| 218 return extensions::LAUNCH_TYPE_DEFAULT; | 218 return extensions::LAUNCH_TYPE_DEFAULT; |
| 219 | 219 |
| 220 return extensions::GetLaunchType( | 220 return extensions::GetLaunchType( |
| 221 extensions::ExtensionPrefs::Get(controller()->profile()), extension); | 221 extensions::ExtensionPrefs::Get(controller()->profile()), extension); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void ExtensionLauncherContextMenu::SetLaunchType(extensions::LaunchType type) { | 224 void ExtensionLauncherContextMenu::SetLaunchType(extensions::LaunchType type) { |
| 225 extensions::SetLaunchType(controller()->profile(), item().id.app_id, type); | 225 extensions::SetLaunchType(controller()->profile(), item().id.app_id, type); |
| 226 } | 226 } |
| OLD | NEW |