Chromium Code Reviews| Index: chrome/browser/cocoa/wrench_menu_controller.mm |
| diff --git a/chrome/browser/cocoa/wrench_menu_controller.mm b/chrome/browser/cocoa/wrench_menu_controller.mm |
| index 49661570aa3749a517e05328756cc34702a45ba3..11d40a2b6e3eb43576352bc24715d8db1ff94042 100644 |
| --- a/chrome/browser/cocoa/wrench_menu_controller.mm |
| +++ b/chrome/browser/cocoa/wrench_menu_controller.mm |
| @@ -63,6 +63,11 @@ class ZoomLevelObserver : public NotificationObserver { |
| return self; |
| } |
| +- (void)setWrenchMenuModel:(WrenchMenuModel*)model { |
|
Robert Sesek
2010/08/24 00:31:13
Remove.
Robert Sesek
2010/08/24 15:28:07
Keep this.
|
| + wrench_model_ = model; |
| + [self setModel:model->menu_model()]; |
| +} |
| + |
| - (void)addItemToMenu:(NSMenu*)menu |
| atIndex:(NSInteger)index |
| fromModel:(menus::MenuModel*)model |
| @@ -166,37 +171,7 @@ class ZoomLevelObserver : public NotificationObserver { |
| } |
| - (WrenchMenuModel*)wrenchMenuModel { |
|
Robert Sesek
2010/08/24 15:28:07
Remove this (the compiler will generate it).
|
| - return static_cast<WrenchMenuModel*>(model_); |
| -} |
| - |
| -// Inserts the update available notification menu item. |
| -- (void)insertUpdateAvailableItem { |
|
Robert Sesek
2010/08/24 00:31:13
Cocoa's MenuController (and thus the WrenchMenuCon
|
| - WrenchMenuModel* model = [self wrenchMenuModel]; |
| - // Don't insert the item multiple times. |
| - if (!model || model->GetIndexOfCommandId(IDC_ABOUT) != -1) |
| - return; |
| - |
| - // Update the model manually because the model is static because other |
| - // platforms always have an About item. |
| - int index = model->GetIndexOfCommandId(IDC_OPTIONS) + 1; |
| - model->InsertItemAt(index, IDC_ABOUT, |
| - l10n_util::GetStringFUTF16(IDS_ABOUT, |
| - l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); |
| - |
| - // The model does not broadcast change notifications to its delegate, so |
| - // insert the actual menu item ourselves. |
| - NSInteger menuIndex = [[self menu] indexOfItemWithTag:index]; |
| - [self addItemToMenu:[self menu] |
| - atIndex:menuIndex |
| - fromModel:model |
| - modelIndex:index]; |
| - |
| - // Since the tag of each menu item is the index within the model, they need |
| - // to be adjusted after insertion. |
| - for (NSInteger i = menuIndex + 1; i < [[self menu] numberOfItems]; ++i) { |
| - NSMenuItem* item = [[self menu] itemAtIndex:i]; |
| - [item setTag:[item tag] + 1]; |
| - } |
| + return wrench_model_; |
|
Robert Sesek
2010/08/24 00:31:13
Keep this as it was.
|
| } |
| // Fit the localized strings into the Cut/Copy/Paste control, then resize the |