| 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 15 matching lines...) Expand all Loading... |
| 26 #import "chrome/browser/ui/cocoa/main_menu_item.h" | 26 #import "chrome/browser/ui/cocoa/main_menu_item.h" |
| 27 #include "components/bookmarks/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 bookmarks::BookmarkModelObserver, |
| 37 public MainMenuItem { | 37 public MainMenuItem { |
| 38 public: | 38 public: |
| 39 BookmarkMenuBridge(Profile* profile, NSMenu* menu); | 39 BookmarkMenuBridge(Profile* profile, NSMenu* menu); |
| 40 ~BookmarkMenuBridge() override; | 40 ~BookmarkMenuBridge() override; |
| 41 | 41 |
| 42 // BookmarkModelObserver: | 42 // bookmarks::BookmarkModelObserver: |
| 43 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override; | 43 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override; |
| 44 void BookmarkModelBeingDeleted(BookmarkModel* model) override; | 44 void BookmarkModelBeingDeleted(BookmarkModel* model) override; |
| 45 void BookmarkNodeMoved(BookmarkModel* model, | 45 void BookmarkNodeMoved(BookmarkModel* model, |
| 46 const BookmarkNode* old_parent, | 46 const BookmarkNode* old_parent, |
| 47 int old_index, | 47 int old_index, |
| 48 const BookmarkNode* new_parent, | 48 const BookmarkNode* new_parent, |
| 49 int new_index) override; | 49 int new_index) override; |
| 50 void BookmarkNodeAdded(BookmarkModel* model, | 50 void BookmarkNodeAdded(BookmarkModel* model, |
| 51 const BookmarkNode* parent, | 51 const BookmarkNode* parent, |
| 52 int index) override; | 52 int index) override; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 // The folder image so we can use one copy for all. | 144 // The folder image so we can use one copy for all. |
| 145 base::scoped_nsobject<NSImage> folder_image_; | 145 base::scoped_nsobject<NSImage> folder_image_; |
| 146 | 146 |
| 147 // In order to appropriately update items in the bookmark menu, without | 147 // In order to appropriately update items in the bookmark menu, without |
| 148 // forcing a rebuild, map the model's nodes to menu items. | 148 // forcing a rebuild, map the model's nodes to menu items. |
| 149 std::map<const BookmarkNode*, NSMenuItem*> bookmark_nodes_; | 149 std::map<const BookmarkNode*, NSMenuItem*> bookmark_nodes_; |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ | 152 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_ |
| OLD | NEW |