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 #include <sys/sysctl.h> | 8 #include <sys/sysctl.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug/debugger.h" | 11 #include "base/debug/debugger.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/mac/bundle_locations.h" | 13 #include "base/mac/bundle_locations.h" |
14 #include "base/mac/mac_util.h" | 14 #include "base/mac/mac_util.h" |
15 #include "base/memory/scoped_nsobject.h" | 15 #include "base/mac/scoped_nsobject.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "chrome/app/breakpad_mac.h" | 18 #include "chrome/app/breakpad_mac.h" |
19 #import "chrome/browser/app_controller_mac.h" | 19 #import "chrome/browser/app_controller_mac.h" |
20 #import "chrome/browser/chrome_browser_application_mac.h" | 20 #import "chrome/browser/chrome_browser_application_mac.h" |
21 #include "chrome/browser/mac/install_from_dmg.h" | 21 #include "chrome/browser/mac/install_from_dmg.h" |
22 #include "chrome/browser/mac/keychain_reauthorize.h" | 22 #include "chrome/browser/mac/keychain_reauthorize.h" |
23 #import "chrome/browser/mac/keystone_glue.h" | 23 #import "chrome/browser/mac/keystone_glue.h" |
24 #include "chrome/browser/metrics/metrics_service.h" | 24 #include "chrome/browser/metrics/metrics_service.h" |
25 #include "chrome/browser/storage_monitor/storage_monitor_mac.h" | 25 #include "chrome/browser/storage_monitor/storage_monitor_mac.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // relaunched installed application to still consider itself as first-run. | 258 // relaunched installed application to still consider itself as first-run. |
259 if (!parsed_command_line().HasSwitch(switches::kNoFirstRun)) { | 259 if (!parsed_command_line().HasSwitch(switches::kNoFirstRun)) { |
260 if (MaybeInstallFromDiskImage()) { | 260 if (MaybeInstallFromDiskImage()) { |
261 // The application was installed and the installed copy has been | 261 // The application was installed and the installed copy has been |
262 // launched. This process is now obsolete. Exit. | 262 // launched. This process is now obsolete. Exit. |
263 exit(0); | 263 exit(0); |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 // Now load the nib (from the right bundle). | 267 // Now load the nib (from the right bundle). |
268 scoped_nsobject<NSNib> | 268 base::scoped_nsobject<NSNib> nib( |
269 nib([[NSNib alloc] initWithNibNamed:@"MainMenu" | 269 [[NSNib alloc] initWithNibNamed:@"MainMenu" |
270 bundle:base::mac::FrameworkBundle()]); | 270 bundle:base::mac::FrameworkBundle()]); |
271 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you | 271 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you |
272 // change this, you'll probably need to change the Valgrind suppression. | 272 // change this, you'll probably need to change the Valgrind suppression. |
273 [nib instantiateNibWithOwner:NSApp topLevelObjects:nil]; | 273 [nib instantiateNibWithOwner:NSApp topLevelObjects:nil]; |
274 // Make sure the app controller has been created. | 274 // Make sure the app controller has been created. |
275 DCHECK([NSApp delegate]); | 275 DCHECK([NSApp delegate]); |
276 | 276 |
277 // Prevent Cocoa from turning command-line arguments into | 277 // Prevent Cocoa from turning command-line arguments into |
278 // |-application:openFiles:|, since we already handle them directly. | 278 // |-application:openFiles:|, since we already handle them directly. |
279 [[NSUserDefaults standardUserDefaults] | 279 [[NSUserDefaults standardUserDefaults] |
280 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; | 280 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; |
281 } | 281 } |
282 | 282 |
283 void ChromeBrowserMainPartsMac::PreProfileInit() { | 283 void ChromeBrowserMainPartsMac::PreProfileInit() { |
284 storage_monitor_.reset(new chrome::StorageMonitorMac()); | 284 storage_monitor_.reset(new chrome::StorageMonitorMac()); |
285 | 285 |
286 ChromeBrowserMainPartsPosix::PreProfileInit(); | 286 ChromeBrowserMainPartsPosix::PreProfileInit(); |
287 } | 287 } |
288 | 288 |
289 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { | 289 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { |
290 AppController* appController = [NSApp delegate]; | 290 AppController* appController = [NSApp delegate]; |
291 [appController didEndMainMessageLoop]; | 291 [appController didEndMainMessageLoop]; |
292 } | 292 } |
OLD | NEW |