summaryrefslogtreecommitdiffstats
path: root/app/menus
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-27 19:46:04 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-27 19:46:04 +0000
commit108011938035924b2ff64fd76abb9bd967f67c0f (patch)
tree2927816fbecdacd971ea18ce28c83c0132730271 /app/menus
parent60742f122a4dabbcd946dfd7c1dc214366075df7 (diff)
downloadchromium_src-108011938035924b2ff64fd76abb9bd967f67c0f.zip
chromium_src-108011938035924b2ff64fd76abb9bd967f67c0f.tar.gz
chromium_src-108011938035924b2ff64fd76abb9bd967f67c0f.tar.bz2
Exposed an IsEnabledAt for ButtonMenuItemModel (this is not used yet, will be used in a subsequent checkin). The Mac wrench menu zoom controls honor the global enabled state of the zoom commands.
BUG=None. TEST=Open a PDF using the internal PDF viewer on the Mac. The Zoom controls on the Wrench menu should be disabled. Review URL: http://codereview.chromium.org/3026025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/menus')
-rw-r--r--app/menus/button_menu_item_model.cc6
-rw-r--r--app/menus/button_menu_item_model.h4
2 files changed, 10 insertions, 0 deletions
diff --git a/app/menus/button_menu_item_model.cc b/app/menus/button_menu_item_model.cc
index c1c7f7a..94949e4 100644
--- a/app/menus/button_menu_item_model.cc
+++ b/app/menus/button_menu_item_model.cc
@@ -102,4 +102,10 @@ void ButtonMenuItemModel::ActivatedCommand(int command_id) {
delegate_->ExecuteCommand(command_id);
}
+bool ButtonMenuItemModel::IsEnabledAt(int index) const {
+ if (delegate_)
+ return delegate_->IsCommandIdEnabled(items_[index].command_id);
+ return true;
+}
+
} // namespace menus
diff --git a/app/menus/button_menu_item_model.h b/app/menus/button_menu_item_model.h
index 29a8b7c..8e3300e 100644
--- a/app/menus/button_menu_item_model.h
+++ b/app/menus/button_menu_item_model.h
@@ -31,6 +31,7 @@ class ButtonMenuItemModel {
// Performs the action associated with the specified command id.
virtual void ExecuteCommand(int command_id) = 0;
+ virtual bool IsCommandIdEnabled(int command_id) const { return true; }
};
ButtonMenuItemModel(int string_id, ButtonMenuItemModel::Delegate* delegate);
@@ -77,6 +78,9 @@ class ButtonMenuItemModel {
// Called from implementations.
void ActivatedCommand(int command_id);
+ // Returns the enabled state of the button at |index|.
+ bool IsEnabledAt(int index) const;
+
const string16& label() const { return item_label_; }
private: