OLD | NEW |
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" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 // Now load the nib (from the right bundle). | 146 // Now load the nib (from the right bundle). |
147 base::scoped_nsobject<NSNib> nib( | 147 base::scoped_nsobject<NSNib> nib( |
148 [[NSNib alloc] initWithNibNamed:@"MainMenu" | 148 [[NSNib alloc] initWithNibNamed:@"MainMenu" |
149 bundle:base::mac::FrameworkBundle()]); | 149 bundle:base::mac::FrameworkBundle()]); |
150 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you | 150 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you |
151 // change this, you'll probably need to change the Valgrind suppression. | 151 // change this, you'll probably need to change the Valgrind suppression. |
152 [nib instantiateNibWithOwner:NSApp topLevelObjects:nil]; | 152 [nib instantiateNibWithOwner:NSApp topLevelObjects:nil]; |
153 // Make sure the app controller has been created. | 153 // Make sure the app controller has been created. |
154 DCHECK([NSApp delegate]); | 154 DCHECK([NSApp delegate]); |
155 | |
156 [[NSUserDefaults standardUserDefaults] registerDefaults:@{ | |
157 // Prevent Cocoa from turning command-line arguments into | |
158 // |-application:openFiles:|, since we already handle them directly. | |
159 // @"NO" looks like a mistake, but the value really is supposed to be a | |
160 // string. | |
161 @"NSTreatUnknownArgumentsAsOpen": @"NO" | |
162 }]; | |
163 } | 155 } |
164 | 156 |
165 void ChromeBrowserMainPartsMac::PostMainMessageLoopStart() { | 157 void ChromeBrowserMainPartsMac::PostMainMessageLoopStart() { |
166 MacStartupProfiler::GetInstance()->Profile( | 158 MacStartupProfiler::GetInstance()->Profile( |
167 MacStartupProfiler::POST_MAIN_MESSAGE_LOOP_START); | 159 MacStartupProfiler::POST_MAIN_MESSAGE_LOOP_START); |
168 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart(); | 160 ChromeBrowserMainPartsPosix::PostMainMessageLoopStart(); |
169 } | 161 } |
170 | 162 |
171 void ChromeBrowserMainPartsMac::PreProfileInit() { | 163 void ChromeBrowserMainPartsMac::PreProfileInit() { |
172 MacStartupProfiler::GetInstance()->Profile( | 164 MacStartupProfiler::GetInstance()->Profile( |
(...skipping 29 matching lines...) Expand all Loading... |
202 [glue updateProfileCountsWithNumProfiles:0 | 194 [glue updateProfileCountsWithNumProfiles:0 |
203 numSignedInProfiles:0]; | 195 numSignedInProfiles:0]; |
204 } | 196 } |
205 } | 197 } |
206 | 198 |
207 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { | 199 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { |
208 AppController* appController = | 200 AppController* appController = |
209 base::mac::ObjCCastStrict<AppController>([NSApp delegate]); | 201 base::mac::ObjCCastStrict<AppController>([NSApp delegate]); |
210 [appController didEndMainMessageLoop]; | 202 [appController didEndMainMessageLoop]; |
211 } | 203 } |
OLD | NEW |