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

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

Issue 2116103002: mac: Use instantiateWithOwner: instead of deprecated instantiateNibWithOwner: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: be more thrifty with newlines Created 4 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/chrome_browser_main_mac.h" 5 #include "chrome/browser/chrome_browser_main_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/mac/bundle_locations.h" 12 #include "base/mac/bundle_locations.h"
13 #import "base/mac/foundation_util.h" 13 #import "base/mac/foundation_util.h"
14 #include "base/mac/mac_util.h" 14 #include "base/mac/mac_util.h"
15 #include "base/mac/scoped_nsobject.h" 15 #include "base/mac/scoped_nsobject.h"
16 #include "base/mac/sdk_forward_declarations.h"
16 #include "base/path_service.h" 17 #include "base/path_service.h"
17 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
18 #import "chrome/browser/app_controller_mac.h" 19 #import "chrome/browser/app_controller_mac.h"
19 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h" 20 #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h"
20 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
21 #import "chrome/browser/chrome_browser_application_mac.h" 22 #import "chrome/browser/chrome_browser_application_mac.h"
22 #include "chrome/browser/mac/install_from_dmg.h" 23 #include "chrome/browser/mac/install_from_dmg.h"
23 #import "chrome/browser/mac/keystone_glue.h" 24 #import "chrome/browser/mac/keystone_glue.h"
24 #include "chrome/browser/mac/mac_startup_profiler.h" 25 #include "chrome/browser/mac/mac_startup_profiler.h"
25 #include "chrome/browser/ui/app_list/app_list_service.h" 26 #include "chrome/browser/ui/app_list/app_list_service.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 exit(0); 143 exit(0);
143 } 144 }
144 } 145 }
145 146
146 // Now load the nib (from the right bundle). 147 // Now load the nib (from the right bundle).
147 base::scoped_nsobject<NSNib> nib( 148 base::scoped_nsobject<NSNib> nib(
148 [[NSNib alloc] initWithNibNamed:@"MainMenu" 149 [[NSNib alloc] initWithNibNamed:@"MainMenu"
149 bundle:base::mac::FrameworkBundle()]); 150 bundle:base::mac::FrameworkBundle()]);
150 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you 151 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you
151 // change this, you'll probably need to change the Valgrind suppression. 152 // change this, you'll probably need to change the Valgrind suppression.
152 [nib instantiateNibWithOwner:NSApp topLevelObjects:nil]; 153 NSArray* top_level_objects = nil;
154 [nib instantiateWithOwner:NSApp topLevelObjects:&top_level_objects];
155 for (NSObject* object : top_level_objects)
Mark Mentovai 2016/07/01 21:50:39 Convenience function to instantiate the nib and re
Nico 2016/07/01 21:53:56 I agree :-) I think it'd be even nicer if the Fil
156 [object retain];
153 // Make sure the app controller has been created. 157 // Make sure the app controller has been created.
154 DCHECK([NSApp delegate]); 158 DCHECK([NSApp delegate]);
155 159
156 [[NSUserDefaults standardUserDefaults] registerDefaults:@{ 160 [[NSUserDefaults standardUserDefaults] registerDefaults:@{
157 // Prevent Cocoa from turning command-line arguments into 161 // Prevent Cocoa from turning command-line arguments into
158 // |-application:openFiles:|, since we already handle them directly. 162 // |-application:openFiles:|, since we already handle them directly.
159 // @"NO" looks like a mistake, but the value really is supposed to be a 163 // @"NO" looks like a mistake, but the value really is supposed to be a
160 // string. 164 // string.
161 @"NSTreatUnknownArgumentsAsOpen": @"NO" 165 @"NSTreatUnknownArgumentsAsOpen": @"NO"
162 }]; 166 }];
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 [glue updateProfileCountsWithNumProfiles:0 206 [glue updateProfileCountsWithNumProfiles:0
203 numSignedInProfiles:0]; 207 numSignedInProfiles:0];
204 } 208 }
205 } 209 }
206 210
207 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { 211 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() {
208 AppController* appController = 212 AppController* appController =
209 base::mac::ObjCCastStrict<AppController>([NSApp delegate]); 213 base::mac::ObjCCastStrict<AppController>([NSApp delegate]);
210 [appController didEndMainMessageLoop]; 214 [appController didEndMainMessageLoop];
211 } 215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698