| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ |
| 6 #define CHROME_BROWSER_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ | 6 #define CHROME_BROWSER_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 virtual void BookmarkMenuDeleted(BookmarkMenuController* controller) = 0; | 45 virtual void BookmarkMenuDeleted(BookmarkMenuController* controller) = 0; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // Creates a BookmarkMenuController showing the children of |node| starting | 48 // Creates a BookmarkMenuController showing the children of |node| starting |
| 49 // at index |start_child_index|. | 49 // at index |start_child_index|. |
| 50 BookmarkMenuController(Browser* browser, | 50 BookmarkMenuController(Browser* browser, |
| 51 Profile* profile, | 51 Profile* profile, |
| 52 PageNavigator* page_navigator, | 52 PageNavigator* page_navigator, |
| 53 gfx::NativeWindow parent, | 53 gfx::NativeWindow parent, |
| 54 const BookmarkNode* node, | 54 const BookmarkNode* node, |
| 55 int start_child_index, | 55 int start_child_index); |
| 56 bool show_other_folder); | |
| 57 | 56 |
| 58 void RunMenuAt(BookmarkBarView* bookmark_bar, bool for_drop); | 57 void RunMenuAt(BookmarkBarView* bookmark_bar, bool for_drop); |
| 59 | 58 |
| 60 // Shows the menu. | 59 // Shows the menu. |
| 61 void RunMenuAt(views::MenuButton* button, | 60 void RunMenuAt(views::MenuButton* button, |
| 62 views::MenuItemView::AnchorPosition position, | 61 views::MenuItemView::AnchorPosition position, |
| 63 bool for_drop); | 62 bool for_drop); |
| 64 | 63 |
| 65 // Hides the menu. | 64 // Hides the menu. |
| 66 void Cancel(); | 65 void Cancel(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 typedef std::map<const BookmarkNode*, int> NodeToMenuIDMap; | 121 typedef std::map<const BookmarkNode*, int> NodeToMenuIDMap; |
| 123 | 122 |
| 124 // BookmarkMenuController deletes itself as necessary. | 123 // BookmarkMenuController deletes itself as necessary. |
| 125 ~BookmarkMenuController(); | 124 ~BookmarkMenuController(); |
| 126 | 125 |
| 127 // Creates a menu and adds it to node_to_menu_id_map_. This uses | 126 // Creates a menu and adds it to node_to_menu_id_map_. This uses |
| 128 // BuildMenu to recursively populate the menu. | 127 // BuildMenu to recursively populate the menu. |
| 129 views::MenuItemView* CreateMenu(const BookmarkNode* parent, | 128 views::MenuItemView* CreateMenu(const BookmarkNode* parent, |
| 130 int start_child_index); | 129 int start_child_index); |
| 131 | 130 |
| 132 // Builds the menu for the other bookmarks folder. This is added as the last | |
| 133 // item to menu_. | |
| 134 void BuildOtherFolderMenu(views::MenuItemView* menu, int* next_menu_id); | |
| 135 | |
| 136 // Creates an entry in menu for each child node of |parent| starting at | 131 // Creates an entry in menu for each child node of |parent| starting at |
| 137 // |start_child_index|. | 132 // |start_child_index|. |
| 138 void BuildMenu(const BookmarkNode* parent, | 133 void BuildMenu(const BookmarkNode* parent, |
| 139 int start_child_index, | 134 int start_child_index, |
| 140 views::MenuItemView* menu, | 135 views::MenuItemView* menu, |
| 141 int* next_menu_id); | 136 int* next_menu_id); |
| 142 | 137 |
| 143 // Returns the menu whose id is |id|. | 138 // Returns the menu whose id is |id|. |
| 144 views::MenuItemView* GetMenuByID(int id); | 139 views::MenuItemView* GetMenuByID(int id); |
| 145 | 140 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 172 |
| 178 // Used when a context menu is shown. | 173 // Used when a context menu is shown. |
| 179 scoped_ptr<BookmarkContextMenu> context_menu_; | 174 scoped_ptr<BookmarkContextMenu> context_menu_; |
| 180 | 175 |
| 181 // The observer, may be null. | 176 // The observer, may be null. |
| 182 Observer* observer_; | 177 Observer* observer_; |
| 183 | 178 |
| 184 // Is the menu being shown for a drop? | 179 // Is the menu being shown for a drop? |
| 185 bool for_drop_; | 180 bool for_drop_; |
| 186 | 181 |
| 187 // Should the other folder be shown? | |
| 188 bool show_other_folder_; | |
| 189 | |
| 190 // The bookmark bar. This is only non-null if we're showing a menu item | 182 // The bookmark bar. This is only non-null if we're showing a menu item |
| 191 // for a folder on the bookmark bar and not for drop. | 183 // for a folder on the bookmark bar and not for drop. |
| 192 BookmarkBarView* bookmark_bar_; | 184 BookmarkBarView* bookmark_bar_; |
| 193 | 185 |
| 194 typedef std::map<const BookmarkNode*, views::MenuItemView*> NodeToMenuMap; | 186 typedef std::map<const BookmarkNode*, views::MenuItemView*> NodeToMenuMap; |
| 195 NodeToMenuMap node_to_menu_map_; | 187 NodeToMenuMap node_to_menu_map_; |
| 196 | 188 |
| 197 // ID of the next menu item. | 189 // ID of the next menu item. |
| 198 int next_menu_id_; | 190 int next_menu_id_; |
| 199 | 191 |
| 200 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController); | 192 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController); |
| 201 }; | 193 }; |
| 202 | 194 |
| 203 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ | 195 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_MENU_CONTROLLER_VIEWS_H_ |
| OLD | NEW |