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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_ 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_ 7 8 #import <Cocoa/Cocoa.h> 9 10 #include "base/memory/scoped_ptr.h" 11 12 class AsyncUninstaller; 13 class Browser; 14 class ExtensionAction; 15 16 namespace extensions { 17 class Extension; 18 } 19 20 namespace extension_action_context_menu { 21 22 // Enum of menu item choices to their respective indices. Exposed for use in 23 // tests. 24 // NOTE: This must be kept in sync with the implementation of the menu. 25 typedef enum { 26 kExtensionContextName = 0, 27 kExtensionContextOptions = 2, 28 kExtensionContextUninstall = 3, 29 kExtensionContextHide = 4, 30 kExtensionContextManage = 6, 31 kExtensionContextInspect = 7 32 } ExtensionType; 33 34 class DevmodeObserver; 35 36 } // namespace extension_action_context_menu 37 38 // A context menu used by any extension UI components that require it. 39 @interface ExtensionActionContextMenu : NSMenu { 40 @private 41 // The extension that this menu belongs to. Weak. 42 const extensions::Extension* extension_; 43 44 // The extension action this menu belongs to. Weak. 45 ExtensionAction* action_; 46 47 // The browser that contains this extension. Weak. 48 Browser* browser_; 49 50 // The observer used to listen for pref changed notifications. 51 scoped_ptr<extension_action_context_menu::DevmodeObserver> observer_; 52 53 // Used to load the extension icon asynchronously on the I/O thread then show 54 // the uninstall confirmation dialog. 55 scoped_ptr<AsyncUninstaller> uninstaller_; 56 } 57 58 // Initializes and returns a context menu for the given extension and browser. 59 - (id)initWithExtension:(const extensions::Extension*)extension 60 browser:(Browser*)browser 61 extensionAction:(ExtensionAction*)action; 62 @end 63 64 typedef ExtensionActionContextMenu ExtensionActionContextMenuMac; 65 66 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_ 67