Chromium Code Reviews| Index: chrome/browser/app_controller_mac.mm |
| diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm |
| index 426af0ce9d093e069fd765a0c2810e992d65d5ea..7dd5fcf28a4be7bf7870835aef05cb6f02b63f38 100644 |
| --- a/chrome/browser/app_controller_mac.mm |
| +++ b/chrome/browser/app_controller_mac.mm |
| @@ -1195,35 +1195,10 @@ void RecordLastRunAppBundlePath() { |
| NSMenu* dockMenu = [[[NSMenu alloc] initWithTitle: @""] autorelease]; |
| Profile* profile = [self defaultProfile]; |
| - // TODO(rickcam): Mock out BackgroundApplicationListModel, then add unit |
| - // tests which use the mock in place of the profile-initialized model. |
| - |
| - // Avoid breaking unit tests which have no profile. |
| - if (profile) { |
| - int position = 0; |
| - BackgroundApplicationListModel applications(profile); |
| - for (ExtensionList::const_iterator cursor = applications.begin(); |
| - cursor != applications.end(); |
| - ++cursor, ++position) { |
| - DCHECK(position == applications.GetPosition(*cursor)); |
| - scoped_nsobject<NSMenuItem> appItem([[NSMenuItem alloc] |
| - initWithTitle:base::SysUTF16ToNSString(UTF8ToUTF16((*cursor)->name())) |
| - action:@selector(commandFromDock:) |
| - keyEquivalent:@""]); |
| - [appItem setTarget:self]; |
| - [appItem setTag:position]; |
| - [dockMenu addItem:appItem]; |
| - } |
| - if (applications.begin() != applications.end()) { |
| - NSMenuItem* sepItem = [[NSMenuItem separatorItem] init]; |
| - [dockMenu addItem:sepItem]; |
| - } |
| - } |
| - |
| NSString* titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_WINDOW_MAC); |
| scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc] |
| initWithTitle:titleStr |
| - action:@selector(commandFromDock:) |
| + action:@selector(commandFromDock:) |
| keyEquivalent:@""]); |
|
John Gregg
2011/01/20 23:00:21
super nitpicky, but I don't think this is formatte
|
| [item setTarget:self]; |
| [item setTag:IDC_NEW_WINDOW]; |
| @@ -1231,12 +1206,48 @@ void RecordLastRunAppBundlePath() { |
| titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_INCOGNITO_WINDOW_MAC); |
| item.reset([[NSMenuItem alloc] initWithTitle:titleStr |
| - action:@selector(commandFromDock:) |
| + action:@selector(commandFromDock:) |
| keyEquivalent:@""]); |
| [item setTarget:self]; |
| [item setTag:IDC_NEW_INCOGNITO_WINDOW]; |
| [dockMenu addItem:item]; |
| + // TODO(rickcam): Mock out BackgroundApplicationListModel, then add unit |
| + // tests which use the mock in place of the profile-initialized model. |
| + |
| + // Avoid breaking unit tests which have no profile. |
| + if (profile) { |
| + BackgroundApplicationListModel applications(profile); |
| + if (applications.size()) { |
| + int position = 0; |
| + NSString* menuStr = |
| + l10n_util::GetNSStringWithFixup(IDS_BACKGROUND_APPS_MAC); |
| + scoped_nsobject<NSMenu> appMenu([[NSMenu alloc] initWithTitle:menuStr]); |
| + for (ExtensionList::const_iterator cursor = applications.begin(); |
| + cursor != applications.end(); |
| + ++cursor, ++position) { |
| + DCHECK(position == applications.GetPosition(*cursor)); |
| + NSString* itemStr = |
| + base::SysUTF16ToNSString(UTF8ToUTF16((*cursor)->name())); |
| + scoped_nsobject<NSMenuItem> appItem([[NSMenuItem alloc] |
| + initWithTitle:itemStr |
| + action:@selector(commandFromDock:) |
| + keyEquivalent:@""]); |
| + [appItem setTarget:self]; |
| + [appItem setTag:position]; |
| + [appMenu addItem:appItem]; |
| + } |
| + scoped_nsobject<NSMenuItem> appMenuItem([[NSMenuItem alloc] |
| + initWithTitle:menuStr |
| + action:@selector(commandFromDock:) |
| + keyEquivalent:@""]); |
| + [appMenuItem setTarget:self]; |
| + [appMenuItem setTag:position]; |
| + [appMenuItem setSubmenu:appMenu]; |
| + [dockMenu addItem:appMenuItem]; |
| + } |
| + } |
| + |
| return dockMenu; |
| } |