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

Side by Side Diff: chrome/browser/app_controller_mac.mm

Issue 6241009: Moving Background App support on the Mac Dock menu into its own submenu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Submenus work Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/app_controller_mac.h" 5 #import "chrome/browser/app_controller_mac.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/l10n_util_mac.h" 8 #include "app/l10n_util_mac.h"
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 1193
1194 - (NSMenu*)applicationDockMenu:(NSApplication*)sender { 1194 - (NSMenu*)applicationDockMenu:(NSApplication*)sender {
1195 NSMenu* dockMenu = [[[NSMenu alloc] initWithTitle: @""] autorelease]; 1195 NSMenu* dockMenu = [[[NSMenu alloc] initWithTitle: @""] autorelease];
1196 Profile* profile = [self defaultProfile]; 1196 Profile* profile = [self defaultProfile];
1197 1197
1198 // TODO(rickcam): Mock out BackgroundApplicationListModel, then add unit 1198 // TODO(rickcam): Mock out BackgroundApplicationListModel, then add unit
1199 // tests which use the mock in place of the profile-initialized model. 1199 // tests which use the mock in place of the profile-initialized model.
1200 1200
1201 // Avoid breaking unit tests which have no profile. 1201 // Avoid breaking unit tests which have no profile.
1202 if (profile) { 1202 if (profile) {
1203 int position = 0; 1203 int position = 0;
John Gregg 2011/01/20 19:58:26 move declaration of position inside if block
The wrong rickcam account 2011/01/20 22:13:37 Done.
1204 BackgroundApplicationListModel applications(profile); 1204 BackgroundApplicationListModel applications(profile);
1205 for (ExtensionList::const_iterator cursor = applications.begin(); 1205 if (applications.size()) {
1206 cursor != applications.end(); 1206 scoped_nsobject<NSMenu> appMenu([[NSMenu alloc] initWithTitle: @"Backgroun d apps"]);
John Gregg 2011/01/20 19:58:26 80 char. How is that raw string okay for i18n?
Andrew T Wilson (Slow) 2011/01/20 20:02:33 See below (GetNSStringXXXX) for examples of how to
The wrong rickcam account 2011/01/20 22:13:37 Done. It appears that content of the string is un
1207 ++cursor, ++position) { 1207 for (ExtensionList::const_iterator cursor = applications.begin();
1208 DCHECK(position == applications.GetPosition(*cursor)); 1208 cursor != applications.end();
1209 scoped_nsobject<NSMenuItem> appItem([[NSMenuItem alloc] 1209 ++cursor, ++position) {
1210 initWithTitle:base::SysUTF16ToNSString(UTF8ToUTF16((*cursor)->name())) 1210 DCHECK(position == applications.GetPosition(*cursor));
1211 scoped_nsobject<NSMenuItem> appItem([[NSMenuItem alloc]
1212 initWithTitle:base::
1213 SysUTF16ToNSString(UTF8ToUTF16((*cursor)->name()))
1214 action:@selector(commandFromDock:)
1215 keyEquivalent:@""]);
1216 [appItem setTarget:self];
1217 [appItem setTag:position];
1218 [appMenu addItem:appItem];
1219 }
1220 scoped_nsobject<NSMenuItem> appMenuItem([[NSMenuItem alloc]
1221 initWithTitle:base::SysUTF16ToNSString(UTF8ToUTF16("Background apps"))
The wrong rickcam account 2011/01/20 22:13:37 Replaced "Background apps" with a localized NSStri
1211 action:@selector(commandFromDock:) 1222 action:@selector(commandFromDock:)
1212 keyEquivalent:@""]); 1223 keyEquivalent:@""]);
John Gregg 2011/01/20 19:58:26 formatting in this function is inconsistent with O
The wrong rickcam account 2011/01/20 22:13:37 Done. Touched up a few other spots that had the s
1213 [appItem setTarget:self]; 1224 [appMenuItem setTarget:self];
1214 [appItem setTag:position]; 1225 [appMenuItem setTag:position];
1215 [dockMenu addItem:appItem]; 1226 [appMenuItem setSubmenu:appMenu];
1216 } 1227 [dockMenu addItem:appMenuItem];
1217 if (applications.begin() != applications.end()) {
1218 NSMenuItem* sepItem = [[NSMenuItem separatorItem] init];
1219 [dockMenu addItem:sepItem];
1220 } 1228 }
1221 } 1229 }
1222 1230
1223 NSString* titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_WINDOW_MAC); 1231 NSString* titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_WINDOW_MAC);
1224 scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc] 1232 scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc]
1225 initWithTitle:titleStr 1233 initWithTitle:titleStr
1226 action:@selector(commandFromDock:) 1234 action:@selector(commandFromDock:)
1227 keyEquivalent:@""]); 1235 keyEquivalent:@""]);
1228 [item setTarget:self]; 1236 [item setTarget:self];
1229 [item setTag:IDC_NEW_WINDOW]; 1237 [item setTag:IDC_NEW_WINDOW];
(...skipping 30 matching lines...) Expand all
1260 [appController showPreferencesWindow:nil page:page profile:profile]; 1268 [appController showPreferencesWindow:nil page:page profile:profile];
1261 } 1269 }
1262 1270
1263 namespace app_controller_mac { 1271 namespace app_controller_mac {
1264 1272
1265 bool IsOpeningNewWindow() { 1273 bool IsOpeningNewWindow() {
1266 return g_is_opening_new_window; 1274 return g_is_opening_new_window;
1267 } 1275 }
1268 1276
1269 } // namespace app_controller_mac 1277 } // namespace app_controller_mac
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698