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 #import "base/mac/scoped_nsobject.h"
15 #include "ui/base/window_open_disposition.h"
17 class BookmarkMenuBridge
;
23 @interface BookmarkMenuCocoaController
: NSObject
<NSMenuDelegate
> {
25 BookmarkMenuBridge
* bridge_
; // weak; owns me
26 base::scoped_nsobject
<NSMenu
> menu_
;
30 @
property(nonatomic
, readonly
) NSMenu
* menu
;
32 // Return an autoreleased string to be used as a menu title for the
33 // given bookmark node.
34 + (NSString
*)menuTitleForNode
:(const bookmarks::BookmarkNode
*)node
;
36 // Make a relevant tooltip string for node.
37 + (NSString
*)tooltipForNode
:(const bookmarks::BookmarkNode
*)node
;
39 - (id
)initWithBridge
:(BookmarkMenuBridge
*)bridge
40 andMenu
:(NSMenu
*)menu
;
42 // Called by any Bookmark menu item.
43 // The menu item's tag is the bookmark ID.
44 - (IBAction
)openBookmarkMenuItem
:(id
)sender
;
45 - (IBAction
)openAllBookmarks
:(id
)sender
;
46 - (IBAction
)openAllBookmarksNewWindow
:(id
)sender
;
47 - (IBAction
)openAllBookmarksIncognitoWindow
:(id
)sender
;
49 @end
// BookmarkMenuCocoaController
52 @interface
BookmarkMenuCocoaController (ExposedForUnitTests
)
53 - (const bookmarks::BookmarkNode
*)nodeForIdentifier
:(int)identifier
;
54 - (void)openURLForNode
:(const bookmarks::BookmarkNode
*)node
;
55 - (void)openAll
:(NSInteger
)tag
56 withDisposition
:(WindowOpenDisposition
)disposition
;
57 @end
// BookmarkMenuCocoaController (ExposedForUnitTests)
59 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_