| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #import "chrome/app/breakpad_mac.h" | 5 #import "chrome/app/breakpad_mac.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #import "base/basictypes.h" | 10 #import "base/basictypes.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #import "base/logging.h" | 12 #import "base/logging.h" |
| 13 #include "base/mac_util.h" |
| 13 #import "base/scoped_nsautorelease_pool.h" | 14 #import "base/scoped_nsautorelease_pool.h" |
| 14 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
| 15 #import "breakpad/src/client/mac/Framework/Breakpad.h" | 16 #import "breakpad/src/client/mac/Framework/Breakpad.h" |
| 16 #include "chrome/common/child_process_logging.h" | 17 #include "chrome/common/child_process_logging.h" |
| 17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/installer/util/google_update_settings.h" | 19 #include "chrome/installer/util/google_update_settings.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 BreakpadRef gBreakpadRef = NULL; | 23 BreakpadRef gBreakpadRef = NULL; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 37 // Only called for a branded build of Chrome.app. | 38 // Only called for a branded build of Chrome.app. |
| 38 void InitCrashReporter() { | 39 void InitCrashReporter() { |
| 39 DCHECK(gBreakpadRef == NULL); | 40 DCHECK(gBreakpadRef == NULL); |
| 40 base::ScopedNSAutoreleasePool autorelease_pool; | 41 base::ScopedNSAutoreleasePool autorelease_pool; |
| 41 | 42 |
| 42 // Check whether the user has consented to stats and crash reporting. The | 43 // Check whether the user has consented to stats and crash reporting. The |
| 43 // browser process can make this determination directly. Helper processes | 44 // browser process can make this determination directly. Helper processes |
| 44 // may not have access to the disk or to the same data as the browser | 45 // may not have access to the disk or to the same data as the browser |
| 45 // process, so the browser passes the consent preference to them on the | 46 // process, so the browser passes the consent preference to them on the |
| 46 // command line. | 47 // command line. |
| 47 NSBundle* main_bundle = [NSBundle mainBundle]; | 48 NSBundle* main_bundle = mac_util::MainAppBundle(); |
| 48 NSDictionary* info_dictionary = [main_bundle infoDictionary]; | 49 NSDictionary* info_dictionary = [main_bundle infoDictionary]; |
| 49 bool is_browser = [[info_dictionary objectForKey:@"LSUIElement"] | 50 bool is_browser = [[info_dictionary objectForKey:@"LSUIElement"] |
| 50 isEqualToString:@"1"] ? false : true; | 51 isEqualToString:@"1"] ? false : true; |
| 51 bool enable_breakpad = | 52 bool enable_breakpad = |
| 52 is_browser ? GoogleUpdateSettings::GetCollectStatsConsent() : | 53 is_browser ? GoogleUpdateSettings::GetCollectStatsConsent() : |
| 53 CommandLine::ForCurrentProcess()-> | 54 CommandLine::ForCurrentProcess()-> |
| 54 HasSwitch(switches::kEnableCrashReporter); | 55 HasSwitch(switches::kEnableCrashReporter); |
| 55 | 56 |
| 56 if (!enable_breakpad) { | 57 if (!enable_breakpad) { |
| 57 LOG(WARNING) << "Breakpad disabled"; | 58 LOG(WARNING) << "Breakpad disabled"; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 BreakpadAddUploadParameter(gBreakpadRef, key, value); | 130 BreakpadAddUploadParameter(gBreakpadRef, key, value); |
| 130 } | 131 } |
| 131 | 132 |
| 132 void ClearCrashKeyValue(NSString* key) { | 133 void ClearCrashKeyValue(NSString* key) { |
| 133 if (gBreakpadRef == NULL) { | 134 if (gBreakpadRef == NULL) { |
| 134 return; | 135 return; |
| 135 } | 136 } |
| 136 | 137 |
| 137 BreakpadRemoveUploadParameter(gBreakpadRef, key); | 138 BreakpadRemoveUploadParameter(gBreakpadRef, key); |
| 138 } | 139 } |
| OLD | NEW |