summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_main_mac.mm
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-16 17:47:57 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-16 17:47:57 +0000
commit1bcdb53dbddb785f5538cb7081b073db90c822d1 (patch)
tree9b67e0a51f98ff2d0f0bb3462f530a08a8b7e6c4 /chrome/browser/browser_main_mac.mm
parent091db5d0615084d28dfbb78d8dd6c0e169b510a4 (diff)
downloadchromium_src-1bcdb53dbddb785f5538cb7081b073db90c822d1.zip
chromium_src-1bcdb53dbddb785f5538cb7081b073db90c822d1.tar.gz
chromium_src-1bcdb53dbddb785f5538cb7081b073db90c822d1.tar.bz2
mac bootstrapping of browser main and app startup bits
Review URL: http://codereview.chromium.org/18112 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8185 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main_mac.mm')
-rw-r--r--chrome/browser/browser_main_mac.mm61
1 files changed, 58 insertions, 3 deletions
diff --git a/chrome/browser/browser_main_mac.mm b/chrome/browser/browser_main_mac.mm
index c6c4381..8f493f3 100644
--- a/chrome/browser/browser_main_mac.mm
+++ b/chrome/browser/browser_main_mac.mm
@@ -1,11 +1,66 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <Cocoa/Cocoa.h>
#include "base/command_line.h"
+#include "chrome/app/result_codes.h"
+#include "chrome/browser/app_controller_mac.h"
+#include "chrome/browser/browser_main_win.h"
#include <crt_externs.h>
-int StartPlatformMessageLoop() {
- return NSApplicationMain(*_NSGetArgc(), (const char**)*_NSGetArgv());
+namespace Platform {
+
+// Perform and platform-specific work that needs to be done before the main
+// message loop is created and initialized.
+//
+// For Mac, this involves telling Cooca to finish its initalization, which we
+// want to do manually instead of calling NSApplicationMain(). The primary
+// reason is that NSAM() never returns, which would leave all the objects
+// currently on the stack in scoped_ptrs hanging and never cleaned up. We then
+// load the main nib directly. The main event loop is run from common code using
+// the MessageLoop API, which works out ok for us because it's a wrapper around
+// CFRunLoop.
+void WillInitializeMainMessageLoop(const CommandLine & command_line) {
+ [NSApplication sharedApplication];
+ [NSBundle loadNibNamed:@"MainMenu" owner:NSApp];
+}
+
+// Perform platform-specific work that needs to be done after the main event
+// loop has ended. We need to send the notifications that Cooca normally would
+// telling everyone the app is about to end.
+void WillTerminate() {
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName:NSApplicationWillTerminateNotification
+ object:NSApp];
+}
+
+}
+
+// From browser_main_win.h, stubs until we figure out the right thing...
+
+int DoUninstallTasks() {
+ return ResultCodes::NORMAL_EXIT;
+}
+
+bool DoUpgradeTasks(const CommandLine& command_line) {
+ return ResultCodes::NORMAL_EXIT;
+}
+
+bool CheckForWin2000() {
+ return false;
+}
+
+int HandleIconsCommands(const CommandLine &parsed_command_line) {
+ return 0;
+}
+
+bool CheckMachineLevelInstall() {
+ return false;
+}
+
+void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) {
+}
+
+void RecordBreakpadStatusUMA(MetricsService* metrics) {
}