summaryrefslogtreecommitdiffstats
path: root/app/menus/simple_menu_model.cc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 19:22:41 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 19:22:41 +0000
commitb21d691e4e486071ac8601fee7867c29729faca6 (patch)
tree7829cdf53b53a938bcedc4c0565dea3fbb406684 /app/menus/simple_menu_model.cc
parent61c13e8d5361469479e5c0bf61d0c25a5402ef15 (diff)
downloadchromium_src-b21d691e4e486071ac8601fee7867c29729faca6.zip
chromium_src-b21d691e4e486071ac8601fee7867c29729faca6.tar.gz
chromium_src-b21d691e4e486071ac8601fee7867c29729faca6.tar.bz2
The "Update Chrome" menu item should appear in addition to the About menu.
It should not replace it. This patch modifications to the GTK and Cocoa ports to make the update chrome item appear when an update is available. On win/chromeos, the menu item is always there but disabled, since I'm having some problems figuring out the views custom menu implementation. BUG=46221 TEST=The upgrade item should now appear under instead of replacing the about command. Review URL: http://codereview.chromium.org/3143046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/menus/simple_menu_model.cc')
-rw-r--r--app/menus/simple_menu_model.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/menus/simple_menu_model.cc b/app/menus/simple_menu_model.cc
index 6a40f75..b645b09 100644
--- a/app/menus/simple_menu_model.cc
+++ b/app/menus/simple_menu_model.cc
@@ -24,6 +24,10 @@ struct SimpleMenuModel::Item {
////////////////////////////////////////////////////////////////////////////////
// SimpleMenuModel::Delegate, public:
+bool SimpleMenuModel::Delegate::IsCommandIdVisible(int command_id) const {
+ return true;
+}
+
bool SimpleMenuModel::Delegate::IsLabelForCommandIdDynamic(
int command_id) const {
return false;
@@ -250,6 +254,14 @@ bool SimpleMenuModel::IsEnabledAt(int index) const {
return delegate_->IsCommandIdEnabled(command_id);
}
+bool SimpleMenuModel::IsVisibleAt(int index) const {
+ int command_id = GetCommandIdAt(index);
+ if (!delegate_ || command_id == kSeparatorId ||
+ items_.at(FlipIndex(index)).button_model)
+ return true;
+ return delegate_->IsCommandIdVisible(command_id);
+}
+
void SimpleMenuModel::HighlightChangedTo(int index) {
if (delegate_)
delegate_->CommandIdHighlighted(GetCommandIdAt(index));
@@ -264,6 +276,10 @@ MenuModel* SimpleMenuModel::GetSubmenuModelAt(int index) const {
return items_.at(FlipIndex(index)).submenu;
}
+int SimpleMenuModel::FlipIndex(int index) const {
+ return index;
+}
+
////////////////////////////////////////////////////////////////////////////////
// SimpleMenuModel, Private: