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 "chrome/browser/browser_main.h" | 5 #include "chrome/browser/browser_main.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/debug_util.h" | 11 #include "base/debug_util.h" |
12 #include "chrome/app/breakpad_mac.h" | 12 #include "chrome/app/breakpad_mac.h" |
13 #import "chrome/app/keystone_glue.h" | 13 #import "chrome/app/keystone_glue.h" |
14 #import "chrome/browser/app_controller_mac.h" | 14 #import "chrome/browser/app_controller_mac.h" |
15 #include "chrome/browser/browser_main_win.h" | 15 #include "chrome/browser/browser_main_win.h" |
16 #import "chrome/browser/chrome_application_mac.h" | 16 #import "chrome/browser/chrome_browser_application_mac.h" |
17 #include "chrome/browser/metrics/metrics_service.h" | 17 #include "chrome/browser/metrics/metrics_service.h" |
18 #include "chrome/common/main_function_params.h" | 18 #include "chrome/common/main_function_params.h" |
19 #include "chrome/common/result_codes.h" | 19 #include "chrome/common/result_codes.h" |
20 | 20 |
21 namespace Platform { | 21 namespace Platform { |
22 | 22 |
23 // Tell Cooca to finish its initalization, which we want to do manually | 23 // Tell Cooca to finish its initalization, which we want to do manually |
24 // instead of calling NSApplicationMain(). The primary reason is that NSAM() | 24 // instead of calling NSApplicationMain(). The primary reason is that NSAM() |
25 // never returns, which would leave all the objects currently on the stack | 25 // never returns, which would leave all the objects currently on the stack |
26 // in scoped_ptrs hanging and never cleaned up. We then load the main nib | 26 // in scoped_ptrs hanging and never cleaned up. We then load the main nib |
27 // directly. The main event loop is run from common code using the | 27 // directly. The main event loop is run from common code using the |
28 // MessageLoop API, which works out ok for us because it's a wrapper around | 28 // MessageLoop API, which works out ok for us because it's a wrapper around |
29 // CFRunLoop. | 29 // CFRunLoop. |
30 void WillInitializeMainMessageLoop(const MainFunctionParams& parameters) { | 30 void WillInitializeMainMessageLoop(const MainFunctionParams& parameters) { |
31 // Initialize NSApplication using the custom subclass. Check whether NSApp | 31 // Initialize NSApplication using the custom subclass. |
32 // was already initialized using another class, because that would break | 32 [BrowserCrApplication sharedApplication]; |
33 // some things. | |
34 [CrApplication sharedApplication]; | |
35 if (![NSApp isKindOfClass:[CrApplication class]]) { | |
36 LOG(ERROR) << "NSApp should be of type CrApplication, not " | |
37 << [[NSApp className] UTF8String]; | |
38 DCHECK(false) << "NSApp is of wrong type"; | |
39 } | |
40 | 33 |
41 // Before we load the nib, we need to start up the resource bundle so we have | 34 // Before we load the nib, we need to start up the resource bundle so we have |
42 // the strings avaiable for localization. | 35 // the strings avaiable for localization. |
43 if (!parameters.ui_task) { | 36 if (!parameters.ui_task) { |
44 ResourceBundle::InitSharedInstance(std::wstring()); | 37 ResourceBundle::InitSharedInstance(std::wstring()); |
45 } | 38 } |
46 // Now load the nib. | 39 // Now load the nib. |
47 [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; | 40 [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; |
48 | 41 |
49 // This is a no-op if the KeystoneRegistration framework is not present. | 42 // This is a no-op if the KeystoneRegistration framework is not present. |
(...skipping 30 matching lines...) Expand all Loading... |
80 int HandleIconsCommands(const CommandLine& parsed_command_line) { | 73 int HandleIconsCommands(const CommandLine& parsed_command_line) { |
81 return 0; | 74 return 0; |
82 } | 75 } |
83 | 76 |
84 bool CheckMachineLevelInstall() { | 77 bool CheckMachineLevelInstall() { |
85 return false; | 78 return false; |
86 } | 79 } |
87 | 80 |
88 void PrepareRestartOnCrashEnviroment(const CommandLine& parsed_command_line) { | 81 void PrepareRestartOnCrashEnviroment(const CommandLine& parsed_command_line) { |
89 } | 82 } |
OLD | NEW |