| 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. |
| 11 // | 11 // |
| 12 // Most Chromium Cocoa menu items are static from a nib (e.g. New | 12 // Most Chromium Cocoa menu items are static from a nib (e.g. New |
| 13 // Tab), but may be enabled/disabled under certain circumstances | 13 // Tab), but may be enabled/disabled under certain circumstances |
| 14 // (e.g. Cut and Paste). In addition, most Cocoa menu items have | 14 // (e.g. Cut and Paste). In addition, most Cocoa menu items have |
| 15 // firstResponder: as a target. Unusually, bookmark menu items are | 15 // firstResponder: as a target. Unusually, bookmark menu items are |
| 16 // created dynamically. They also have a target of | 16 // created dynamically. They also have a target of |
| 17 // BookmarkMenuCocoaController instead of firstResponder. | 17 // BookmarkMenuCocoaController instead of firstResponder. |
| 18 // See BookmarkMenuBridge::AddNodeToMenu()). | 18 // See BookmarkMenuBridge::AddNodeToMenu()). |
| 19 | 19 |
| 20 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ | 20 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ |
| 21 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ | 21 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ |
| 22 | 22 |
| 23 #include <map> | 23 #include <map> |
| 24 | 24 |
| 25 #include "base/mac/scoped_nsobject.h" | 25 #include "base/mac/scoped_nsobject.h" |
| 26 #import "chrome/browser/ui/cocoa/main_menu_item.h" | 26 #import "chrome/browser/ui/cocoa/main_menu_item.h" |
| 27 #include "components/bookmarks/core/browser/bookmark_model_observer.h" | 27 #include "components/bookmarks/browser/bookmark_model_observer.h" |
| 28 | 28 |
| 29 class BookmarkNode; | 29 class BookmarkNode; |
| 30 class Profile; | 30 class Profile; |
| 31 @class NSImage; | 31 @class NSImage; |
| 32 @class NSMenu; | 32 @class NSMenu; |
| 33 @class NSMenuItem; | 33 @class NSMenuItem; |
| 34 @class BookmarkMenuCocoaController; | 34 @class BookmarkMenuCocoaController; |
| 35 | 35 |
| 36 class BookmarkMenuBridge : public BookmarkModelObserver, | 36 class BookmarkMenuBridge : public BookmarkModelObserver, |
| 37 public MainMenuItem { | 37 public MainMenuItem { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 // The folder image so we can use one copy for all. | 145 // The folder image so we can use one copy for all. |
| 146 base::scoped_nsobject<NSImage> folder_image_; | 146 base::scoped_nsobject<NSImage> folder_image_; |
| 147 | 147 |
| 148 // In order to appropriately update items in the bookmark menu, without | 148 // In order to appropriately update items in the bookmark menu, without |
| 149 // forcing a rebuild, map the model's nodes to menu items. | 149 // forcing a rebuild, map the model's nodes to menu items. |
| 150 std::map<const BookmarkNode*, NSMenuItem*> bookmark_nodes_; | 150 std::map<const BookmarkNode*, NSMenuItem*> bookmark_nodes_; |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ | 153 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ |
| OLD | NEW |