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/file_path.h" | 8 #include "base/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" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
13 #include "ui/base/accelerators/accelerator.h" | 13 #include "ui/base/accelerators/accelerator.h" |
14 #include "ui/base/models/button_menu_item_model.h" | 14 #include "ui/base/models/button_menu_item_model.h" |
15 #include "ui/base/models/simple_menu_model.h" | 15 #include "ui/base/models/simple_menu_model.h" |
16 | 16 |
17 class BookmarkSubMenuModel; | 17 class BookmarkSubMenuModel; |
18 class Browser; | 18 class Browser; |
| 19 class GlobalError; |
19 class RecentTabsSubMenuModel; | 20 class RecentTabsSubMenuModel; |
20 class TabStripModel; | 21 class TabStripModel; |
21 | 22 |
22 namespace { | 23 namespace { |
23 class MockWrenchMenuModel; | 24 class MockWrenchMenuModel; |
24 } // namespace | 25 } // namespace |
25 | 26 |
26 // A menu model that builds the contents of an encoding menu. | 27 // A menu model that builds the contents of an encoding menu. |
27 class EncodingMenuModel : public ui::SimpleMenuModel, | 28 class EncodingMenuModel : public ui::SimpleMenuModel, |
28 public ui::SimpleMenuModel::Delegate { | 29 public ui::SimpleMenuModel::Delegate { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // clipboard menu content and the finalizing menu break. If the last break | 141 // clipboard menu content and the finalizing menu break. If the last break |
141 // is not needed it can be suppressed by setting |new_menu| | 142 // is not needed it can be suppressed by setting |new_menu| |
142 // to false. | 143 // to false. |
143 void CreateCutCopyPasteMenu(bool new_menu); | 144 void CreateCutCopyPasteMenu(bool new_menu); |
144 | 145 |
145 // Appends everything needed for the zoom menu: a menu break, then the zoom | 146 // Appends everything needed for the zoom menu: a menu break, then the zoom |
146 // menu content and then another menu break. If the new menu type is used, | 147 // menu content and then another menu break. If the new menu type is used, |
147 // |new_menu| should be set to true. | 148 // |new_menu| should be set to true. |
148 void CreateZoomMenu(bool new_menu); | 149 void CreateZoomMenu(bool new_menu); |
149 | 150 |
150 string16 GetSyncMenuLabel() const; | 151 // Various GlobalError objects share a single menu item. This helper routine |
| 152 // returns the GlobalError object that is currently displaying a message in |
| 153 // that item, otherwise returns NULL if we should display one of the default |
| 154 // messages. |
| 155 GlobalError* GetActiveSignedInServiceError() const; |
151 | 156 |
152 // Models for the special menu items with buttons. | 157 // Models for the special menu items with buttons. |
153 scoped_ptr<ui::ButtonMenuItemModel> edit_menu_item_model_; | 158 scoped_ptr<ui::ButtonMenuItemModel> edit_menu_item_model_; |
154 scoped_ptr<ui::ButtonMenuItemModel> zoom_menu_item_model_; | 159 scoped_ptr<ui::ButtonMenuItemModel> zoom_menu_item_model_; |
155 | 160 |
156 // Label of the zoom label in the zoom menu item. | 161 // Label of the zoom label in the zoom menu item. |
157 string16 zoom_label_; | 162 string16 zoom_label_; |
158 | 163 |
159 // Tools menu. | 164 // Tools menu. |
160 scoped_ptr<ToolsMenuModel> tools_menu_model_; | 165 scoped_ptr<ToolsMenuModel> tools_menu_model_; |
161 | 166 |
162 // Bookmark submenu. | 167 // Bookmark submenu. |
163 scoped_ptr<BookmarkSubMenuModel> bookmark_sub_menu_model_; | 168 scoped_ptr<BookmarkSubMenuModel> bookmark_sub_menu_model_; |
164 | 169 |
165 // Recent Tabs submenu. | 170 // Recent Tabs submenu. |
166 scoped_ptr<RecentTabsSubMenuModel> recent_tabs_sub_menu_model_; | 171 scoped_ptr<RecentTabsSubMenuModel> recent_tabs_sub_menu_model_; |
167 | 172 |
168 ui::AcceleratorProvider* provider_; // weak | 173 ui::AcceleratorProvider* provider_; // weak |
169 | 174 |
170 Browser* browser_; // weak | 175 Browser* browser_; // weak |
171 TabStripModel* tab_strip_model_; // weak | 176 TabStripModel* tab_strip_model_; // weak |
172 | 177 |
173 content::NotificationRegistrar registrar_; | 178 content::NotificationRegistrar registrar_; |
174 | 179 |
175 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); | 180 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); |
176 }; | 181 }; |
177 | 182 |
178 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 183 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
OLD | NEW |