Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(983)

Issue 5697005: Change SimpleMenuModel on OSX to support dynamic icons (Closed)

Created:
10 years ago by Andrew T Wilson (Slow)
Modified:
9 years, 7 months ago
Reviewers:
Evan Stade
CC:
chromium-reviews, Paweł Hajdan Jr., pam+watch_chromium.org, rdsmith+dwatch_chromium.org, davemoore+watch_chromium.org, ben+cc_chromium.org
Visibility:
Public.

Description

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 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=69234

Patch Set 1 #

Patch Set 2 : Added SimpleMenuModel::GetIconForCommandId() #

Patch Set 3 : Moved background page badge fix to another CL. #

Total comments: 9

Patch Set 4 : Review feedback #

Total comments: 2

Patch Set 5 : Update after merge #

Unified diffs Side-by-side diffs Delta from patch set Stats (+148 lines, -63 lines) Patch
M app/menus/button_menu_item_model.h View 3 chunks +3 lines, -3 lines 0 comments Download
M app/menus/button_menu_item_model.cc View 2 chunks +4 lines, -4 lines 0 comments Download
M app/menus/menu_model.h View 1 2 3 1 chunk +5 lines, -4 lines 0 comments Download
M app/menus/simple_menu_model.h View 1 2 chunks +6 lines, -3 lines 0 comments Download
M app/menus/simple_menu_model.cc View 1 4 chunks +12 lines, -4 lines 0 comments Download
M chrome/browser/autocomplete/autocomplete_edit_view_win.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/autocomplete/autocomplete_edit_view_win.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/status/clock_menu_button.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/status/input_method_menu.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/status/input_method_menu.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/status/network_menu.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/status/power_menu_button.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/download/download_shelf.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/download/download_shelf.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/gtk/menu_gtk.cc View 1 2 3 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/notifications/notification_options_menu_model.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/notifications/notification_options_menu_model.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/cocoa/menu_controller.mm View 1 2 3 4 1 chunk +7 lines, -1 line 0 comments Download
M chrome/browser/ui/cocoa/menu_controller_unittest.mm View 1 2 3 4 3 chunks +65 lines, -0 lines 0 comments Download
M chrome/browser/ui/toolbar/back_forward_menu_model.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/toolbar/back_forward_menu_model.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/toolbar/wrench_menu_model.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/toolbar/wrench_menu_model.cc View 1 2 3 5 chunks +21 lines, -24 lines 0 comments Download
M chrome/browser/ui/views/frame/browser_view.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/frame/browser_view.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M views/controls/menu/native_menu_win.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M views/controls/menu/native_menu_x.cc View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 4 (0 generated)
Andrew T Wilson (Slow)
Please take a look - this is the change we discussed last week for dynamic ...
10 years ago (2010-12-14 00:14:36 UTC) #1
Evan Stade
mostly LGTM http://codereview.chromium.org/5697005/diff/4001/chrome/browser/gtk/menu_gtk.cc File chrome/browser/gtk/menu_gtk.cc (right): http://codereview.chromium.org/5697005/diff/4001/chrome/browser/gtk/menu_gtk.cc#newcode785 chrome/browser/gtk/menu_gtk.cc:785: if (model->IsItemDynamicAt(id)) { add TODO re: images ...
10 years ago (2010-12-14 01:20:13 UTC) #2
Andrew T Wilson (Slow)
Please take another look. http://codereview.chromium.org/5697005/diff/4001/chrome/browser/gtk/menu_gtk.cc File chrome/browser/gtk/menu_gtk.cc (right): http://codereview.chromium.org/5697005/diff/4001/chrome/browser/gtk/menu_gtk.cc#newcode785 chrome/browser/gtk/menu_gtk.cc:785: if (model->IsItemDynamicAt(id)) { On 2010/12/14 ...
10 years ago (2010-12-14 18:23:27 UTC) #3
Evan Stade
10 years ago (2010-12-14 21:28:57 UTC) #4
LGTM

http://codereview.chromium.org/5697005/diff/4001/chrome/browser/gtk/menu_gtk.cc
File chrome/browser/gtk/menu_gtk.cc (right):

http://codereview.chromium.org/5697005/diff/4001/chrome/browser/gtk/menu_gtk....
chrome/browser/gtk/menu_gtk.cc:785: if (model->IsItemDynamicAt(id)) {
I think that's because the common pattern is to just destroy and rebuild the
menu view from the menu model every time it's shown

http://codereview.chromium.org/5697005/diff/30/chrome/browser/ui/cocoa/menu_c...
File chrome/browser/ui/cocoa/menu_controller.mm (right):

http://codereview.chromium.org/5697005/diff/30/chrome/browser/ui/cocoa/menu_c...
chrome/browser/ui/cocoa/menu_controller.mm:152: SkBitmap skiaIcon;
SkBitmap skiaIcon;
NSImage* icon = nil;
if (model->GetIconAt(modelIndex, &skiaIcon) && !skiaIcon.isNull())
  icon = gfx::SkBitmapToNSImage(skiaIcon);
[(id)item setImage:icon];

http://codereview.chromium.org/5697005/diff/30/chrome/browser/ui/cocoa/menu_c...
File chrome/browser/ui/cocoa/menu_controller_unittest.mm (right):

http://codereview.chromium.org/5697005/diff/30/chrome/browser/ui/cocoa/menu_c...
chrome/browser/ui/cocoa/menu_controller_unittest.mm:56: void
SetDynamicIcon(SkBitmap* icon) { icon_ = icon; }
nit: blank line here please

Powered by Google App Engine
This is Rietveld 408576698