1424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// found in the LICENSE file. 4424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 5424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_CONTROLLER_H_ 6424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_CONTROLLER_H_ 7424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 8424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#import <Cocoa/Cocoa.h> 9424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 10424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 11424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 12424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class AsyncUninstaller; 13424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class Browser; 14424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class ExtensionAction; 15424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 16424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)namespace extensions { 17424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class Extension; 18424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)} 19424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 20424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// Controller for extension context menu. This class builds the context menu 21424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// and handles actions. This is mostly used when the user right clicks on 22424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// page and browser actions in the toolbar. 23424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)@interface ExtensionActionContextMenuController : NSObject { 24424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) @private 25424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // The extension that the menu belongs to. Weak. 26424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) const extensions::Extension* extension_; 27424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 28424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // The extension action the menu belongs to. Weak. 29424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) ExtensionAction* action_; 30424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 31424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // The browser that contains this extension. Weak. 32424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) Browser* browser_; 33424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 34424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // Used to load the extension icon asynchronously on the I/O thread then show 35424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // the uninstall confirmation dialog. 36424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) scoped_ptr<AsyncUninstaller> uninstaller_; 37424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)} 38424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 39424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// Initializes and returns a context menu controller for the given extension and 40424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// browser. 41424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)- (id)initWithExtension:(const extensions::Extension*)extension 42424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) browser:(Browser*)browser 43424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) extensionAction:(ExtensionAction*)action; 44424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 45424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// Adds context menu items to the given menu. 46424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)- (void)populateMenu:(NSMenu*)menu; 47424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 48424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)@end 49424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 50424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)#endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_ 51