| Index: chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h
|
| diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h
|
| index 5fd4f626993b6ee989a29fb1efeec6aa93dc818a..a45205e3c54b76dfccfc1f0c962f6dc303bae135 100644
|
| --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h
|
| +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h
|
| @@ -2,15 +2,14 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// C++ controller for the bookmark menu; one per AppController (which
|
| -// means there is only one). When bookmarks are changed, this class
|
| -// takes care of updating Cocoa bookmark menus. This is not named
|
| -// BookmarkMenuController to help avoid confusion between languages.
|
| -// This class needs to be C++, not ObjC, since it derives from
|
| -// BookmarkModelObserver.
|
| +
|
| +// C++ class that connects a BookmarkNode (or the entire model) to a Cocoa class
|
| +// that manages an NSMenu. Commonly this is for the main menu and that instance
|
| +// is owned by the AppController. This is also used by the folder menus on the
|
| +// bookmark bar.
|
| //
|
| -// Most Chromium Cocoa menu items are static from a nib (e.g. New
|
| -// Tab), but may be enabled/disabled under certain circumstances
|
| +// In the main menu case, most Chromium Cocoa menu items are static from a nib
|
| +// (e.g. New Tab), but may be enabled/disabled under certain circumstances
|
| // (e.g. Cut and Paste). In addition, most Cocoa menu items have
|
| // firstResponder: as a target. Unusually, bookmark menu items are
|
| // created dynamically. They also have a target of
|
| @@ -37,7 +36,14 @@ class Profile;
|
| class BookmarkMenuBridge : public BookmarkModelObserver,
|
| public MainMenuItem {
|
| public:
|
| + // Constructor for the main menu which lists all bookmarks.
|
| BookmarkMenuBridge(Profile* profile, NSMenu* menu);
|
| +
|
| + // Constructor for a submenu.
|
| + BookmarkMenuBridge(const BookmarkNode* root_node,
|
| + Profile* profile,
|
| + NSMenu* menu);
|
| +
|
| virtual ~BookmarkMenuBridge();
|
|
|
| // BookmarkModelObserver:
|
| @@ -75,6 +81,7 @@ class BookmarkMenuBridge : public BookmarkModelObserver,
|
| // I wish I had a "friend @class" construct.
|
| BookmarkModel* GetBookmarkModel();
|
| Profile* GetProfile();
|
| + BookmarkMenuCocoaController* controller() { return controller_.get(); }
|
|
|
| protected:
|
| // Rebuilds the bookmark content of supplied menu.
|
| @@ -84,7 +91,7 @@ class BookmarkMenuBridge : public BookmarkModelObserver,
|
| void ClearBookmarkMenu(NSMenu* menu);
|
|
|
| // Mark the bookmark menu as being invalid.
|
| - void InvalidateMenu() { menuIsValid_ = false; }
|
| + void InvalidateMenu() { menu_is_valid_ = false; }
|
|
|
| // Helper for adding the node as a submenu to the menu with the
|
| // given title.
|
| @@ -134,10 +141,13 @@ class BookmarkMenuBridge : public BookmarkModelObserver,
|
| friend class BookmarkMenuBridgeTest;
|
|
|
| // True iff the menu is up-to-date with the actual BookmarkModel.
|
| - bool menuIsValid_;
|
| + bool menu_is_valid_;
|
| +
|
| + // The root node of the menu.
|
| + const BookmarkNode* root_node_;
|
|
|
| - Profile* profile_; // weak
|
| - BookmarkMenuCocoaController* controller_; // strong
|
| + Profile* profile_; // Weak.
|
| + scoped_nsobject<BookmarkMenuCocoaController> controller_;
|
|
|
| // The folder image so we can use one copy for all.
|
| scoped_nsobject<NSImage> folder_image_;
|
|
|