Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: chrome/browser/extensions/extension_action_context_menu_model.h

Issue 1001002: Initial support for inspecting extension popups. (Closed)
Patch Set: pre submit Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_ACTION_CONTEXT_MENU_MODEL_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_MODEL_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_MODEL_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_MODEL_H_
7 7
8 #include "app/menus/simple_menu_model.h" 8 #include "app/menus/simple_menu_model.h"
9 #include "chrome/browser/extensions/extension_install_ui.h" 9 #include "chrome/browser/extensions/extension_install_ui.h"
10 10
11 class Extension; 11 class Extension;
12 class ExtensionAction;
13 class PrefService;
12 14
13 // The menu model for the context menu for extension action icons (browser and 15 // The menu model for the context menu for extension action icons (browser and
14 // page actions). 16 // page actions).
15 class ExtensionActionContextMenuModel 17 class ExtensionActionContextMenuModel
16 : public menus::SimpleMenuModel, 18 : public menus::SimpleMenuModel,
17 public menus::SimpleMenuModel::Delegate, 19 public menus::SimpleMenuModel::Delegate,
18 public ExtensionInstallUI::Delegate { 20 public ExtensionInstallUI::Delegate {
19 public: 21 public:
20 explicit ExtensionActionContextMenuModel(Extension* extension); 22 // Delegate to handle menu commands.
23 class MenuDelegate {
24 public:
25 // Called when the user selects the menu item which requests that the
26 // popup be shown and inspected.
27 virtual void ShowPopupForDevToolsWindow(Extension* extension,
28 ExtensionAction* extension_action) {
29 }
30 };
31
32 // |extension_action|, |prefs|, & |delegate| call all be NULL. If valid
33 // values are provided for all three, and prefs::kExtensionsUIDeveloperMode
34 // is enabled in the PrefService, a menu item will be shown for "Inspect
35 // Popup" which, when selected, will cause ShowPopupForDevToolsWindow() to be
36 // called on |delegate|.
37 ExtensionActionContextMenuModel(Extension* extension,
38 ExtensionAction* extension_action,
39 PrefService* prefs,
40 MenuDelegate* delegate);
21 ~ExtensionActionContextMenuModel(); 41 ~ExtensionActionContextMenuModel();
22 42
23 // SimpleMenuModel behavior overrides. 43 // SimpleMenuModel behavior overrides.
24 virtual bool IsCommandIdChecked(int command_id) const; 44 virtual bool IsCommandIdChecked(int command_id) const;
25 virtual bool IsCommandIdEnabled(int command_id) const; 45 virtual bool IsCommandIdEnabled(int command_id) const;
26 virtual bool GetAcceleratorForCommandId(int command_id, 46 virtual bool GetAcceleratorForCommandId(int command_id,
27 menus::Accelerator* accelerator); 47 menus::Accelerator* accelerator);
28 virtual void ExecuteCommand(int command_id); 48 virtual void ExecuteCommand(int command_id);
29 49
30 // ExtensionInstallUI::Delegate overrides. 50 // ExtensionInstallUI::Delegate overrides.
31 virtual void InstallUIProceed(bool create_app); 51 virtual void InstallUIProceed(bool create_app);
32 virtual void InstallUIAbort() {} 52 virtual void InstallUIAbort() {}
33 53
34 private: 54 private:
35 // The extension we are displaying the context menu for. 55 // The extension we are displaying the context menu for.
36 Extension* extension_; 56 Extension* extension_;
37 57
58 // The extension action we are displaying the context menu for.
59 ExtensionAction* extension_action_;
60
61 // The delegate which handles the 'inspect popup' menu command.
62 MenuDelegate* delegate_;
63
38 DISALLOW_COPY_AND_ASSIGN(ExtensionActionContextMenuModel); 64 DISALLOW_COPY_AND_ASSIGN(ExtensionActionContextMenuModel);
39 }; 65 };
40 66
41 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_MODEL_H_ 67 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_manager.cc ('k') | chrome/browser/extensions/extension_action_context_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698