| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 // Returns the NSMenuItem for a given BookmarkNode. | 136 // Returns the NSMenuItem for a given BookmarkNode. |
| 137 NSMenuItem* MenuItemForNode(const bookmarks::BookmarkNode* node); | 137 NSMenuItem* MenuItemForNode(const bookmarks::BookmarkNode* node); |
| 138 | 138 |
| 139 // Start watching the bookmarks for changes. | 139 // Start watching the bookmarks for changes. |
| 140 void ObserveBookmarkModel(); | 140 void ObserveBookmarkModel(); |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 friend class BookmarkMenuBridgeTest; | 143 friend class BookmarkMenuBridgeTest; |
| 144 | 144 |
| 145 // True iff the menu is up-to-date with the actual BookmarkModel. | 145 // True iff the menu is up to date with the actual BookmarkModel. |
| 146 bool menuIsValid_; | 146 bool menuIsValid_; |
| 147 | 147 |
| 148 Profile* profile_; // weak | 148 Profile* profile_; // weak |
| 149 BookmarkMenuCocoaController* controller_; // strong | 149 BookmarkMenuCocoaController* controller_; // strong |
| 150 | 150 |
| 151 // The folder image so we can use one copy for all. | 151 // The folder image so we can use one copy for all. |
| 152 base::scoped_nsobject<NSImage> folder_image_; | 152 base::scoped_nsobject<NSImage> folder_image_; |
| 153 | 153 |
| 154 // In order to appropriately update items in the bookmark menu, without | 154 // In order to appropriately update items in the bookmark menu, without |
| 155 // forcing a rebuild, map the model's nodes to menu items. | 155 // forcing a rebuild, map the model's nodes to menu items. |
| 156 std::map<const bookmarks::BookmarkNode*, NSMenuItem*> bookmark_nodes_; | 156 std::map<const bookmarks::BookmarkNode*, NSMenuItem*> bookmark_nodes_; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ | 159 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ |
| OLD | NEW |