| 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 #ifndef CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_CONTEXT_MENU_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_EXTENSION_LAUNCHER_CONTEXT_MENU_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_CONTEXT_MENU_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_EXTENSION_LAUNCHER_CONTEXT_MENU_H_ |
| 7 | |
| 8 #include <string> | |
| 9 | 7 |
| 10 #include "base/macros.h" | 8 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/browser/ui/app_list/app_context_menu.h" | 10 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 13 | 11 |
| 14 class AppListControllerDelegate; | 12 class ChromeLauncherController; |
| 15 class Profile; | 13 |
| 14 namespace ash { |
| 15 class Shelf; |
| 16 struct ShelfItem; |
| 17 } |
| 16 | 18 |
| 17 namespace extensions { | 19 namespace extensions { |
| 18 class ContextMenuMatcher; | 20 class ContextMenuMatcher; |
| 19 } | 21 } |
| 20 | 22 |
| 21 namespace app_list { | 23 // Class for context menu which is shown for a regular extension item in the |
| 22 | 24 // shelf. |
| 23 class AppContextMenuDelegate; | 25 class ExtensionLauncherContextMenu : public LauncherContextMenu { |
| 24 | |
| 25 class ExtensionAppContextMenu : public AppContextMenu { | |
| 26 public: | 26 public: |
| 27 ExtensionAppContextMenu(AppContextMenuDelegate* delegate, | 27 ExtensionLauncherContextMenu(ChromeLauncherController* controller, |
| 28 Profile* profile, | 28 const ash::ShelfItem* item, |
| 29 const std::string& app_id, | 29 ash::Shelf* shelf); |
| 30 AppListControllerDelegate* controller); | 30 ~ExtensionLauncherContextMenu() override; |
| 31 ~ExtensionAppContextMenu() override; | |
| 32 | |
| 33 static void DisableInstalledExtensionCheckForTesting(bool disable); | |
| 34 | |
| 35 // AppListContextMenu overrides: | |
| 36 ui::MenuModel* GetMenuModel() override; | |
| 37 void BuildMenu(ui::SimpleMenuModel* menu_model) override; | |
| 38 | 31 |
| 39 // ui::SimpleMenuModel::Delegate overrides: | 32 // ui::SimpleMenuModel::Delegate overrides: |
| 33 bool IsItemForCommandIdDynamic(int command_id) const override; |
| 40 base::string16 GetLabelForCommandId(int command_id) const override; | 34 base::string16 GetLabelForCommandId(int command_id) const override; |
| 41 bool IsItemForCommandIdDynamic(int command_id) const override; | |
| 42 bool IsCommandIdChecked(int command_id) const override; | 35 bool IsCommandIdChecked(int command_id) const override; |
| 43 bool IsCommandIdEnabled(int command_id) const override; | 36 bool IsCommandIdEnabled(int command_id) const override; |
| 44 void ExecuteCommand(int command_id, int event_flags) override; | 37 void ExecuteCommand(int command_id, int event_flags) override; |
| 45 | 38 |
| 46 void set_is_platform_app(bool is_platform_app) { | 39 private: |
| 47 is_platform_app_ = is_platform_app; | 40 void Init(); |
| 48 } | |
| 49 | 41 |
| 50 private: | 42 scoped_ptr<extensions::ContextMenuMatcher> extension_items_; |
| 51 bool is_platform_app_ = false; | |
| 52 | 43 |
| 53 scoped_ptr<extensions::ContextMenuMatcher> extension_menu_items_; | 44 DISALLOW_COPY_AND_ASSIGN(ExtensionLauncherContextMenu); |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(ExtensionAppContextMenu); | |
| 56 }; | 45 }; |
| 57 | 46 |
| 58 } // namespace app_list | 47 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_EXTENSION_LAUNCHER_CONTEXT_MENU_H_ |
| 59 | |
| 60 #endif // CHROME_BROWSER_UI_APP_LIST_EXTENSION_APP_CONTEXT_MENU_H_ | |
| OLD | NEW |