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 // Controller (MVC) for the bookmark menu. | 5 // Controller (MVC) for the bookmark menu. |
6 // All bookmark menu item commands get directed here. | 6 // All bookmark menu item commands get directed here. |
7 // Unfortunately there is already a C++ class named BookmarkMenuController. | 7 // Unfortunately there is already a C++ class named BookmarkMenuController. |
8 | 8 |
9 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_ | 9 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_ |
10 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_ | 10 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_ |
11 #pragma once | 11 #pragma once |
12 | 12 |
13 #import <Cocoa/Cocoa.h> | 13 #import <Cocoa/Cocoa.h> |
14 | 14 |
15 #import "base/mac/cocoa_protocols.h" | 15 #import "base/mac/cocoa_protocols.h" |
16 | 16 |
17 class BookmarkNode; | 17 class BookmarkNode; |
18 class BookmarkMenuBridge; | 18 class BookmarkMenuBridge; |
19 | 19 |
20 @interface BookmarkMenuCocoaController : NSObject<NSMenuDelegate> { | 20 @interface BookmarkMenuCocoaController : NSObject<NSMenuDelegate> { |
21 @private | 21 @private |
22 BookmarkMenuBridge* bridge_; // weak; owns me | 22 BookmarkMenuBridge* bridge_; // weak; owns me |
23 } | 23 } |
24 | 24 |
25 // The Bookmarks menu | 25 // The Bookmarks menu |
26 @property (nonatomic, readonly) NSMenu* menu; | 26 @property(nonatomic, readonly) NSMenu* menu; |
27 | 27 |
28 // Return an autoreleased string to be used as a menu title for the | 28 // Return an autoreleased string to be used as a menu title for the |
29 // given bookmark node. | 29 // given bookmark node. |
30 + (NSString*)menuTitleForNode:(const BookmarkNode*)node; | 30 + (NSString*)menuTitleForNode:(const BookmarkNode*)node; |
31 | 31 |
32 - (id)initWithBridge:(BookmarkMenuBridge *)bridge; | 32 - (id)initWithBridge:(BookmarkMenuBridge *)bridge; |
33 | 33 |
34 // Called by any Bookmark menu item. | 34 // Called by any Bookmark menu item. |
35 // The menu item's tag is the bookmark ID. | 35 // The menu item's tag is the bookmark ID. |
36 - (IBAction)openBookmarkMenuItem:(id)sender; | 36 - (IBAction)openBookmarkMenuItem:(id)sender; |
37 | 37 |
38 @end // BookmarkMenuCocoaController | 38 @end // BookmarkMenuCocoaController |
39 | 39 |
40 | 40 |
41 @interface BookmarkMenuCocoaController (ExposedForUnitTests) | 41 @interface BookmarkMenuCocoaController (ExposedForUnitTests) |
42 - (const BookmarkNode*)nodeForIdentifier:(int)identifier; | 42 - (const BookmarkNode*)nodeForIdentifier:(int)identifier; |
43 - (void)openURLForNode:(const BookmarkNode*)node; | 43 - (void)openURLForNode:(const BookmarkNode*)node; |
44 @end // BookmarkMenuCocoaController (ExposedForUnitTests) | 44 @end // BookmarkMenuCocoaController (ExposedForUnitTests) |
45 | 45 |
46 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_ | 46 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_ |
OLD | NEW |