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 #import "chrome/app/breakpad_mac.h" | 5 #import "chrome/app/breakpad_mac.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
11 #import "base/basictypes.h" | 11 #import "base/basictypes.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #import "base/logging.h" | 15 #import "base/logging.h" |
16 #include "base/mac_util.h" | 16 #include "base/mac_util.h" |
17 #include "base/mac/scoped_cftyperef.h" | 17 #include "base/mac/scoped_cftyperef.h" |
| 18 #import "base/mac/scoped_nsautorelease_pool.h" |
18 #include "base/path_service.h" | 19 #include "base/path_service.h" |
19 #import "base/scoped_nsautorelease_pool.h" | |
20 #include "base/sys_string_conversions.h" | 20 #include "base/sys_string_conversions.h" |
21 #import "breakpad/src/client/mac/Framework/Breakpad.h" | 21 #import "breakpad/src/client/mac/Framework/Breakpad.h" |
22 #include "chrome/common/child_process_logging.h" | 22 #include "chrome/common/child_process_logging.h" |
23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/env_vars.h" | 25 #include "chrome/common/env_vars.h" |
26 #include "chrome/common/policy_constants.h" | 26 #include "chrome/common/policy_constants.h" |
27 #include "chrome/installer/util/google_update_settings.h" | 27 #include "chrome/installer/util/google_update_settings.h" |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 BreakpadRef gBreakpadRef = NULL; | 31 BreakpadRef gBreakpadRef = NULL; |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 bool IsCrashReporterEnabled() { | 35 bool IsCrashReporterEnabled() { |
36 return gBreakpadRef != NULL; | 36 return gBreakpadRef != NULL; |
37 } | 37 } |
38 | 38 |
39 void DestructCrashReporter() { | 39 void DestructCrashReporter() { |
40 if (gBreakpadRef) { | 40 if (gBreakpadRef) { |
41 BreakpadRelease(gBreakpadRef); | 41 BreakpadRelease(gBreakpadRef); |
42 gBreakpadRef = NULL; | 42 gBreakpadRef = NULL; |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 // Only called for a branded build of Chrome.app. | 46 // Only called for a branded build of Chrome.app. |
47 void InitCrashReporter() { | 47 void InitCrashReporter() { |
48 DCHECK(gBreakpadRef == NULL); | 48 DCHECK(gBreakpadRef == NULL); |
49 base::ScopedNSAutoreleasePool autorelease_pool; | 49 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
50 | 50 |
51 // Check whether crash reporting should be enabled. If enterprise | 51 // Check whether crash reporting should be enabled. If enterprise |
52 // configuration management controls crash reporting, it takes precedence. | 52 // configuration management controls crash reporting, it takes precedence. |
53 // Otherwise, check whether the user has consented to stats and crash | 53 // Otherwise, check whether the user has consented to stats and crash |
54 // reporting. The browser process can make this determination directly. | 54 // reporting. The browser process can make this determination directly. |
55 // Helper processes may not have access to the disk or to the same data as | 55 // Helper processes may not have access to the disk or to the same data as |
56 // the browser process, so the browser passes the decision to them on the | 56 // the browser process, so the browser passes the decision to them on the |
57 // command line. | 57 // command line. |
58 NSBundle* main_bundle = mac_util::MainAppBundle(); | 58 NSBundle* main_bundle = mac_util::MainAppBundle(); |
59 bool is_browser = !mac_util::IsBackgroundOnlyProcess(); | 59 bool is_browser = !mac_util::IsBackgroundOnlyProcess(); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 BreakpadAddUploadParameter(gBreakpadRef, key, value); | 196 BreakpadAddUploadParameter(gBreakpadRef, key, value); |
197 } | 197 } |
198 | 198 |
199 void ClearCrashKeyValue(NSString* key) { | 199 void ClearCrashKeyValue(NSString* key) { |
200 if (gBreakpadRef == NULL) { | 200 if (gBreakpadRef == NULL) { |
201 return; | 201 return; |
202 } | 202 } |
203 | 203 |
204 BreakpadRemoveUploadParameter(gBreakpadRef, key); | 204 BreakpadRemoveUploadParameter(gBreakpadRef, key); |
205 } | 205 } |
OLD | NEW |