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
3 // found in the LICENSE file.
5 // Controller (MVC) for the bookmark menu.
6 // All bookmark menu item commands get directed here.
7 // Unfortunately there is already a C++ class named BookmarkMenuController.
9 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_
10 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_
12 #import <Cocoa/Cocoa.h>
14 #include "ui/base/window_open_disposition.h"
17 class BookmarkMenuBridge
;
19 @interface BookmarkMenuCocoaController
: NSObject
<NSMenuDelegate
> {
21 BookmarkMenuBridge
* bridge_
; // weak; owns me
26 @
property(nonatomic
, readonly
) NSMenu
* menu
;
28 // Return an autoreleased string to be used as a menu title for the
29 // given bookmark node.
30 + (NSString
*)menuTitleForNode
:(const BookmarkNode
*)node
;
32 // Make a relevant tooltip string for node.
33 + (NSString
*)tooltipForNode
:(const BookmarkNode
*)node
;
35 - (id
)initWithBridge
:(BookmarkMenuBridge
*)bridge
36 andMenu
:(NSMenu
*)menu
;
38 // Called by any Bookmark menu item.
39 // The menu item's tag is the bookmark ID.
40 - (IBAction
)openBookmarkMenuItem
:(id
)sender
;
41 - (IBAction
)openAllBookmarks
:(id
)sender
;
42 - (IBAction
)openAllBookmarksNewWindow
:(id
)sender
;
43 - (IBAction
)openAllBookmarksIncognitoWindow
:(id
)sender
;
45 @end
// BookmarkMenuCocoaController
48 @interface
BookmarkMenuCocoaController (ExposedForUnitTests
)
49 - (const BookmarkNode
*)nodeForIdentifier
:(int)identifier
;
50 - (void)openURLForNode
:(const BookmarkNode
*)node
;
51 - (void)openAll
:(NSInteger
)tag
52 withDisposition
:(WindowOpenDisposition
)disposition
;
53 @end
// BookmarkMenuCocoaController (ExposedForUnitTests)
55 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_