summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authoratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-15 06:48:55 +0000
committeratwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-15 06:48:55 +0000
commit0b282f9e8acb6b4b945df8121814a4cfba71dc32 (patch)
tree97182e3f900fbc6b86a6c1c4cb3542cfa3a216d7 /views
parent7e6db17fdb7a995f70249881c399e522e69fb257 (diff)
downloadchromium_src-0b282f9e8acb6b4b945df8121814a4cfba71dc32.zip
chromium_src-0b282f9e8acb6b4b945df8121814a4cfba71dc32.tar.gz
chromium_src-0b282f9e8acb6b4b945df8121814a4cfba71dc32.tar.bz2
Change menus on OSX to update the icon dynamically.
Change MenuModel::IsLabelDynamicAt() to IsItemDynamicAt() to reflect its true purpose. Add SimpleMenuModel::GetIconForCommandId() to enable dynamic icons. Update OSX menu_controller code to update the icon for dynamic menu items when the menu is opened, to match the windows behavior. BUG=66508 TEST=MenuControllerTest.Dynamic Review URL: http://codereview.chromium.org/5697005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69234 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/menu/native_menu_win.cc3
-rw-r--r--views/controls/menu/native_menu_x.cc4
2 files changed, 5 insertions, 2 deletions
diff --git a/views/controls/menu/native_menu_win.cc b/views/controls/menu/native_menu_win.cc
index 9993d4e..3c31639 100644
--- a/views/controls/menu/native_menu_win.cc
+++ b/views/controls/menu/native_menu_win.cc
@@ -372,7 +372,8 @@ void NativeMenuWin::UpdateStates() {
int menu_index = model_index + first_item_index_;
SetMenuItemState(menu_index, model_->IsEnabledAt(model_index),
model_->IsItemCheckedAt(model_index), false);
- if (model_->IsLabelDynamicAt(model_index)) {
+ if (model_->IsItemDynamicAt(model_index)) {
+ // TODO(atwilson): Update the icon as well (http://crbug.com/66508).
SetMenuItemLabel(menu_index, model_index,
model_->GetLabelAt(model_index));
}
diff --git a/views/controls/menu/native_menu_x.cc b/views/controls/menu/native_menu_x.cc
index db47f7e..45f9446 100644
--- a/views/controls/menu/native_menu_x.cc
+++ b/views/controls/menu/native_menu_x.cc
@@ -136,12 +136,14 @@ void NativeMenuX::UpdateMenuFromModel(SubmenuView* menu,
MenuItemView* mitem = menu->GetMenuItemAt(index - sep);
mitem->SetVisible(model->IsVisibleAt(index));
mitem->SetEnabled(model->IsEnabledAt(index));
- if (model->IsLabelDynamicAt(index)) {
+ if (model->IsItemDynamicAt(index)) {
mitem->SetTitle(UTF16ToWide(model->GetLabelAt(index)));
}
SkBitmap icon;
if (model->GetIconAt(index, &icon)) {
+ // TODO(atwilson): Support removing the icon dynamically
+ // (http://crbug.com/66508).
mitem->SetIcon(icon);
}