| 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_util.h" | 13 #include "base/debug_util.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/mac_util.h" | 15 #include "base/mac_util.h" |
| 16 #include "base/nss_util.h" |
| 16 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 17 #include "base/scoped_nsobject.h" | 18 #include "base/scoped_nsobject.h" |
| 18 #include "chrome/app/breakpad_mac.h" | 19 #include "chrome/app/breakpad_mac.h" |
| 19 #import "chrome/browser/app_controller_mac.h" | 20 #import "chrome/browser/app_controller_mac.h" |
| 20 #include "chrome/browser/browser_main_win.h" | 21 #include "chrome/browser/browser_main_win.h" |
| 21 #import "chrome/browser/chrome_browser_application_mac.h" | 22 #import "chrome/browser/chrome_browser_application_mac.h" |
| 22 #import "chrome/browser/cocoa/keystone_glue.h" | 23 #import "chrome/browser/cocoa/keystone_glue.h" |
| 23 #include "chrome/browser/metrics/metrics_service.h" | 24 #include "chrome/browser/metrics/metrics_service.h" |
| 24 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/main_function_params.h" | 27 #include "chrome/common/main_function_params.h" |
| 26 #include "chrome/common/notification_service.h" | 28 #include "chrome/common/notification_service.h" |
| 27 #include "chrome/common/result_codes.h" | 29 #include "chrome/common/result_codes.h" |
| 30 #include "net/socket/ssl_client_socket_mac_factory.h" |
| 28 | 31 |
| 29 void DidEndMainMessageLoop() { | 32 void DidEndMainMessageLoop() { |
| 30 AppController* appController = [NSApp delegate]; | 33 AppController* appController = [NSApp delegate]; |
| 31 [appController didEndMainMessageLoop]; | 34 [appController didEndMainMessageLoop]; |
| 32 } | 35 } |
| 33 | 36 |
| 34 void RecordBreakpadStatusUMA(MetricsService* metrics) { | 37 void RecordBreakpadStatusUMA(MetricsService* metrics) { |
| 35 metrics->RecordBreakpadRegistration(IsCrashReporterEnabled()); | 38 metrics->RecordBreakpadRegistration(IsCrashReporterEnabled()); |
| 36 metrics->RecordBreakpadHasDebugger(DebugUtil::BeingDebugged()); | 39 metrics->RecordBreakpadHasDebugger(DebugUtil::BeingDebugged()); |
| 37 } | 40 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 113 |
| 111 // This is a no-op if the KeystoneRegistration framework is not present. | 114 // This is a no-op if the KeystoneRegistration framework is not present. |
| 112 // The framework is only distributed with branded Google Chrome builds. | 115 // The framework is only distributed with branded Google Chrome builds. |
| 113 [[KeystoneGlue defaultKeystoneGlue] registerWithKeystone]; | 116 [[KeystoneGlue defaultKeystoneGlue] registerWithKeystone]; |
| 114 | 117 |
| 115 // Prevent Cocoa from turning command-line arguments into | 118 // Prevent Cocoa from turning command-line arguments into |
| 116 // |-application:openFiles:|, since we already handle them directly. | 119 // |-application:openFiles:|, since we already handle them directly. |
| 117 [[NSUserDefaults standardUserDefaults] | 120 [[NSUserDefaults standardUserDefaults] |
| 118 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; | 121 setObject:@"NO" forKey:@"NSTreatUnknownArgumentsAsOpen"]; |
| 119 } | 122 } |
| 123 |
| 124 private: |
| 125 virtual void InitializeSSL() { |
| 126 // Use NSS for SSL by default. |
| 127 // The default client socket factory uses NSS for SSL by default on Mac. |
| 128 if (parsed_command_line().HasSwitch(switches::kUseSystemSSL)) { |
| 129 net::ClientSocketFactory::SetSSLClientSocketFactory( |
| 130 net::SSLClientSocketMacFactory); |
| 131 } else { |
| 132 // We want to be sure to init NSPR on the main thread. |
| 133 base::EnsureNSPRInit(); |
| 134 } |
| 135 } |
| 120 }; | 136 }; |
| 121 | 137 |
| 122 // static | 138 // static |
| 123 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( | 139 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( |
| 124 const MainFunctionParams& parameters) { | 140 const MainFunctionParams& parameters) { |
| 125 return new BrowserMainPartsMac(parameters); | 141 return new BrowserMainPartsMac(parameters); |
| 126 } | 142 } |
| OLD | NEW |