1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/memory/scoped_ptr.h"
12 class AsyncUninstaller
;
14 class ExtensionAction
;
16 namespace extensions
{
20 // Controller for extension context menu. This class builds the context menu
21 // and handles actions. This is mostly used when the user right clicks on
22 // page and browser actions in the toolbar.
23 @interface ExtensionActionContextMenuController
: NSObject
{
25 // The extension that the menu belongs to. Weak.
26 const extensions::Extension
* extension_
;
28 // The extension action the menu belongs to. Weak.
29 ExtensionAction
* action_
;
31 // The browser that contains this extension. Weak.
34 // Used to load the extension icon asynchronously on the I/O thread then show
35 // the uninstall confirmation dialog.
36 scoped_ptr
<AsyncUninstaller
> uninstaller_
;
39 // Initializes and returns a context menu controller for the given extension and
41 - (id
)initWithExtension
:(const extensions::Extension
*)extension
42 browser
:(Browser
*)browser
43 extensionAction
:(ExtensionAction
*)action
;
45 // Adds context menu items to the given menu.
46 - (void)populateMenu
:(NSMenu
*)menu
;
50 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_