summaryrefslogtreecommitdiffstats
path: root/chrome/browser/app_controller_mac.mm
diff options
context:
space:
mode:
authorsgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-17 22:23:44 +0000
committersgk@google.com <sgk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-17 22:23:44 +0000
commit018a396fc1650116ecc1df0ad7e5b65ec5ad7bec (patch)
tree62925bb9a560367a8005a59d734fae3875e6ce6d /chrome/browser/app_controller_mac.mm
parente4865191dc123219b81b2905f1a8d23a86ab9573 (diff)
downloadchromium_src-018a396fc1650116ecc1df0ad7e5b65ec5ad7bec.zip
chromium_src-018a396fc1650116ecc1df0ad7e5b65ec5ad7bec.tar.gz
chromium_src-018a396fc1650116ecc1df0ad7e5b65ec5ad7bec.tar.bz2
Stylistic fixes in the new dock menu code:
* Initialize variables when declared. * Descriptive name (dock_menu) for the returned value. * Use a scoped_nsobject in the unit test, not autorelease. BUG=none TEST=AppControllerTest.DockMenu Review URL: http://codereview.chromium.org/200126 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26507 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/app_controller_mac.mm')
-rw-r--r--chrome/browser/app_controller_mac.mm26
1 files changed, 12 insertions, 14 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index aee634b..3a65d3e 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -652,27 +652,25 @@
}
- (NSMenu*)applicationDockMenu:(id)sender {
- NSMenu* result = [[[NSMenu alloc] initWithTitle: @""] autorelease];
- NSString* titleStr;
- id item;
-
- titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_WINDOW_MAC);
- item = [[[NSMenuItem alloc] initWithTitle:titleStr
- action:@selector(commandDispatch:)
- keyEquivalent:@""] autorelease];
+ NSMenu* dockMenu = [[[NSMenu alloc] initWithTitle: @""] autorelease];
+ NSString* titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_WINDOW_MAC);
+ scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc]
+ initWithTitle:titleStr
+ action:@selector(commandDispatch:)
+ keyEquivalent:@""]);
[item setTarget:self];
[item setTag:IDC_NEW_WINDOW];
- [result addItem:item];
+ [dockMenu addItem:item];
titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_INCOGNITO_WINDOW_MAC);
- item = [[[NSMenuItem alloc] initWithTitle:titleStr
- action:@selector(commandDispatch:)
- keyEquivalent:@""] autorelease];
+ item.reset([[NSMenuItem alloc] initWithTitle:titleStr
+ action:@selector(commandDispatch:)
+ keyEquivalent:@""]);
[item setTarget:self];
[item setTag:IDC_NEW_INCOGNITO_WINDOW];
- [result addItem:item];
+ [dockMenu addItem:item];
- return result;
+ return dockMenu;
}
@end