Index: chrome/browser/extensions/extension_context_menu_model.h |
=================================================================== |
--- chrome/browser/extensions/extension_context_menu_model.h (revision 41960) |
+++ chrome/browser/extensions/extension_context_menu_model.h (working copy) |
@@ -1,46 +1,43 @@ |
-// Copyright (c) 2009 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_MODEL_H_ |
-#define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_MODEL_H_ |
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_ |
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_ |
#include "app/menus/simple_menu_model.h" |
#include "chrome/browser/extensions/extension_install_ui.h" |
+class Browser; |
class Extension; |
class ExtensionAction; |
-class PrefService; |
+class Profile; |
// The menu model for the context menu for extension action icons (browser and |
// page actions). |
-class ExtensionActionContextMenuModel |
+class ExtensionContextMenuModel |
: public menus::SimpleMenuModel, |
public menus::SimpleMenuModel::Delegate, |
public ExtensionInstallUI::Delegate { |
public: |
- // Delegate to handle menu commands. |
- class MenuDelegate { |
+ // Delegate to handle showing an ExtensionAction popup. |
+ class PopupDelegate { |
public: |
// Called when the user selects the menu item which requests that the |
// popup be shown and inspected. |
- virtual void ShowPopupForDevToolsWindow(Extension* extension, |
- ExtensionAction* extension_action) { |
- } |
+ virtual void InspectPopup(ExtensionAction* action) = 0; |
}; |
- // |extension_action|, |prefs|, & |delegate| call all be NULL. If valid |
- // values are provided for all three, and prefs::kExtensionsUIDeveloperMode |
- // is enabled in the PrefService, a menu item will be shown for "Inspect |
- // Popup" which, when selected, will cause ShowPopupForDevToolsWindow() to be |
- // called on |delegate|. |
- ExtensionActionContextMenuModel(Extension* extension, |
- ExtensionAction* extension_action, |
- PrefService* prefs, |
- MenuDelegate* delegate); |
- ~ExtensionActionContextMenuModel(); |
+ // Creates a menu model for the given extension action. If |
+ // prefs::kExtensionsUIDeveloperMode is enabled then a menu item |
+ // will be shown for "Inspect Popup" which, when selected, will cause |
+ // ShowPopupForDevToolsWindow() to be called on |delegate|. |
+ ExtensionContextMenuModel(Extension* extension, |
+ Browser* browser, |
+ PopupDelegate* delegate); |
+ virtual ~ExtensionContextMenuModel(); |
- // SimpleMenuModel behavior overrides. |
+ // SimpleMenuModel::Delegate overrides. |
virtual bool IsCommandIdChecked(int command_id) const; |
virtual bool IsCommandIdEnabled(int command_id) const; |
virtual bool GetAcceleratorForCommandId(int command_id, |
@@ -52,16 +49,22 @@ |
virtual void InstallUIAbort() {} |
private: |
- // The extension we are displaying the context menu for. |
+ void InitCommonCommands(); |
+ |
+ // The extension we are displaying the menu for. |
Extension* extension_; |
- // The extension action we are displaying the context menu for. |
+ // The extension action we are displaying the menu for (or NULL). |
ExtensionAction* extension_action_; |
- // The delegate which handles the 'inspect popup' menu command. |
- MenuDelegate* delegate_; |
+ Browser* browser_; |
- DISALLOW_COPY_AND_ASSIGN(ExtensionActionContextMenuModel); |
+ Profile* profile_; |
+ |
+ // The delegate which handles the 'inspect popup' menu command (or NULL). |
+ PopupDelegate* delegate_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel); |
}; |
-#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_MODEL_H_ |
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_ |
Property changes on: chrome/browser/extensions/extension_context_menu_model.h |
___________________________________________________________________ |
Added: svn:mergeinfo |