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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Range of command ID's to use for the items representing bookmarks in the | 82 // Range of command ID's to use for the items representing bookmarks in the |
83 // bookmark menu, must not overlap with that for recent tabs submenu. | 83 // bookmark menu, must not overlap with that for recent tabs submenu. |
84 static const int kMinBookmarkCommandId = 1; | 84 static const int kMinBookmarkCommandId = 1; |
85 static const int kMaxBookmarkCommandId = 1000; | 85 static const int kMaxBookmarkCommandId = 1000; |
86 | 86 |
87 // Range of command ID's to use for the items in the recent tabs submenu, must | 87 // Range of command ID's to use for the items in the recent tabs submenu, must |
88 // not overlap with that for bookmarks. | 88 // not overlap with that for bookmarks. |
89 static const int kMinRecentTabsCommandId = 1001; | 89 static const int kMinRecentTabsCommandId = 1001; |
90 static const int kMaxRecentTabsCommandId = 1200; | 90 static const int kMaxRecentTabsCommandId = 1200; |
91 | 91 |
92 // TODO: remove |is_new_menu|. | 92 WrenchMenuModel(ui::AcceleratorProvider* provider, Browser* browser); |
93 WrenchMenuModel(ui::AcceleratorProvider* provider, | |
94 Browser* browser, | |
95 bool is_new_menu); | |
96 virtual ~WrenchMenuModel(); | 93 virtual ~WrenchMenuModel(); |
97 | 94 |
98 // Overridden for ButtonMenuItemModel::Delegate: | 95 // Overridden for ButtonMenuItemModel::Delegate: |
99 virtual bool DoesCommandIdDismissMenu(int command_id) const OVERRIDE; | 96 virtual bool DoesCommandIdDismissMenu(int command_id) const OVERRIDE; |
100 | 97 |
101 // Overridden for both ButtonMenuItemModel::Delegate and SimpleMenuModel: | 98 // Overridden for both ButtonMenuItemModel::Delegate and SimpleMenuModel: |
102 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; | 99 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; |
103 virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; | 100 virtual base::string16 GetLabelForCommandId(int command_id) const OVERRIDE; |
104 virtual bool GetIconForCommandId(int command_id, | 101 virtual bool GetIconForCommandId(int command_id, |
105 gfx::Image* icon) const OVERRIDE; | 102 gfx::Image* icon) const OVERRIDE; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Calculates |zoom_label_| in response to a zoom change. | 134 // Calculates |zoom_label_| in response to a zoom change. |
138 void UpdateZoomControls(); | 135 void UpdateZoomControls(); |
139 | 136 |
140 private: | 137 private: |
141 class HelpMenuModel; | 138 class HelpMenuModel; |
142 // Testing constructor used for mocking. | 139 // Testing constructor used for mocking. |
143 friend class ::MockWrenchMenuModel; | 140 friend class ::MockWrenchMenuModel; |
144 | 141 |
145 WrenchMenuModel(); | 142 WrenchMenuModel(); |
146 | 143 |
147 void Build(bool is_new_menu); | 144 void Build(); |
148 | 145 |
149 void AddGlobalErrorMenuItems(); | 146 void AddGlobalErrorMenuItems(); |
150 | 147 |
151 // Appends everything needed for the clipboard menu: a menu break, the | 148 // Appends everything needed for the clipboard menu: a menu break, the |
152 // clipboard menu content and the finalizing menu break. If the last break | 149 // clipboard menu content and the finalizing menu break. |
153 // is not needed it can be suppressed by setting |new_menu| | 150 void CreateCutCopyPasteMenu(); |
154 // to false. | |
155 void CreateCutCopyPasteMenu(bool new_menu); | |
156 | 151 |
157 // Add a menu item for the extension icons. | 152 // Add a menu item for the extension icons. |
158 void CreateExtensionToolbarOverflowMenu(); | 153 void CreateExtensionToolbarOverflowMenu(); |
159 | 154 |
160 // Appends everything needed for the zoom menu: a menu break, then the zoom | 155 // Appends everything needed for the zoom menu: a menu break, then the zoom |
161 // menu content and then another menu break. If the new menu type is used, | 156 // menu content and then another menu break. |
162 // |new_menu| should be set to true. | 157 void CreateZoomMenu(); |
163 void CreateZoomMenu(bool new_menu); | |
164 | 158 |
165 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); | 159 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); |
166 | 160 |
167 bool ShouldShowNewIncognitoWindowMenuItem(); | 161 bool ShouldShowNewIncognitoWindowMenuItem(); |
168 | 162 |
169 // Models for the special menu items with buttons. | 163 // Models for the special menu items with buttons. |
170 scoped_ptr<ui::ButtonMenuItemModel> edit_menu_item_model_; | 164 scoped_ptr<ui::ButtonMenuItemModel> edit_menu_item_model_; |
171 scoped_ptr<ui::ButtonMenuItemModel> zoom_menu_item_model_; | 165 scoped_ptr<ui::ButtonMenuItemModel> zoom_menu_item_model_; |
172 | 166 |
173 // Label of the zoom label in the zoom menu item. | 167 // Label of the zoom label in the zoom menu item. |
(...skipping 19 matching lines...) Expand all Loading... |
193 TabStripModel* tab_strip_model_; // weak | 187 TabStripModel* tab_strip_model_; // weak |
194 | 188 |
195 scoped_ptr<content::HostZoomMap::Subscription> content_zoom_subscription_; | 189 scoped_ptr<content::HostZoomMap::Subscription> content_zoom_subscription_; |
196 scoped_ptr<content::HostZoomMap::Subscription> browser_zoom_subscription_; | 190 scoped_ptr<content::HostZoomMap::Subscription> browser_zoom_subscription_; |
197 content::NotificationRegistrar registrar_; | 191 content::NotificationRegistrar registrar_; |
198 | 192 |
199 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); | 193 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); |
200 }; | 194 }; |
201 | 195 |
202 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ | 196 #endif // CHROME_BROWSER_UI_TOOLBAR_WRENCH_MENU_MODEL_H_ |
OLD | NEW |