• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
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.
8 
9 #ifndef 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
12 
13 #import <Cocoa/Cocoa.h>
14 
15 #import "base/mac/cocoa_protocols.h"
16 #include "webkit/glue/window_open_disposition.h"
17 
18 class BookmarkNode;
19 class BookmarkMenuBridge;
20 
21 @interface BookmarkMenuCocoaController : NSObject<NSMenuDelegate> {
22  @private
23   BookmarkMenuBridge* bridge_;  // weak; owns me
24 }
25 
26 // The Bookmarks menu
27 @property(nonatomic, readonly) NSMenu* menu;
28 
29 // Return an autoreleased string to be used as a menu title for the
30 // given bookmark node.
31 + (NSString*)menuTitleForNode:(const BookmarkNode*)node;
32 
33 - (id)initWithBridge:(BookmarkMenuBridge *)bridge;
34 
35 // Called by any Bookmark menu item.
36 // The menu item's tag is the bookmark ID.
37 - (IBAction)openBookmarkMenuItem:(id)sender;
38 - (IBAction)openAllBookmarks:(id)sender;
39 - (IBAction)openAllBookmarksNewWindow:(id)sender;
40 - (IBAction)openAllBookmarksIncognitoWindow:(id)sender;
41 
42 @end  // BookmarkMenuCocoaController
43 
44 
45 @interface BookmarkMenuCocoaController (ExposedForUnitTests)
46 - (const BookmarkNode*)nodeForIdentifier:(int)identifier;
47 - (void)openURLForNode:(const BookmarkNode*)node;
48 - (void)openAll:(NSInteger)tag
49     withDisposition:(WindowOpenDisposition)disposition;
50 @end  // BookmarkMenuCocoaController (ExposedForUnitTests)
51 
52 #endif  // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_
53