Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 <Cocoa/Cocoa.h> | 5 #include <Cocoa/Cocoa.h> |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "chrome/app/result_codes.h" | 7 #include "chrome/app/result_codes.h" |
| 8 #include "chrome/browser/app_controller_mac.h" | 8 #include "chrome/browser/app_controller_mac.h" |
| 9 #include "chrome/browser/browser_main_win.h" | 9 #include "chrome/browser/browser_main_win.h" |
| 10 #include <crt_externs.h> | 10 #include <crt_externs.h> |
| 11 | 11 |
| 12 namespace Platform { | 12 namespace Platform { |
| 13 | 13 |
| 14 // Perform and platform-specific work that needs to be done before the main | 14 // Perform and platform-specific work that needs to be done before the main |
| 15 // message loop is created and initialized. | 15 // message loop is created and initialized. |
| 16 // | 16 // |
| 17 // For Mac, this involves telling Cooca to finish its initalization, which we | 17 // For Mac, this involves telling Cooca to finish its initalization, which we |
| 18 // want to do manually instead of calling NSApplicationMain(). The primary | 18 // want to do manually instead of calling NSApplicationMain(). The primary |
| 19 // reason is that NSAM() never returns, which would leave all the objects | 19 // reason is that NSAM() never returns, which would leave all the objects |
| 20 // currently on the stack in scoped_ptrs hanging and never cleaned up. We then | 20 // currently on the stack in scoped_ptrs hanging and never cleaned up. We then |
| 21 // load the main nib directly. The main event loop is run from common code using | 21 // load the main nib directly. The main event loop is run from common code using |
| 22 // the MessageLoop API, which works out ok for us because it's a wrapper around | 22 // the MessageLoop API, which works out ok for us because it's a wrapper around |
| 23 // CFRunLoop. | 23 // CFRunLoop. |
| 24 void WillInitializeMainMessageLoop(const CommandLine & command_line) { | 24 void WillInitializeMainMessageLoop(const CommandLine & command_line) { |
| 25 [NSApplication sharedApplication]; | 25 [NSApplication sharedApplication]; |
| 26 [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; | 26 [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; |
| 27 | |
| 28 // TODO(port): Use of LSUIElement=1 is a temporary fix. The right | |
| 29 // answer is to fix the renderer to not use Cocoa. | |
| 30 // | |
| 31 // Chromium.app currently as LSUIElement=1 in it's Info.plist. This | |
| 32 // allows subprocesses (created with a relaunch of our binary) to | |
| 33 // create an NSApplication without showing up in the dock. | |
| 34 // Subprocesses (such as the renderer) need an NSApplication for | |
| 35 // Cocoa happiness However, for the browser itself, we DO want it in | |
| 36 // the dock. These 3 lines make it happen. | |
|
pink (ping after 24hrs)
2009/02/25 13:59:34
would be helpful to have the bug# here for referen
| |
| 37 ProcessSerialNumber psn; | |
| 38 GetCurrentProcess(&psn); | |
| 39 TransformProcessType(&psn, kProcessTransformToForegroundApplication); | |
|
pink (ping after 24hrs)
2009/02/25 13:59:34
extra space after comma?
| |
| 27 } | 40 } |
| 28 | 41 |
| 29 // Perform platform-specific work that needs to be done after the main event | 42 // Perform platform-specific work that needs to be done after the main event |
| 30 // loop has ended. We need to send the notifications that Cooca normally would | 43 // loop has ended. We need to send the notifications that Cooca normally would |
| 31 // telling everyone the app is about to end. | 44 // telling everyone the app is about to end. |
| 32 void WillTerminate() { | 45 void WillTerminate() { |
| 33 [[NSNotificationCenter defaultCenter] | 46 [[NSNotificationCenter defaultCenter] |
| 34 postNotificationName:NSApplicationWillTerminateNotification | 47 postNotificationName:NSApplicationWillTerminateNotification |
| 35 object:NSApp]; | 48 object:NSApp]; |
| 36 } | 49 } |
| 37 | 50 |
| 38 } | 51 } |
| 39 | 52 |
| 40 // From browser_main_win.h, stubs until we figure out the right thing... | 53 // From browser_main_win.h, stubs until we figure out the right thing... |
| 41 | 54 |
| 42 int DoUninstallTasks(bool chrome_still_running) { | 55 int DoUninstallTasks(bool chrome_still_running) { |
| 43 return ResultCodes::NORMAL_EXIT; | 56 return ResultCodes::NORMAL_EXIT; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 57 | 70 |
| 58 bool CheckMachineLevelInstall() { | 71 bool CheckMachineLevelInstall() { |
| 59 return false; | 72 return false; |
| 60 } | 73 } |
| 61 | 74 |
| 62 void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) { | 75 void PrepareRestartOnCrashEnviroment(const CommandLine &parsed_command_line) { |
| 63 } | 76 } |
| 64 | 77 |
| 65 void RecordBreakpadStatusUMA(MetricsService* metrics) { | 78 void RecordBreakpadStatusUMA(MetricsService* metrics) { |
| 66 } | 79 } |
| OLD | NEW |