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

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

Issue 10071035: RefCounted types should not have public destructors, chrome/browser/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
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 // Creates a menu model for the given extension action. 27 // Creates a menu model for the given extension action.
28 ExtensionContextMenuModel(const Extension* extension, Browser* browser); 28 ExtensionContextMenuModel(const Extension* extension, Browser* browser);
29 virtual ~ExtensionContextMenuModel();
30 29
31 // SimpleMenuModel::Delegate overrides. 30 // SimpleMenuModel::Delegate overrides.
32 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 31 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
33 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 32 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
34 virtual bool GetAcceleratorForCommandId( 33 virtual bool GetAcceleratorForCommandId(
35 int command_id, 34 int command_id,
36 ui::Accelerator* accelerator) OVERRIDE; 35 ui::Accelerator* accelerator) OVERRIDE;
37 virtual void ExecuteCommand(int command_id) OVERRIDE; 36 virtual void ExecuteCommand(int command_id) OVERRIDE;
38 37
39 // ExtensionUninstallDialog::Delegate: 38 // ExtensionUninstallDialog::Delegate:
40 virtual void ExtensionUninstallAccepted() OVERRIDE; 39 virtual void ExtensionUninstallAccepted() OVERRIDE;
41 virtual void ExtensionUninstallCanceled() OVERRIDE; 40 virtual void ExtensionUninstallCanceled() OVERRIDE;
42 41
43 private: 42 private:
43 friend class base::RefCounted<ExtensionContextMenuModel>;
44 virtual ~ExtensionContextMenuModel();
45
44 void InitCommonCommands(); 46 void InitCommonCommands();
45 47
46 // Gets the extension we are displaying the menu for. Returns NULL if the 48 // Gets the extension we are displaying the menu for. Returns NULL if the
47 // extension has been uninstalled and no longer exists. 49 // extension has been uninstalled and no longer exists.
48 const Extension* GetExtension() const; 50 const Extension* GetExtension() const;
49 51
50 // A copy of the extension's id. 52 // A copy of the extension's id.
51 std::string extension_id_; 53 std::string extension_id_;
52 54
53 // The extension action we are displaying the menu for (or NULL). 55 // The extension action we are displaying the menu for (or NULL).
54 ExtensionAction* extension_action_; 56 ExtensionAction* extension_action_;
55 57
56 Browser* browser_; 58 Browser* browser_;
57 59
58 Profile* profile_; 60 Profile* profile_;
59 61
60 // Keeps track of the extension uninstall dialog. 62 // Keeps track of the extension uninstall dialog.
61 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; 63 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_;
62 64
63 DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel); 65 DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel);
64 }; 66 };
65 67
66 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_ 68 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_context_menu_api.h ('k') | chrome/browser/extensions/extension_context_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698