OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_posix.h" | 5 #include "chrome/browser/browser_main_posix.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "app/app_switches.h" | 9 #include "app/app_switches.h" |
10 #include "app/l10n_util_mac.h" | 10 #include "app/l10n_util_mac.h" |
11 #include "app/resource_bundle.h" | 11 #include "app/resource_bundle.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/debug/debugger.h" | 13 #include "base/debug/debugger.h" |
14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
15 #include "base/mac_util.h" | 15 #include "base/mac/mac_util.h" |
16 #include "base/nss_util.h" | 16 #include "base/nss_util.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/scoped_nsobject.h" | 18 #include "base/scoped_nsobject.h" |
19 #include "chrome/app/breakpad_mac.h" | 19 #include "chrome/app/breakpad_mac.h" |
20 #import "chrome/browser/app_controller_mac.h" | 20 #import "chrome/browser/app_controller_mac.h" |
21 #include "chrome/browser/browser_main_win.h" | 21 #include "chrome/browser/browser_main_win.h" |
22 #import "chrome/browser/chrome_browser_application_mac.h" | 22 #import "chrome/browser/chrome_browser_application_mac.h" |
23 #import "chrome/browser/ui/cocoa/keystone_glue.h" | 23 #import "chrome/browser/ui/cocoa/keystone_glue.h" |
24 #include "chrome/browser/metrics/metrics_service.h" | 24 #include "chrome/browser/metrics/metrics_service.h" |
25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 class BrowserMainPartsMac : public BrowserMainPartsPosix { | 64 class BrowserMainPartsMac : public BrowserMainPartsPosix { |
65 public: | 65 public: |
66 explicit BrowserMainPartsMac(const MainFunctionParams& parameters) | 66 explicit BrowserMainPartsMac(const MainFunctionParams& parameters) |
67 : BrowserMainPartsPosix(parameters) {} | 67 : BrowserMainPartsPosix(parameters) {} |
68 | 68 |
69 protected: | 69 protected: |
70 virtual void PreEarlyInitialization() { | 70 virtual void PreEarlyInitialization() { |
71 BrowserMainPartsPosix::PreEarlyInitialization(); | 71 BrowserMainPartsPosix::PreEarlyInitialization(); |
72 | 72 |
73 if (mac_util::WasLaunchedAsHiddenLoginItem()) { | 73 if (base::mac::WasLaunchedAsHiddenLoginItem()) { |
74 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); | 74 CommandLine* singleton_command_line = CommandLine::ForCurrentProcess(); |
75 singleton_command_line->AppendSwitch(switches::kNoStartupWindow); | 75 singleton_command_line->AppendSwitch(switches::kNoStartupWindow); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 virtual void PreMainMessageLoopStart() { | 79 virtual void PreMainMessageLoopStart() { |
80 BrowserMainPartsPosix::PreMainMessageLoopStart(); | 80 BrowserMainPartsPosix::PreMainMessageLoopStart(); |
81 | 81 |
82 // Tell Cooca to finish its initalization, which we want to do manually | 82 // Tell Cooca to finish its initalization, which we want to do manually |
83 // instead of calling NSApplicationMain(). The primary reason is that NSAM() | 83 // instead of calling NSApplicationMain(). The primary reason is that NSAM() |
(...skipping 22 matching lines...) Expand all Loading... |
106 CHECK(!loaded_locale.empty()) << "Default locale could not be found"; | 106 CHECK(!loaded_locale.empty()) << "Default locale could not be found"; |
107 | 107 |
108 FilePath resources_pack_path; | 108 FilePath resources_pack_path; |
109 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 109 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
110 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); | 110 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); |
111 } | 111 } |
112 | 112 |
113 // Now load the nib (from the right bundle). | 113 // Now load the nib (from the right bundle). |
114 scoped_nsobject<NSNib> | 114 scoped_nsobject<NSNib> |
115 nib([[NSNib alloc] initWithNibNamed:@"MainMenu" | 115 nib([[NSNib alloc] initWithNibNamed:@"MainMenu" |
116 bundle:mac_util::MainAppBundle()]); | 116 bundle:base::mac::MainAppBundle()]); |
117 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you | 117 // TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you |
118 // change this, you'll probably need to change the Valgrind suppression. | 118 // change this, you'll probably need to change the Valgrind suppression. |
119 [nib instantiateNibWithOwner:NSApp topLevelObjects:nil]; | 119 [nib instantiateNibWithOwner:NSApp topLevelObjects:nil]; |
120 // Make sure the app controller has been created. | 120 // Make sure the app controller has been created. |
121 DCHECK([NSApp delegate]); | 121 DCHECK([NSApp delegate]); |
122 | 122 |
123 // This is a no-op if the KeystoneRegistration framework is not present. | 123 // This is a no-op if the KeystoneRegistration framework is not present. |
124 // The framework is only distributed with branded Google Chrome builds. | 124 // The framework is only distributed with branded Google Chrome builds. |
125 [[KeystoneGlue defaultKeystoneGlue] registerWithKeystone]; | 125 [[KeystoneGlue defaultKeystoneGlue] registerWithKeystone]; |
126 | 126 |
(...skipping 15 matching lines...) Expand all Loading... |
142 base::EnsureNSPRInit(); | 142 base::EnsureNSPRInit(); |
143 } | 143 } |
144 } | 144 } |
145 }; | 145 }; |
146 | 146 |
147 // static | 147 // static |
148 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( | 148 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( |
149 const MainFunctionParams& parameters) { | 149 const MainFunctionParams& parameters) { |
150 return new BrowserMainPartsMac(parameters); | 150 return new BrowserMainPartsMac(parameters); |
151 } | 151 } |
OLD | NEW |