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