| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/browser/extensions/extension_uninstall_dialog.h" | 11 #include "chrome/browser/extensions/extension_uninstall_dialog.h" |
| 12 #include "ui/base/models/simple_menu_model.h" | 12 #include "ui/base/models/simple_menu_model.h" |
| 13 | 13 |
| 14 class Browser; | 14 class Browser; |
| 15 class Extension; | 15 class Extension; |
| 16 class ExtensionAction; | 16 class ExtensionAction; |
| 17 class Profile; | 17 class Profile; |
| 18 | 18 |
| 19 // The menu model for the context menu for extension action icons (browser and | 19 // The menu model for the context menu for extension action icons (browser and |
| 20 // page actions). | 20 // page actions). |
| 21 class ExtensionContextMenuModel | 21 class ExtensionContextMenuModel |
| 22 : public base::RefCounted<ExtensionContextMenuModel>, | 22 : public base::RefCounted<ExtensionContextMenuModel>, |
| 23 public ui::SimpleMenuModel, | 23 public ui::SimpleMenuModel, |
| 24 public ui::SimpleMenuModel::Delegate, | 24 public ui::SimpleMenuModel::Delegate, |
| 25 public ExtensionUninstallDialog::Delegate { | 25 public ExtensionUninstallDialog::Delegate { |
| 26 public: | 26 public: |
| 27 enum MenuEntries { |
| 28 NAME = 0, |
| 29 CONFIGURE, |
| 30 HIDE, |
| 31 DISABLE, |
| 32 UNINSTALL, |
| 33 MANAGE |
| 34 }; |
| 35 |
| 27 // Creates a menu model for the given extension action. | 36 // Creates a menu model for the given extension action. |
| 28 ExtensionContextMenuModel(const Extension* extension, Browser* browser); | 37 ExtensionContextMenuModel(const Extension* extension, Browser* browser); |
| 29 | 38 |
| 30 // SimpleMenuModel::Delegate overrides. | 39 // SimpleMenuModel::Delegate overrides. |
| 31 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 40 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
| 32 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 41 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
| 33 virtual bool GetAcceleratorForCommandId( | 42 virtual bool GetAcceleratorForCommandId( |
| 34 int command_id, | 43 int command_id, |
| 35 ui::Accelerator* accelerator) OVERRIDE; | 44 ui::Accelerator* accelerator) OVERRIDE; |
| 36 virtual void ExecuteCommand(int command_id) OVERRIDE; | 45 virtual void ExecuteCommand(int command_id) OVERRIDE; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 59 | 68 |
| 60 Profile* profile_; | 69 Profile* profile_; |
| 61 | 70 |
| 62 // Keeps track of the extension uninstall dialog. | 71 // Keeps track of the extension uninstall dialog. |
| 63 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; | 72 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; |
| 64 | 73 |
| 65 DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel); | 74 DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel); |
| 66 }; | 75 }; |
| 67 | 76 |
| 68 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_ | 77 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_ |
| OLD | NEW |