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/file_path.h" | 12 #include "base/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/memory/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/system_monitor/removable_device_notifications_mac.h" | 25 #include "chrome/browser/system_monitor/removable_device_notifications_mac.h" |
| 26 #include "chrome/browser/system_monitor/image_capture_device_browser_mac.h" |
26 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "content/public/common/main_function_params.h" | 29 #include "content/public/common/main_function_params.h" |
29 #include "content/public/common/result_codes.h" | 30 #include "content/public/common/result_codes.h" |
30 #include "ui/base/l10n/l10n_util_mac.h" | 31 #include "ui/base/l10n/l10n_util_mac.h" |
31 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
32 #include "ui/base/resource/resource_handle.h" | 33 #include "ui/base/resource/resource_handle.h" |
33 | 34 |
34 namespace { | 35 namespace { |
35 | 36 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // ChromeBrowserMainPartsMac --------------------------------------------------- | 169 // ChromeBrowserMainPartsMac --------------------------------------------------- |
169 | 170 |
170 ChromeBrowserMainPartsMac::ChromeBrowserMainPartsMac( | 171 ChromeBrowserMainPartsMac::ChromeBrowserMainPartsMac( |
171 const content::MainFunctionParams& parameters) | 172 const content::MainFunctionParams& parameters) |
172 : ChromeBrowserMainPartsPosix(parameters) { | 173 : ChromeBrowserMainPartsPosix(parameters) { |
173 } | 174 } |
174 | 175 |
175 ChromeBrowserMainPartsMac::~ChromeBrowserMainPartsMac() { | 176 ChromeBrowserMainPartsMac::~ChromeBrowserMainPartsMac() { |
176 } | 177 } |
177 | 178 |
| 179 class ChromeBrowserMainPartsMac::Inner { |
| 180 public: |
| 181 Inner(); |
| 182 ~Inner(); |
| 183 |
| 184 scoped_nsobject<ImageCaptureDeviceBrowserMac> image_capture_device_browser_; |
| 185 }; |
| 186 |
| 187 ChromeBrowserMainPartsMac::Inner::Inner() { |
| 188 image_capture_device_browser_.reset( |
| 189 [[ImageCaptureDeviceBrowserMac alloc] init]); |
| 190 } |
| 191 |
| 192 ChromeBrowserMainPartsMac::Inner::~Inner() { |
| 193 [image_capture_device_browser_ close]; |
| 194 } |
| 195 |
178 void ChromeBrowserMainPartsMac::PreEarlyInitialization() { | 196 void ChromeBrowserMainPartsMac::PreEarlyInitialization() { |
179 if (parsed_command_line().HasSwitch(switches::kKeychainReauthorize)) { | 197 if (parsed_command_line().HasSwitch(switches::kKeychainReauthorize)) { |
180 if (base::mac::AmIBundled()) { | 198 if (base::mac::AmIBundled()) { |
181 LOG(FATAL) << "Inappropriate process type for Keychain reauthorization"; | 199 LOG(FATAL) << "Inappropriate process type for Keychain reauthorization"; |
182 } | 200 } |
183 | 201 |
184 // Do Keychain reauthorization at the time of update installation. This | 202 // Do Keychain reauthorization at the time of update installation. This |
185 // gets three chances to run. If the first or second try doesn't complete | 203 // gets three chances to run. If the first or second try doesn't complete |
186 // successfully (crashes or is interrupted for any reason), there will be | 204 // successfully (crashes or is interrupted for any reason), there will be |
187 // another chance. Once this step completes successfully, it should never | 205 // another chance. Once this step completes successfully, it should never |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 294 |
277 // Prevent Cocoa from turning command-line arguments into | 295 // Prevent Cocoa from turning command-line arguments into |
278 // |-application:openFiles:|, since we already handle them directly. | 296 // |-application:openFiles:|, since we already handle them directly. |
279 [[NSUserDefaults standardUserDefaults] | 297 [[NSUserDefaults standardUserDefaults] |
280 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; | 298 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; |
281 } | 299 } |
282 | 300 |
283 void ChromeBrowserMainPartsMac::PreProfileInit() { | 301 void ChromeBrowserMainPartsMac::PreProfileInit() { |
284 removable_device_notifications_mac_ = | 302 removable_device_notifications_mac_ = |
285 new chrome::RemovableDeviceNotificationsMac(); | 303 new chrome::RemovableDeviceNotificationsMac(); |
| 304 inner_.reset(new Inner); |
286 ChromeBrowserMainPartsPosix::PreProfileInit(); | 305 ChromeBrowserMainPartsPosix::PreProfileInit(); |
287 } | 306 } |
288 | 307 |
289 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { | 308 void ChromeBrowserMainPartsMac::DidEndMainMessageLoop() { |
290 AppController* appController = [NSApp delegate]; | 309 AppController* appController = [NSApp delegate]; |
291 [appController didEndMainMessageLoop]; | 310 [appController didEndMainMessageLoop]; |
292 } | 311 } |
OLD | NEW |