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.
4
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_
7
8#import <Cocoa/Cocoa.h>
9
10#include "base/memory/scoped_ptr.h"
11
12class AsyncUninstaller;
13class Browser;
14class ExtensionAction;
15
16namespace extensions {
17class Extension;
18}
19
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 {
24 @private
25  // The extension that the menu belongs to. Weak.
26  const extensions::Extension* extension_;
27
28  // The extension action the menu belongs to. Weak.
29  ExtensionAction* action_;
30
31  // The browser that contains this extension. Weak.
32  Browser* browser_;
33
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_;
37}
38
39// Initializes and returns a context menu controller for the given extension and
40// browser.
41- (id)initWithExtension:(const extensions::Extension*)extension
42                browser:(Browser*)browser
43        extensionAction:(ExtensionAction*)action;
44
45// Adds context menu items to the given menu.
46- (void)populateMenu:(NSMenu*)menu;
47
48@end
49
50#endif  // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_
51