OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // C++ controller for the bookmark menu; one per AppController (which | 5 // C++ controller for the bookmark menu; one per AppController (which |
6 // means there is only one). When bookmarks are changed, this class | 6 // means there is only one). When bookmarks are changed, this class |
7 // takes care of updating Cocoa bookmark menus. This is not named | 7 // takes care of updating Cocoa bookmark menus. This is not named |
8 // BookmarkMenuController to help avoid confusion between languages. | 8 // BookmarkMenuController to help avoid confusion between languages. |
9 // This class needs to be C++, not ObjC, since it derives from | 9 // This class needs to be C++, not ObjC, since it derives from |
10 // BookmarkModelObserver. | 10 // BookmarkModelObserver. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // Mark the bookmark menu as being invalid. | 86 // Mark the bookmark menu as being invalid. |
87 void InvalidateMenu() { menuIsValid_ = false; } | 87 void InvalidateMenu() { menuIsValid_ = false; } |
88 | 88 |
89 // Helper for adding the node as a submenu to the menu with the | 89 // Helper for adding the node as a submenu to the menu with the |
90 // given title. | 90 // given title. |
91 // If |add_extra_items| is true, also adds extra menu items at bottom of | 91 // If |add_extra_items| is true, also adds extra menu items at bottom of |
92 // menu, such as "Open All Bookmarks". | 92 // menu, such as "Open All Bookmarks". |
93 void AddNodeAsSubmenu(NSMenu* menu, | 93 void AddNodeAsSubmenu(NSMenu* menu, |
94 const BookmarkNode* node, | 94 const BookmarkNode* node, |
95 NSString* title, | |
96 bool add_extra_items); | 95 bool add_extra_items); |
97 | 96 |
98 // Helper for recursively adding items to our bookmark menu. | 97 // Helper for recursively adding items to our bookmark menu. |
99 // All children of |node| will be added to |menu|. | 98 // All children of |node| will be added to |menu|. |
100 // If |add_extra_items| is true, also adds extra menu items at bottom of | 99 // If |add_extra_items| is true, also adds extra menu items at bottom of |
101 // menu, such as "Open All Bookmarks". | 100 // menu, such as "Open All Bookmarks". |
102 // TODO(jrg): add a counter to enforce maximum nodes added | 101 // TODO(jrg): add a counter to enforce maximum nodes added |
103 void AddNodeToMenu(const BookmarkNode* node, NSMenu* menu, | 102 void AddNodeToMenu(const BookmarkNode* node, NSMenu* menu, |
104 bool add_extra_items); | 103 bool add_extra_items); |
105 | 104 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 140 |
142 // The folder image so we can use one copy for all. | 141 // The folder image so we can use one copy for all. |
143 scoped_nsobject<NSImage> folder_image_; | 142 scoped_nsobject<NSImage> folder_image_; |
144 | 143 |
145 // In order to appropriately update items in the bookmark menu, without | 144 // In order to appropriately update items in the bookmark menu, without |
146 // forcing a rebuild, map the model's nodes to menu items. | 145 // forcing a rebuild, map the model's nodes to menu items. |
147 std::map<const BookmarkNode*, NSMenuItem*> bookmark_nodes_; | 146 std::map<const BookmarkNode*, NSMenuItem*> bookmark_nodes_; |
148 }; | 147 }; |
149 | 148 |
150 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ | 149 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ |
OLD | NEW |