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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 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) 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 "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/extensions/extension_uninstall_dialog.h" 12 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
13 #include "ui/base/models/simple_menu_model.h" 13 #include "ui/base/models/simple_menu_model.h"
14 14
15 class Browser; 15 class Browser;
16 class Extension;
17 class ExtensionAction; 16 class ExtensionAction;
18 class Profile; 17 class Profile;
19 18
19 namespace extensions {
20 class Extension;
21 }
22
20 // The menu model for the context menu for extension action icons (browser and 23 // The menu model for the context menu for extension action icons (browser and
21 // page actions). 24 // page actions).
22 class ExtensionContextMenuModel 25 class ExtensionContextMenuModel
23 : public base::RefCounted<ExtensionContextMenuModel>, 26 : public base::RefCounted<ExtensionContextMenuModel>,
24 public ui::SimpleMenuModel, 27 public ui::SimpleMenuModel,
25 public ui::SimpleMenuModel::Delegate, 28 public ui::SimpleMenuModel::Delegate,
26 public ExtensionUninstallDialog::Delegate { 29 public ExtensionUninstallDialog::Delegate {
27 public: 30 public:
28 // Creates a menu model for the given extension action. 31 // Creates a menu model for the given extension action.
29 ExtensionContextMenuModel(const Extension* extension, Browser* browser); 32 ExtensionContextMenuModel(const extensions::Extension* extension,
33 Browser* browser);
30 34
31 // SimpleMenuModel::Delegate overrides. 35 // SimpleMenuModel::Delegate overrides.
32 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 36 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
33 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 37 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
34 virtual bool GetAcceleratorForCommandId( 38 virtual bool GetAcceleratorForCommandId(
35 int command_id, 39 int command_id,
36 ui::Accelerator* accelerator) OVERRIDE; 40 ui::Accelerator* accelerator) OVERRIDE;
37 virtual void ExecuteCommand(int command_id) OVERRIDE; 41 virtual void ExecuteCommand(int command_id) OVERRIDE;
38 42
39 // ExtensionUninstallDialog::Delegate: 43 // ExtensionUninstallDialog::Delegate:
40 virtual void ExtensionUninstallAccepted() OVERRIDE; 44 virtual void ExtensionUninstallAccepted() OVERRIDE;
41 virtual void ExtensionUninstallCanceled() OVERRIDE; 45 virtual void ExtensionUninstallCanceled() OVERRIDE;
42 46
43 private: 47 private:
44 friend class base::RefCounted<ExtensionContextMenuModel>; 48 friend class base::RefCounted<ExtensionContextMenuModel>;
45 virtual ~ExtensionContextMenuModel(); 49 virtual ~ExtensionContextMenuModel();
46 50
47 void InitCommonCommands(); 51 void InitCommonCommands();
48 52
49 // Gets the extension we are displaying the menu for. Returns NULL if the 53 // Gets the extension we are displaying the menu for. Returns NULL if the
50 // extension has been uninstalled and no longer exists. 54 // extension has been uninstalled and no longer exists.
51 const Extension* GetExtension() const; 55 const extensions::Extension* GetExtension() const;
52 56
53 // A copy of the extension's id. 57 // A copy of the extension's id.
54 std::string extension_id_; 58 std::string extension_id_;
55 59
56 // The extension action we are displaying the menu for (or NULL). 60 // The extension action we are displaying the menu for (or NULL).
57 ExtensionAction* extension_action_; 61 ExtensionAction* extension_action_;
58 62
59 Browser* browser_; 63 Browser* browser_;
60 64
61 Profile* profile_; 65 Profile* profile_;
62 66
63 // Keeps track of the extension uninstall dialog. 67 // Keeps track of the extension uninstall dialog.
64 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; 68 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_;
65 69
66 DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel); 70 DISALLOW_COPY_AND_ASSIGN(ExtensionContextMenuModel);
67 }; 71 };
68 72
69 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_ 73 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTEXT_MENU_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698