OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_WRENCH_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_WRENCH_MENU_MODEL_H_ |
6 #define CHROME_BROWSER_WRENCH_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_WRENCH_MENU_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/menus/button_menu_item_model.h" | 9 #include "app/menus/button_menu_item_model.h" |
10 #include "app/menus/simple_menu_model.h" | 10 #include "app/menus/simple_menu_model.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 virtual void TabStripModelDeleted(); | 99 virtual void TabStripModelDeleted(); |
100 | 100 |
101 // Overridden from NotificationObserver: | 101 // Overridden from NotificationObserver: |
102 virtual void Observe(NotificationType type, | 102 virtual void Observe(NotificationType type, |
103 const NotificationSource& source, | 103 const NotificationSource& source, |
104 const NotificationDetails& details); | 104 const NotificationDetails& details); |
105 | 105 |
106 // Getters. | 106 // Getters. |
107 Browser* browser() const { return browser_; } | 107 Browser* browser() const { return browser_; } |
108 | 108 |
| 109 // Calculates |zoom_label_| in response to a zoom change. |
| 110 void UpdateZoomControls(); |
| 111 |
109 private: | 112 private: |
110 // Testing constructor used for mocking. | 113 // Testing constructor used for mocking. |
111 friend class ::MockWrenchMenuModel; | 114 friend class ::MockWrenchMenuModel; |
112 WrenchMenuModel() : menus::SimpleMenuModel(NULL) {} | 115 WrenchMenuModel() : menus::SimpleMenuModel(NULL) {} |
113 | 116 |
114 void Build(); | 117 void Build(); |
115 | 118 |
116 // Adds custom items to the menu. Deprecated in favor of a cross platform | 119 // Adds custom items to the menu. Deprecated in favor of a cross platform |
117 // model for button items. | 120 // model for button items. |
118 void CreateCutCopyPaste(); | 121 void CreateCutCopyPaste(); |
119 void CreateZoomFullscreen(); | 122 void CreateZoomFullscreen(); |
120 | 123 |
121 // Calculates |zoom_label_| in response to a zoom change. | 124 // Gets the current zoom information from the renderer. |
122 void UpdateZoomControls(); | |
123 double GetZoom(bool* enable_increment, bool* enable_decrement); | 125 double GetZoom(bool* enable_increment, bool* enable_decrement); |
124 | 126 |
125 string16 GetSyncMenuLabel() const; | 127 string16 GetSyncMenuLabel() const; |
126 string16 GetAboutEntryMenuLabel() const; | 128 string16 GetAboutEntryMenuLabel() const; |
127 bool IsDynamicItem(int index) const; | 129 bool IsDynamicItem(int index) const; |
128 | 130 |
129 // Models for the special menu items with buttons. | 131 // Models for the special menu items with buttons. |
130 scoped_ptr<menus::ButtonMenuItemModel> edit_menu_item_model_; | 132 scoped_ptr<menus::ButtonMenuItemModel> edit_menu_item_model_; |
131 scoped_ptr<menus::ButtonMenuItemModel> zoom_menu_item_model_; | 133 scoped_ptr<menus::ButtonMenuItemModel> zoom_menu_item_model_; |
132 | 134 |
133 // Label of the zoom label in the zoom menu item. | 135 // Label of the zoom label in the zoom menu item. |
134 string16 zoom_label_; | 136 string16 zoom_label_; |
135 | 137 |
136 // Tools menu. | 138 // Tools menu. |
137 scoped_ptr<ToolsMenuModel> tools_menu_model_; | 139 scoped_ptr<ToolsMenuModel> tools_menu_model_; |
138 | 140 |
139 menus::SimpleMenuModel::Delegate* delegate_; // weak | 141 menus::SimpleMenuModel::Delegate* delegate_; // weak |
140 | 142 |
141 Browser* browser_; // weak | 143 Browser* browser_; // weak |
142 TabStripModel* tabstrip_model_; // weak | 144 TabStripModel* tabstrip_model_; // weak |
143 | 145 |
144 NotificationRegistrar registrar_; | 146 NotificationRegistrar registrar_; |
145 | 147 |
146 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); | 148 DISALLOW_COPY_AND_ASSIGN(WrenchMenuModel); |
147 }; | 149 }; |
148 | 150 |
149 #endif // CHROME_BROWSER_WRENCH_MENU_MODEL_H_ | 151 #endif // CHROME_BROWSER_WRENCH_MENU_MODEL_H_ |
OLD | NEW |