OLD | NEW |
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 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "chrome/browser/bookmarks/bookmark_stats.h" | 12 #include "chrome/browser/bookmarks/bookmark_stats.h" |
13 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" | 13 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" |
14 #include "components/bookmarks/browser/base_bookmark_model_observer.h" | 14 #include "components/bookmarks/browser/base_bookmark_model_observer.h" |
15 #include "components/bookmarks/browser/bookmark_node_data.h" | 15 #include "components/bookmarks/browser/bookmark_node_data.h" |
16 #include "ui/views/controls/menu/menu_delegate.h" | 16 #include "ui/views/controls/menu/menu_delegate.h" |
17 | 17 |
18 class BookmarkNode; | 18 class BookmarkNode; |
19 class Browser; | 19 class Browser; |
| 20 class ChromeBookmarkClient; |
20 class Profile; | 21 class Profile; |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 class PageNavigator; | 24 class PageNavigator; |
24 } | 25 } |
25 | 26 |
26 namespace ui { | 27 namespace ui { |
27 class OSExchangeData; | 28 class OSExchangeData; |
28 } | 29 } |
29 | 30 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 void SetPageNavigator(content::PageNavigator* navigator); | 70 void SetPageNavigator(content::PageNavigator* navigator); |
70 | 71 |
71 // Returns the id given to the next menu. | 72 // Returns the id given to the next menu. |
72 int next_menu_id() const { return next_menu_id_; } | 73 int next_menu_id() const { return next_menu_id_; } |
73 | 74 |
74 // Makes the menu for |node| the active menu. |start_index| is the index of | 75 // Makes the menu for |node| the active menu. |start_index| is the index of |
75 // the first child of |node| to show in the menu. | 76 // the first child of |node| to show in the menu. |
76 void SetActiveMenu(const BookmarkNode* node, int start_index); | 77 void SetActiveMenu(const BookmarkNode* node, int start_index); |
77 | 78 |
78 BookmarkModel* GetBookmarkModel(); | 79 BookmarkModel* GetBookmarkModel(); |
| 80 ChromeBookmarkClient* GetChromeBookmarkClient(); |
79 | 81 |
80 // Returns the menu. | 82 // Returns the menu. |
81 views::MenuItemView* menu() { return menu_; } | 83 views::MenuItemView* menu() { return menu_; } |
82 | 84 |
83 // Returns the context menu, or NULL if the context menu isn't showing. | 85 // Returns the context menu, or NULL if the context menu isn't showing. |
84 views::MenuItemView* context_menu() { | 86 views::MenuItemView* context_menu() { |
85 return context_menu_.get() ? context_menu_->menu() : NULL; | 87 return context_menu_.get() ? context_menu_->menu() : NULL; |
86 } | 88 } |
87 | 89 |
88 views::Widget* parent() { return parent_; } | 90 views::Widget* parent() { return parent_; } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 147 |
146 // If |node| has children a new menu is created and added to |menu| to | 148 // If |node| has children a new menu is created and added to |menu| to |
147 // represent it. If |node| is not empty and |added_separator| is false, a | 149 // represent it. If |node| is not empty and |added_separator| is false, a |
148 // separator is added before the new menu items and |added_separator| is set | 150 // separator is added before the new menu items and |added_separator| is set |
149 // to true. | 151 // to true. |
150 void BuildMenuForPermanentNode(const BookmarkNode* node, | 152 void BuildMenuForPermanentNode(const BookmarkNode* node, |
151 views::MenuItemView* menu, | 153 views::MenuItemView* menu, |
152 int* next_menu_id, | 154 int* next_menu_id, |
153 bool* added_separator); | 155 bool* added_separator); |
154 | 156 |
| 157 void BuildMenuForManagedNode(views::MenuItemView* menu, |
| 158 int* next_menu_id); |
| 159 |
155 // Creates an entry in menu for each child node of |parent| starting at | 160 // Creates an entry in menu for each child node of |parent| starting at |
156 // |start_child_index|. | 161 // |start_child_index|. |
157 void BuildMenu(const BookmarkNode* parent, | 162 void BuildMenu(const BookmarkNode* parent, |
158 int start_child_index, | 163 int start_child_index, |
159 views::MenuItemView* menu, | 164 views::MenuItemView* menu, |
160 int* next_menu_id); | 165 int* next_menu_id); |
161 | 166 |
162 // Returns true if |menu_id_| is outside the range of minimum and maximum menu | 167 // Returns true if |menu_id_| is outside the range of minimum and maximum menu |
163 // ID's allowed. | 168 // ID's allowed. |
164 bool IsOutsideMenuIdRange(int menu_id) const; | 169 bool IsOutsideMenuIdRange(int menu_id) const; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // Is the model being changed? | 206 // Is the model being changed? |
202 bool is_mutating_model_; | 207 bool is_mutating_model_; |
203 | 208 |
204 // The location where this bookmark menu will be displayed (for UMA). | 209 // The location where this bookmark menu will be displayed (for UMA). |
205 BookmarkLaunchLocation location_; | 210 BookmarkLaunchLocation location_; |
206 | 211 |
207 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuDelegate); | 212 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuDelegate); |
208 }; | 213 }; |
209 | 214 |
210 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_MENU_DELEGATE_H_ | 215 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_MENU_DELEGATE_H_ |
OLD | NEW |