| 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 23 matching lines...) Expand all Loading... |
| 34 @class BookmarkMenuCocoaController; | 34 @class BookmarkMenuCocoaController; |
| 35 | 35 |
| 36 class BookmarkMenuBridge : public BookmarkModelObserver, | 36 class BookmarkMenuBridge : public BookmarkModelObserver, |
| 37 public MainMenuItem { | 37 public MainMenuItem { |
| 38 public: | 38 public: |
| 39 BookmarkMenuBridge(Profile* profile, NSMenu* menu); | 39 BookmarkMenuBridge(Profile* profile, NSMenu* menu); |
| 40 virtual ~BookmarkMenuBridge(); | 40 virtual ~BookmarkMenuBridge(); |
| 41 | 41 |
| 42 // BookmarkModelObserver: | 42 // BookmarkModelObserver: |
| 43 virtual void BookmarkModelLoaded(BookmarkModel* model, | 43 virtual void BookmarkModelLoaded(BookmarkModel* model, |
| 44 bool ids_reassigned) OVERRIDE; | 44 bool ids_reassigned) override; |
| 45 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; | 45 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) override; |
| 46 virtual void BookmarkNodeMoved(BookmarkModel* model, | 46 virtual void BookmarkNodeMoved(BookmarkModel* model, |
| 47 const BookmarkNode* old_parent, | 47 const BookmarkNode* old_parent, |
| 48 int old_index, | 48 int old_index, |
| 49 const BookmarkNode* new_parent, | 49 const BookmarkNode* new_parent, |
| 50 int new_index) OVERRIDE; | 50 int new_index) override; |
| 51 virtual void BookmarkNodeAdded(BookmarkModel* model, | 51 virtual void BookmarkNodeAdded(BookmarkModel* model, |
| 52 const BookmarkNode* parent, | 52 const BookmarkNode* parent, |
| 53 int index) OVERRIDE; | 53 int index) override; |
| 54 virtual void BookmarkNodeRemoved(BookmarkModel* model, | 54 virtual void BookmarkNodeRemoved(BookmarkModel* model, |
| 55 const BookmarkNode* parent, | 55 const BookmarkNode* parent, |
| 56 int old_index, | 56 int old_index, |
| 57 const BookmarkNode* node, | 57 const BookmarkNode* node, |
| 58 const std::set<GURL>& removed_urls) OVERRIDE; | 58 const std::set<GURL>& removed_urls) override; |
| 59 virtual void BookmarkAllUserNodesRemoved( | 59 virtual void BookmarkAllUserNodesRemoved( |
| 60 BookmarkModel* model, | 60 BookmarkModel* model, |
| 61 const std::set<GURL>& removed_urls) OVERRIDE; | 61 const std::set<GURL>& removed_urls) override; |
| 62 virtual void BookmarkNodeChanged(BookmarkModel* model, | 62 virtual void BookmarkNodeChanged(BookmarkModel* model, |
| 63 const BookmarkNode* node) OVERRIDE; | 63 const BookmarkNode* node) override; |
| 64 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, | 64 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, |
| 65 const BookmarkNode* node) OVERRIDE; | 65 const BookmarkNode* node) override; |
| 66 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, | 66 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, |
| 67 const BookmarkNode* node) OVERRIDE; | 67 const BookmarkNode* node) override; |
| 68 | 68 |
| 69 // MainMenuItem: | 69 // MainMenuItem: |
| 70 virtual void ResetMenu() OVERRIDE; | 70 virtual void ResetMenu() override; |
| 71 virtual void BuildMenu() OVERRIDE; | 71 virtual void BuildMenu() override; |
| 72 | 72 |
| 73 // Rebuilds the main bookmark menu, if it has been marked invalid. | 73 // Rebuilds the main bookmark menu, if it has been marked invalid. |
| 74 void UpdateMenu(NSMenu* bookmark_menu); | 74 void UpdateMenu(NSMenu* bookmark_menu); |
| 75 | 75 |
| 76 // Rebuilds a bookmark menu that's a submenu of another menu. | 76 // Rebuilds a bookmark menu that's a submenu of another menu. |
| 77 void UpdateSubMenu(NSMenu* bookmark_menu); | 77 void UpdateSubMenu(NSMenu* bookmark_menu); |
| 78 | 78 |
| 79 // I wish I had a "friend @class" construct. | 79 // I wish I had a "friend @class" construct. |
| 80 BookmarkModel* GetBookmarkModel(); | 80 BookmarkModel* GetBookmarkModel(); |
| 81 Profile* GetProfile(); | 81 Profile* GetProfile(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 // The folder image so we can use one copy for all. | 146 // The folder image so we can use one copy for all. |
| 147 base::scoped_nsobject<NSImage> folder_image_; | 147 base::scoped_nsobject<NSImage> folder_image_; |
| 148 | 148 |
| 149 // In order to appropriately update items in the bookmark menu, without | 149 // In order to appropriately update items in the bookmark menu, without |
| 150 // forcing a rebuild, map the model's nodes to menu items. | 150 // forcing a rebuild, map the model's nodes to menu items. |
| 151 std::map<const BookmarkNode*, NSMenuItem*> bookmark_nodes_; | 151 std::map<const BookmarkNode*, NSMenuItem*> bookmark_nodes_; |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ | 154 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ |
| OLD | NEW |