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_TOOLBAR_WRENCH_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
6 #define CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 Browser* browser() const { return browser_; } | 131 Browser* browser() const { return browser_; } |
132 | 132 |
133 BookmarkSubMenuModel* bookmark_sub_menu_model() const { | 133 BookmarkSubMenuModel* bookmark_sub_menu_model() const { |
134 return bookmark_sub_menu_model_.get(); | 134 return bookmark_sub_menu_model_.get(); |
135 } | 135 } |
136 | 136 |
137 // Calculates |zoom_label_| in response to a zoom change. | 137 // Calculates |zoom_label_| in response to a zoom change. |
138 void UpdateZoomControls(); | 138 void UpdateZoomControls(); |
139 | 139 |
140 private: | 140 private: |
| 141 class HelpMenuModel; |
141 // Testing constructor used for mocking. | 142 // Testing constructor used for mocking. |
142 friend class ::MockWrenchMenuModel; | 143 friend class ::MockWrenchMenuModel; |
| 144 |
143 WrenchMenuModel(); | 145 WrenchMenuModel(); |
144 | 146 |
145 void Build(bool is_new_menu); | 147 void Build(bool is_new_menu); |
146 | 148 |
147 void AddGlobalErrorMenuItems(); | 149 void AddGlobalErrorMenuItems(); |
148 | 150 |
149 // Appends everything needed for the clipboard menu: a menu break, the | 151 // Appends everything needed for the clipboard menu: a menu break, the |
150 // clipboard menu content and the finalizing menu break. If the last break | 152 // clipboard menu content and the finalizing menu break. If the last break |
151 // is not needed it can be suppressed by setting |new_menu| | 153 // is not needed it can be suppressed by setting |new_menu| |
152 // to false. | 154 // to false. |
153 void CreateCutCopyPasteMenu(bool new_menu); | 155 void CreateCutCopyPasteMenu(bool new_menu); |
154 | 156 |
155 // Appends everything needed for the zoom menu: a menu break, then the zoom | 157 // Appends everything needed for the zoom menu: a menu break, then the zoom |
156 // menu content and then another menu break. If the new menu type is used, | 158 // menu content and then another menu break. If the new menu type is used, |
157 // |new_menu| should be set to true. | 159 // |new_menu| should be set to true. |
158 void CreateZoomMenu(bool new_menu); | 160 void CreateZoomMenu(bool new_menu); |
159 | 161 |
160 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); | 162 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); |
161 | 163 |
162 bool ShouldShowNewIncognitoWindowMenuItem(); | 164 bool ShouldShowNewIncognitoWindowMenuItem(); |
163 | 165 |
164 // Models for the special menu items with buttons. | 166 // Models for the special menu items with buttons. |
165 scoped_ptr<ui::ButtonMenuItemModel> edit_menu_item_model_; | 167 scoped_ptr<ui::ButtonMenuItemModel> edit_menu_item_model_; |
166 scoped_ptr<ui::ButtonMenuItemModel> zoom_menu_item_model_; | 168 scoped_ptr<ui::ButtonMenuItemModel> zoom_menu_item_model_; |
167 | 169 |
168 // Label of the zoom label in the zoom menu item. | 170 // Label of the zoom label in the zoom menu item. |
169 base::string16 zoom_label_; | 171 base::string16 zoom_label_; |
170 | 172 |
| 173 #if defined(GOOGLE_CHROME_BUILD) |
| 174 // Help menu. |
| 175 scoped_ptr<HelpMenuModel> help_menu_model_; |
| 176 #endif |
| 177 |
171 // Tools menu. | 178 // Tools menu. |
172 scoped_ptr<ToolsMenuModel> tools_menu_model_; | 179 scoped_ptr<ToolsMenuModel> tools_menu_model_; |
173 | 180 |
174 // Bookmark submenu. | 181 // Bookmark submenu. |
175 scoped_ptr<BookmarkSubMenuModel> bookmark_sub_menu_model_; | 182 scoped_ptr<BookmarkSubMenuModel> bookmark_sub_menu_model_; |
176 | 183 |
177 // Recent Tabs submenu. | 184 // Recent Tabs submenu. |
178 scoped_ptr<RecentTabsSubMenuModel> recent_tabs_sub_menu_model_; | 185 scoped_ptr<RecentTabsSubMenuModel> recent_tabs_sub_menu_model_; |
179 | 186 |
180 ui::AcceleratorProvider* provider_; // weak | 187 ui::AcceleratorProvider* provider_; // weak |
181 | 188 |
182 Browser* browser_; // weak | 189 Browser* browser_; // weak |
183 TabStripModel* tab_strip_model_; // weak | 190 TabStripModel* tab_strip_model_; // weak |
184 | 191 |
185 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; | 192 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; |
186 content::NotificationRegistrar registrar_; | 193 content::NotificationRegistrar registrar_; |
187 | 194 |
188 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); | 195 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); |
189 }; | 196 }; |
190 | 197 |
191 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 198 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
OLD | NEW |