| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 | 10 |
| 11 #include "base/memory/scoped_nsobject.h" | 11 #include "base/memory/scoped_nsobject.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 | 13 |
| 14 class AsyncUninstaller; | 14 class AsyncUninstaller; |
| 15 class Extension; | 15 class Extension; |
| 16 class ExtensionAction; | 16 class ExtensionAction; |
| 17 class Profile; | 17 class Profile; |
| 18 | 18 |
| 19 namespace extension_action_context_menu { | 19 namespace extension_action_context_menu { |
| 20 | 20 |
| 21 class DevmodeObserver; | |
| 22 class ProfileObserverBridge; | |
| 23 | |
| 24 } // namespace extension_action_context_menu | 21 } // namespace extension_action_context_menu |
| 25 | 22 |
| 26 // A context menu used by any extension UI components that require it. | 23 // A context menu used by any extension UI components that require it. |
| 27 @interface ExtensionActionContextMenu : NSMenu { | 24 @interface ExtensionActionContextMenu : NSMenu { |
| 28 @private | 25 @private |
| 29 // The extension that this menu belongs to. Weak. | 26 // The extension that this menu belongs to. Weak. |
| 30 const Extension* extension_; | 27 const Extension* extension_; |
| 31 | 28 |
| 32 // The extension action this menu belongs to. Weak. | 29 // The extension action this menu belongs to. Weak. |
| 33 ExtensionAction* action_; | 30 ExtensionAction* action_; |
| 34 | 31 |
| 35 // The browser profile of the window that contains this extension. Weak. | 32 // The browser profile of the window that contains this extension. Weak. |
| 36 Profile* profile_; | 33 Profile* profile_; |
| 37 | 34 |
| 38 // The inspector menu item. Need to keep this around to add and remove it. | |
| 39 scoped_nsobject<NSMenuItem> inspectorItem_; | |
| 40 | |
| 41 // The observer used to listen for pref changed notifications. | |
| 42 scoped_ptr<extension_action_context_menu::DevmodeObserver> observer_; | |
| 43 | |
| 44 // The observer used to reset |observer_| when the profile is destroyed. | |
| 45 scoped_ptr<extension_action_context_menu::ProfileObserverBridge> | |
| 46 profile_observer_; | |
| 47 | |
| 48 // Used to load the extension icon asynchronously on the I/O thread then show | 35 // Used to load the extension icon asynchronously on the I/O thread then show |
| 49 // the uninstall confirmation dialog. | 36 // the uninstall confirmation dialog. |
| 50 scoped_ptr<AsyncUninstaller> uninstaller_; | 37 scoped_ptr<AsyncUninstaller> uninstaller_; |
| 51 } | 38 } |
| 52 | 39 |
| 53 // Initializes and returns a context menu for the given extension and profile. | 40 // Initializes and returns a context menu for the given extension and profile. |
| 54 - (id)initWithExtension:(const Extension*)extension | 41 - (id)initWithExtension:(const Extension*)extension |
| 55 profile:(Profile*)profile | 42 profile:(Profile*)profile |
| 56 extensionAction:(ExtensionAction*)action; | 43 extensionAction:(ExtensionAction*)action; |
| 57 | 44 |
| 58 // Show or hide the inspector menu item. | |
| 59 - (void)updateInspectorItem; | |
| 60 | |
| 61 // Notifies the ExtensionActionContextMenu that the profile is is being | |
| 62 // destroyed. | |
| 63 - (void)invalidateProfile; | |
| 64 | |
| 65 @end | 45 @end |
| 66 | 46 |
| 67 typedef ExtensionActionContextMenu ExtensionActionContextMenuMac; | 47 typedef ExtensionActionContextMenu ExtensionActionContextMenuMac; |
| 68 | 48 |
| 69 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_ | 49 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_CONTEXT_MENU_H_ |
| OLD | NEW |