Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h

Issue 339413002: Use the managed bookmarks icon for its folder on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 protected: 83 protected:
84 // Rebuilds the bookmark content of supplied menu. 84 // Rebuilds the bookmark content of supplied menu.
85 void UpdateMenuInternal(NSMenu* bookmark_menu, bool is_submenu); 85 void UpdateMenuInternal(NSMenu* bookmark_menu, bool is_submenu);
86 86
87 // Clear all bookmarks from the given bookmark menu. 87 // Clear all bookmarks from the given bookmark menu.
88 void ClearBookmarkMenu(NSMenu* menu); 88 void ClearBookmarkMenu(NSMenu* menu);
89 89
90 // Mark the bookmark menu as being invalid. 90 // Mark the bookmark menu as being invalid.
91 void InvalidateMenu() { menuIsValid_ = false; } 91 void InvalidateMenu() { menuIsValid_ = false; }
92 92
93 // Helper for adding the node as a submenu to the menu with the 93 // Helper for adding the node as a submenu to the menu with the |node|'s title
94 // given title. 94 // and the given |image| as its icon.
95 // If |add_extra_items| is true, also adds extra menu items at bottom of 95 // If |add_extra_items| is true, also adds extra menu items at bottom of
96 // menu, such as "Open All Bookmarks". 96 // menu, such as "Open All Bookmarks".
97 void AddNodeAsSubmenu(NSMenu* menu, 97 void AddNodeAsSubmenu(NSMenu* menu,
98 const BookmarkNode* node, 98 const BookmarkNode* node,
99 NSImage* image,
99 bool add_extra_items); 100 bool add_extra_items);
100 101
101 // Helper for recursively adding items to our bookmark menu. 102 // Helper for recursively adding items to our bookmark menu.
102 // All children of |node| will be added to |menu|. 103 // All children of |node| will be added to |menu|.
103 // If |add_extra_items| is true, also adds extra menu items at bottom of 104 // If |add_extra_items| is true, also adds extra menu items at bottom of
104 // menu, such as "Open All Bookmarks". 105 // menu, such as "Open All Bookmarks".
105 // TODO(jrg): add a counter to enforce maximum nodes added 106 // TODO(jrg): add a counter to enforce maximum nodes added
106 void AddNodeToMenu(const BookmarkNode* node, NSMenu* menu, 107 void AddNodeToMenu(const BookmarkNode* node, NSMenu* menu,
107 bool add_extra_items); 108 bool add_extra_items);
108 109
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 145
145 // The folder image so we can use one copy for all. 146 // The folder image so we can use one copy for all.
146 base::scoped_nsobject<NSImage> folder_image_; 147 base::scoped_nsobject<NSImage> folder_image_;
147 148
148 // In order to appropriately update items in the bookmark menu, without 149 // In order to appropriately update items in the bookmark menu, without
149 // forcing a rebuild, map the model's nodes to menu items. 150 // forcing a rebuild, map the model's nodes to menu items.
150 std::map<const BookmarkNode*, NSMenuItem*> bookmark_nodes_; 151 std::map<const BookmarkNode*, NSMenuItem*> bookmark_nodes_;
151 }; 152 };
152 153
153 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ 154 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698