Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.h

Issue 1550173002: Fix bug in not exiting menu when choosing 'delete' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_UI_VIEWS_BOOKMARKS_BOOKMARK_MENU_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_MENU_DELEGATE_H_
6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_MENU_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_MENU_DELEGATE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // Sets the PageNavigator. 74 // Sets the PageNavigator.
75 void SetPageNavigator(content::PageNavigator* navigator); 75 void SetPageNavigator(content::PageNavigator* navigator);
76 76
77 // Returns the id given to the next menu. 77 // Returns the id given to the next menu.
78 int next_menu_id() const { return next_menu_id_; } 78 int next_menu_id() const { return next_menu_id_; }
79 79
80 // Makes the menu for |node| the active menu. |start_index| is the index of 80 // Makes the menu for |node| the active menu. |start_index| is the index of
81 // the first child of |node| to show in the menu. 81 // the first child of |node| to show in the menu.
82 void SetActiveMenu(const bookmarks::BookmarkNode* node, int start_index); 82 void SetActiveMenu(const bookmarks::BookmarkNode* node, int start_index);
83 83
84 bookmarks::BookmarkModel* GetBookmarkModel(); 84 bookmarks::BookmarkModel* GetBookmarkModel() {
85 return const_cast<bookmarks::BookmarkModel*>(
86 const_cast<const BookmarkMenuDelegate*>(this)->GetBookmarkModel());
87 }
88 const bookmarks::BookmarkModel* GetBookmarkModel() const;
85 bookmarks::ManagedBookmarkService* GetManagedBookmarkService(); 89 bookmarks::ManagedBookmarkService* GetManagedBookmarkService();
86 90
87 // Returns the menu. 91 // Returns the menu.
88 views::MenuItemView* menu() { return menu_; } 92 views::MenuItemView* menu() { return menu_; }
89 93
90 // Returns the context menu, or NULL if the context menu isn't showing. 94 // Returns the context menu, or NULL if the context menu isn't showing.
91 views::MenuItemView* context_menu() { 95 views::MenuItemView* context_menu() {
92 return context_menu_.get() ? context_menu_->menu() : NULL; 96 return context_menu_.get() ? context_menu_->menu() : NULL;
93 } 97 }
94 98
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 const std::vector<const bookmarks::BookmarkNode*>& bookmarks) override; 141 const std::vector<const bookmarks::BookmarkNode*>& bookmarks) override;
138 void DidRemoveBookmarks() override; 142 void DidRemoveBookmarks() override;
139 143
140 private: 144 private:
141 friend class BookmarkMenuDelegateTest; 145 friend class BookmarkMenuDelegateTest;
142 146
143 typedef std::map<int, const bookmarks::BookmarkNode*> MenuIDToNodeMap; 147 typedef std::map<int, const bookmarks::BookmarkNode*> MenuIDToNodeMap;
144 typedef std::map<const bookmarks::BookmarkNode*, views::MenuItemView*> 148 typedef std::map<const bookmarks::BookmarkNode*, views::MenuItemView*>
145 NodeToMenuMap; 149 NodeToMenuMap;
146 150
151 // Returns whether the menu should close id 'delete' is selected.
152 bool ShouldCloseOnRemove(const bookmarks::BookmarkNode* node) const;
153
147 // Creates a menu. This uses BuildMenu() to recursively populate the menu. 154 // Creates a menu. This uses BuildMenu() to recursively populate the menu.
148 views::MenuItemView* CreateMenu(const bookmarks::BookmarkNode* parent, 155 views::MenuItemView* CreateMenu(const bookmarks::BookmarkNode* parent,
149 int start_child_index, 156 int start_child_index,
150 ShowOptions show_options); 157 ShowOptions show_options);
151 158
152 // Invokes BuildMenuForPermanentNode() for the permanent nodes (excluding 159 // Invokes BuildMenuForPermanentNode() for the permanent nodes (excluding
153 // 'other bookmarks' folder). 160 // 'other bookmarks' folder).
154 void BuildMenusForPermanentNodes(views::MenuItemView* menu); 161 void BuildMenusForPermanentNodes(views::MenuItemView* menu);
155 162
156 // If |node| has children a new menu is created and added to |menu| to 163 // If |node| has children a new menu is created and added to |menu| to
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // Is the model being changed? 216 // Is the model being changed?
210 bool is_mutating_model_; 217 bool is_mutating_model_;
211 218
212 // The location where this bookmark menu will be displayed (for UMA). 219 // The location where this bookmark menu will be displayed (for UMA).
213 BookmarkLaunchLocation location_; 220 BookmarkLaunchLocation location_;
214 221
215 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuDelegate); 222 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuDelegate);
216 }; 223 };
217 224
218 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_MENU_DELEGATE_H_ 225 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_MENU_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698