Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / bookmarks / bookmark_context_menu_cocoa_controller.h
blobd3b6a16eb787ed5d283ad6b0a15820cd0fa3ee6e
1 // Copyright (c) 2013 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 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_CONTEXT_MENU_COCOA_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_CONTEXT_MENU_COCOA_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/basictypes.h"
11 #include "base/mac/scoped_nsobject.h"
12 #include "base/memory/scoped_ptr.h"
14 @class BookmarkBarController;
15 class BookmarkContextMenuController;
16 class BookmarkContextMenuDelegateBridge;
17 @class MenuController;
19 namespace bookmarks {
20 class BookmarkNode;
23 // A controller to manage bookmark bar context menus. One instance of this
24 // class exists per bookmark bar controller, used for all of its context menus
25 // (including those for items in bookmark bar folder drop downs).
26 @interface BookmarkContextMenuCocoaController : NSObject {
27 @private
28 // Bookmark bar controller, used for retrieving the Browser, Profile and
29 // NSWindow when instantiating the BookmarkContextMenuController. Weak, owns
30 // us.
31 BookmarkBarController* bookmarkBarController_;
33 // Helper for receiving C++ callbacks.
34 scoped_ptr<BookmarkContextMenuDelegateBridge> bridge_;
36 // The current |bookmarkNode_| for which |bookmarkContextMenuController_| and
37 // |menuController_| are initialized. Weak, owned by the BookmarkModel.
38 const bookmarks::BookmarkNode* bookmarkNode_;
40 // The cross-platform BookmarkContextMenuController, containing the logic for
41 // which items and corresponding actions exist in the menu.
42 scoped_ptr<BookmarkContextMenuController> bookmarkContextMenuController_;
44 // Controller responsible for creating a Cocoa NSMenu from the cross-platform
45 // SimpleMenuModel owned by the |bookmarkContextMenuController_|.
46 base::scoped_nsobject<MenuController> menuController_;
49 // Initializes the BookmarkContextMenuCocoaController for the given bookmark
50 // bar |controller|.
51 - (id)initWithBookmarkBarController:(BookmarkBarController*)controller;
53 // Returns an NSMenu customized for |node|. Works under the assumption that
54 // only one menu should ever be shown at a time, and thus caches the last
55 // returned menu and re-creates it if a menu for a different node is requested.
56 // Passing in a NULL |node| will return the menu for "empty" placeholder.
57 - (NSMenu*)menuForBookmarkNode:(const bookmarks::BookmarkNode*)node;
59 // Returns an NSMenu customized for the bookmark bar.
60 - (NSMenu*)menuForBookmarkBar;
62 // Closes the menu, if it's currently open.
63 - (void)cancelTracking;
65 @end
67 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_CONTEXT_MENU_COCOA_CONTROLLER_H_