| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 11 |
| 12 #import <Cocoa/Cocoa.h> | 12 #import <Cocoa/Cocoa.h> |
| 13 | 13 |
| 14 #import "base/mac/scoped_nsobject.h" | 14 #import "base/mac/scoped_nsobject.h" |
| 15 #include "ui/base/window_open_disposition.h" | 15 #include "ui/base/window_open_disposition.h" |
| 16 | 16 |
| 17 class BookmarkMenuBridge; |
| 18 |
| 19 namespace bookmarks { |
| 17 class BookmarkNode; | 20 class BookmarkNode; |
| 18 class BookmarkMenuBridge; | 21 } |
| 19 | 22 |
| 20 @interface BookmarkMenuCocoaController : NSObject<NSMenuDelegate> { | 23 @interface BookmarkMenuCocoaController : NSObject<NSMenuDelegate> { |
| 21 @private | 24 @private |
| 22 BookmarkMenuBridge* bridge_; // weak; owns me | 25 BookmarkMenuBridge* bridge_; // weak; owns me |
| 23 base::scoped_nsobject<NSMenu> menu_; | 26 base::scoped_nsobject<NSMenu> menu_; |
| 24 } | 27 } |
| 25 | 28 |
| 26 // The Bookmarks menu | 29 // The Bookmarks menu |
| 27 @property(nonatomic, readonly) NSMenu* menu; | 30 @property(nonatomic, readonly) NSMenu* menu; |
| 28 | 31 |
| 29 // Return an autoreleased string to be used as a menu title for the | 32 // Return an autoreleased string to be used as a menu title for the |
| 30 // given bookmark node. | 33 // given bookmark node. |
| 31 + (NSString*)menuTitleForNode:(const BookmarkNode*)node; | 34 + (NSString*)menuTitleForNode:(const bookmarks::BookmarkNode*)node; |
| 32 | 35 |
| 33 // Make a relevant tooltip string for node. | 36 // Make a relevant tooltip string for node. |
| 34 + (NSString*)tooltipForNode:(const BookmarkNode*)node; | 37 + (NSString*)tooltipForNode:(const bookmarks::BookmarkNode*)node; |
| 35 | 38 |
| 36 - (id)initWithBridge:(BookmarkMenuBridge *)bridge | 39 - (id)initWithBridge:(BookmarkMenuBridge *)bridge |
| 37 andMenu:(NSMenu*)menu; | 40 andMenu:(NSMenu*)menu; |
| 38 | 41 |
| 39 // Called by any Bookmark menu item. | 42 // Called by any Bookmark menu item. |
| 40 // The menu item's tag is the bookmark ID. | 43 // The menu item's tag is the bookmark ID. |
| 41 - (IBAction)openBookmarkMenuItem:(id)sender; | 44 - (IBAction)openBookmarkMenuItem:(id)sender; |
| 42 - (IBAction)openAllBookmarks:(id)sender; | 45 - (IBAction)openAllBookmarks:(id)sender; |
| 43 - (IBAction)openAllBookmarksNewWindow:(id)sender; | 46 - (IBAction)openAllBookmarksNewWindow:(id)sender; |
| 44 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender; | 47 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender; |
| 45 | 48 |
| 46 @end // BookmarkMenuCocoaController | 49 @end // BookmarkMenuCocoaController |
| 47 | 50 |
| 48 | 51 |
| 49 @interface BookmarkMenuCocoaController (ExposedForUnitTests) | 52 @interface BookmarkMenuCocoaController (ExposedForUnitTests) |
| 50 - (const BookmarkNode*)nodeForIdentifier:(int)identifier; | 53 - (const bookmarks::BookmarkNode*)nodeForIdentifier:(int)identifier; |
| 51 - (void)openURLForNode:(const BookmarkNode*)node; | 54 - (void)openURLForNode:(const bookmarks::BookmarkNode*)node; |
| 52 - (void)openAll:(NSInteger)tag | 55 - (void)openAll:(NSInteger)tag |
| 53 withDisposition:(WindowOpenDisposition)disposition; | 56 withDisposition:(WindowOpenDisposition)disposition; |
| 54 @end // BookmarkMenuCocoaController (ExposedForUnitTests) | 57 @end // BookmarkMenuCocoaController (ExposedForUnitTests) |
| 55 | 58 |
| 56 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_ | 59 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_ |
| OLD | NEW |